Register Display of Azoteq IQS620 Magnetic/Touch/Inductive sensor
A library that performs a register dump of the Azoteq IQS620 ultra low power multisensor registers.
More information on the IQS620 here:
Serial Terminal Output
Diff: IQS620DisplayTerminal.cpp
- Revision:
- 2:da8082c7476a
- Parent:
- 1:7461e3536893
- Child:
- 3:945b99d8bb87
--- a/IQS620DisplayTerminal.cpp Fri May 05 17:52:19 2017 +0000 +++ b/IQS620DisplayTerminal.cpp Sat May 13 00:12:38 2017 +0000 @@ -46,21 +46,39 @@ printf("\t I2C Errors %d", I2CErrorCount); } +// dump one line of text from the buffer with VT100 color formatting +void IQS620Display::showLine(char * buffer, char * color, int startbyte, int endbyte) { + for (int i=startbyte; i<=endbyte; i++) { + if ( color == NULL || color[i] == 0 ) + printf("%02x ", buffer[i]); + else + #define USE_IQS_COLOR_DISPLAY + #ifndef DONT_USE_IQS_COLOR_DISPLAY + printf("\x1b[32m%02x\x1b[30m ", buffer[i]); // print out in green (ANSI VT100 code) + #else + printf("%02x ", buffer[i]); // print out in black & white + #endif + } + } + + + + // formatted hex display of IQS620 registers -void IQS620Display::showRegisters(char * buffer) { - #define ShowLine(FROM,TO) for(int j=(FROM);j<=(TO);j++)printf("%02x ",buffer[j]) - printf("\r\n\r\n Device ID (41) [00] "); ShowLine(0x00,0x02); - printf("\r\n\r\n Events and Flags [10] "); ShowLine(0x10,0x1b); - printf("\r\n\r\n Channels 0-5 Raw Values [20] "); ShowLine(0x20,0x2b); - printf("\r\n\r\n Long Term Average Data [30] "); ShowLine(0x30,0x35); - printf("\r\n\r\n Proxfusion Settings #0 [40] "); ShowLine(0x40,0x4b); - printf("\r\n\r\n Proxfusion Settings #1 [50] "); ShowLine(0x50,0x57); - printf("\r\n\r\n Proxfusion Thresholds [60] "); ShowLine(0x60,0x66); - printf("\r\n\r\n SAR Thresholds [70] "); ShowLine(0x70,0x75); - printf("\r\n\r\n Metal Detect Threshold [80] "); ShowLine(0x80,0x83); - printf("\r\n\r\n Hall Sensor Settings [90] "); ShowLine(0x90,0x93); - printf("\r\n\r\n Hall Switch Thresholds [A0] "); ShowLine(0xa0,0xa5); - printf("\r\n\r\n Temperature Cal/Limits [C0] "); ShowLine(0xc0,0xc3); - printf("\r\n\r\n Device & Power Settings [D0] "); ShowLine(0xd0,0xd8); +// with color highlighting +void IQS620Display::showRegisters(char * buffer,char * color) { + printf("\r\n\r\n Device ID (41) [00] "); showLine(buffer,color,0x00,0x02); + printf("\r\n\r\n Events and Flags [10] "); showLine(buffer,color,0x10,0x1b); + printf("\r\n\r\n Channels 0-5 Raw Values [20] "); showLine(buffer,color,0x20,0x2b); + printf("\r\n\r\n Long Term Average Data [30] "); showLine(buffer,color,0x30,0x35); + printf("\r\n\r\n Proxfusion Settings #0 [40] "); showLine(buffer,color,0x40,0x4b); + printf("\r\n\r\n Proxfusion Settings #1 [50] "); showLine(buffer,color,0x50,0x57); + printf("\r\n\r\n Proxfusion Thresholds [60] "); showLine(buffer,color,0x60,0x66); + printf("\r\n\r\n SAR Thresholds [70] "); showLine(buffer,color,0x70,0x75); + printf("\r\n\r\n Metal Detect Threshold [80] "); showLine(buffer,color,0x80,0x83); + printf("\r\n\r\n Hall Sensor Settings [90] "); showLine(buffer,color,0x90,0x93); + printf("\r\n\r\n Hall Switch Thresholds [A0] "); showLine(buffer,color,0xa0,0xa5); + printf("\r\n\r\n Temperature Cal/Limits [C0] "); showLine(buffer,color,0xc0,0xc3); + printf("\r\n\r\n Device & Power Settings [D0] "); showLine(buffer,color,0xd0,0xd8); printf("\r\n\r\n"); } \ No newline at end of file