Register Display of Azoteq IQS620 Magnetic/Touch/Inductive sensor

Dependents:   IQS620_HelloWorld

A library that performs a register dump of the Azoteq IQS620 ultra low power multisensor registers.

More information on the IQS620 here:

Components / IQS620A
Ultra low power sensor for magnetic field, capacitive touch and inductive proximity. Empowers next-generation user interfaces.

Low Cost Evaluation Board For Azoteq IQS620A ultra low power sensor for magnetic field, capacitance, inductive proximity and temperature. Empowers next-generation user interfaces.

Serial Terminal Output

/media/uploads/AzqDev/iqs620-azoteq-multi-function-sensor-mbed-library-register-display.gif

Committer:
AzqDev
Date:
Fri May 05 17:52:19 2017 +0000
Revision:
1:7461e3536893
Parent:
0:39828a1d036f
Child:
2:da8082c7476a
Heading Spacing

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AzqDev 0:39828a1d036f 1 // A class library to display Azoteq IQS620 registers on a terminal
AzqDev 0:39828a1d036f 2
AzqDev 0:39828a1d036f 3 // Copyright 2017 Azoteq. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
AzqDev 0:39828a1d036f 4
AzqDev 0:39828a1d036f 5 // More info on IQS620 sensor IC: http://bit.ly/IQS620-info
AzqDev 0:39828a1d036f 6
AzqDev 0:39828a1d036f 7 // IQS620 1-minute youtube video: N.A.
AzqDev 0:39828a1d036f 8
AzqDev 0:39828a1d036f 9 #include "IQS620DisplayTerminal.h"
AzqDev 0:39828a1d036f 10
AzqDev 0:39828a1d036f 11 // constructor
AzqDev 0:39828a1d036f 12 #if defined(TARGET_TEENSY3_1) || defined (TARGET_TEENSY3_2) || IQS_USE_USBSERIAL
AzqDev 0:39828a1d036f 13 IQS620Display::IQS620Display() : USBSerial() // use our own USB device stack
AzqDev 0:39828a1d036f 14 #else
AzqDev 0:39828a1d036f 15 IQS620Display::IQS620Display() : Serial(USBTX,USBRX) // use mbed default serial port
AzqDev 0:39828a1d036f 16 #endif
AzqDev 0:39828a1d036f 17
AzqDev 0:39828a1d036f 18 {
AzqDev 0:39828a1d036f 19 frameCounter=0;
AzqDev 0:39828a1d036f 20 baud(DISPLAY_BAUD_RATE);
AzqDev 0:39828a1d036f 21 }
AzqDev 0:39828a1d036f 22
AzqDev 0:39828a1d036f 23 #if defined(TARGET_TEENSY3_1) || defined (TARGET_TEENSY3_2) || IQS_USE_USBSERIAL
AzqDev 0:39828a1d036f 24 void IQS620Display::baud(int baudRate){}
AzqDev 0:39828a1d036f 25 #endif
AzqDev 0:39828a1d036f 26
AzqDev 0:39828a1d036f 27 // display a startup message to serial port
AzqDev 0:39828a1d036f 28 void IQS620Display::helloMessage(bool waitForUser) {
AzqDev 0:39828a1d036f 29 puts("\x1b[2J \x1b[?25l \x1b[H"); // ANSII/VT100 codes to clear screen, invisible cursor, home cursor
AzqDev 0:39828a1d036f 30 printf(" IQS620 Register Display\r\n\r\n");
AzqDev 0:39828a1d036f 31 printf("To get a smooth screen refresh effect, use a terminal program that supports ANSI/VT100 escape codes such as Tera Term.\r\n\r\n");
AzqDev 0:39828a1d036f 32 printf("Handy hint - In many terminal programs, Alt-B (break) will reset your mbed Board.\r\n\r\n");
AzqDev 0:39828a1d036f 33 printf("Press any key to continue...\r\n");
AzqDev 0:39828a1d036f 34 if ( waitForUser ) while( ! readable() ); // wait for keypress to continue
AzqDev 0:39828a1d036f 35 puts("\x1b[2J \x1b[?25l \x1b[H"); // ANSII/VT100 codes to clear screen, invisible cursor, home cursor
AzqDev 0:39828a1d036f 36 }
AzqDev 0:39828a1d036f 37
AzqDev 0:39828a1d036f 38 // show headings and I2C error count
AzqDev 0:39828a1d036f 39 void IQS620Display::showStatus(int I2Cspeed, int I2CErrorCount) {
AzqDev 0:39828a1d036f 40 frameCounter++;
AzqDev 0:39828a1d036f 41 puts("\x1b[H"); // ANSI/VT100 command for cursor home
AzqDev 1:7461e3536893 42 printf("\t");
AzqDev 0:39828a1d036f 43 printf("\t IQS620 Register Display\r\n\r\n"); // heading
AzqDev 0:39828a1d036f 44 printf("\t Frame number %06d", frameCounter);
AzqDev 0:39828a1d036f 45 printf("\t I2C Speed %dk", I2Cspeed/1000);
AzqDev 0:39828a1d036f 46 printf("\t I2C Errors %d", I2CErrorCount);
AzqDev 0:39828a1d036f 47 }
AzqDev 0:39828a1d036f 48
AzqDev 0:39828a1d036f 49 // formatted hex display of IQS620 registers
AzqDev 0:39828a1d036f 50 void IQS620Display::showRegisters(char * buffer) {
AzqDev 0:39828a1d036f 51 #define ShowLine(FROM,TO) for(int j=(FROM);j<=(TO);j++)printf("%02x ",buffer[j])
AzqDev 0:39828a1d036f 52 printf("\r\n\r\n Device ID (41) [00] "); ShowLine(0x00,0x02);
AzqDev 0:39828a1d036f 53 printf("\r\n\r\n Events and Flags [10] "); ShowLine(0x10,0x1b);
AzqDev 0:39828a1d036f 54 printf("\r\n\r\n Channels 0-5 Raw Values [20] "); ShowLine(0x20,0x2b);
AzqDev 0:39828a1d036f 55 printf("\r\n\r\n Long Term Average Data [30] "); ShowLine(0x30,0x35);
AzqDev 0:39828a1d036f 56 printf("\r\n\r\n Proxfusion Settings #0 [40] "); ShowLine(0x40,0x4b);
AzqDev 0:39828a1d036f 57 printf("\r\n\r\n Proxfusion Settings #1 [50] "); ShowLine(0x50,0x57);
AzqDev 0:39828a1d036f 58 printf("\r\n\r\n Proxfusion Thresholds [60] "); ShowLine(0x60,0x66);
AzqDev 0:39828a1d036f 59 printf("\r\n\r\n SAR Thresholds [70] "); ShowLine(0x70,0x75);
AzqDev 0:39828a1d036f 60 printf("\r\n\r\n Metal Detect Threshold [80] "); ShowLine(0x80,0x83);
AzqDev 0:39828a1d036f 61 printf("\r\n\r\n Hall Sensor Settings [90] "); ShowLine(0x90,0x93);
AzqDev 0:39828a1d036f 62 printf("\r\n\r\n Hall Switch Thresholds [A0] "); ShowLine(0xa0,0xa5);
AzqDev 0:39828a1d036f 63 printf("\r\n\r\n Temperature Cal/Limits [C0] "); ShowLine(0xc0,0xc3);
AzqDev 0:39828a1d036f 64 printf("\r\n\r\n Device & Power Settings [D0] "); ShowLine(0xd0,0xd8);
AzqDev 0:39828a1d036f 65 printf("\r\n\r\n");
AzqDev 0:39828a1d036f 66 }