Azoteq IQS624 Serial Terminal Display Class

Dependents:   IQS624_HelloWorld Nucleo_ACM1602_I2C_DC_Angle

Library: IQSDisplayTerminal

Library for formatted display of IQS624 registers on a serial terminal

Screen Capture

Below is a screen capture of formatted output on a serial terminal program.
Note that over a million frames were captured with zero I2C errors. /media/uploads/AzqDev/iqs624-display-screencap-1m.gif

IQS624 Summary

Ultra low power I2C sensor for 2D Magnetic Angle, Capacitive touch and Inductive Proximity

IQS624 mbed Component Link

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


IQS624 Pinout

/media/uploads/AzqDev/iqs624-pinout-s3.gif

/media/uploads/AzqDev/iqs624-and-lpc1768-tiny.gif

IQS624 Connected to mbed LPC1768 board. The five wires are power(2), I2C(2) and RDY(1).

IQS624 Data Sheet

Azoteq IQS624 Data sheet & Evaluation Kit Information: http://bit.ly/IQS624_ds



IQS624 YouTube Link

IQS624 1-minute YouTube video: http://bit.ly/IQS624Video

Files at this revision

API Documentation at this revision

Comitter:
AzqDev
Date:
Sun May 14 19:56:28 2017 +0000
Parent:
11:5200ac4ee76e
Child:
13:e5cbff2da2e7
Commit message:
Added showAllRegisters

Changed in this revision

IQSdisplayTerminal.cpp Show annotated file Show diff for this revision Revisions of this file
IQSdisplayTerminal.h Show annotated file Show diff for this revision Revisions of this file
--- a/IQSdisplayTerminal.cpp	Sun May 14 16:23:25 2017 +0000
+++ b/IQSdisplayTerminal.cpp	Sun May 14 19:56:28 2017 +0000
@@ -15,19 +15,20 @@
 IQS62xDisplay::IQS62xDisplay() : Serial(USBTX,USBRX) // use mbed default serial port
 #endif
 
-{    
+{
     frameCounter=0;
     baud(DISPLAY_BAUD_RATE);
-}    
+}
 
 #if defined(TARGET_TEENSY3_1) || defined (TARGET_TEENSY3_2) || IQS_USE_USBSERIAL
-void IQS62xDisplay::baud(int baudRate){}
+void IQS62xDisplay::baud(int baudRate) {}
 #endif
 
 // display a startup message to serial port
-void IQS62xDisplay::helloMessage(bool waitForUser) {
+void IQS62xDisplay::helloMessage(bool waitForUser)
+{
     puts("\x1b[2J  \x1b[?25l  \x1b[H"); // ANSII/VT100 codes to clear screen, invisible cursor, home cursor
-    printf("           IQS624 Register Display\r\n\r\n"); 
+    printf("           IQS624 Register Display\r\n\r\n");
     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");
     printf("Handy hint - In many terminal programs, Alt-B (break) will reset your Nucleo Board.\r\n\r\n");
     printf("Press any key to continue...\r\n");
@@ -36,42 +37,45 @@
 }
 
 // show headings and I2C error count
-void IQS62xDisplay::showStatus(int I2Cspeed, int I2CErrorCount) {
+void IQS62xDisplay::showStatus(int I2Cspeed, int I2CErrorCount)
+{
     frameCounter++;
     puts("\x1b[H"); // ANSI/VT100 command for cursor home
-    printf("\t\t"); 
+    printf("\t\t");
     printf("\t IQS624 Register Display\r\n\r\n"); // heading
     printf("\t Frame number %06d", frameCounter);
     printf("\t I2C Speed %dk", I2Cspeed/1000);
     printf("\t I2C Errors %d", I2CErrorCount);
 }
 
-// dump one line of text from the buffer with VT100 color formatting    
-void IQS62xDisplay::showLine(char * buffer, char * color, int startbyte, int endbyte) {
-  for (int i=startbyte; i<=endbyte; i++) {
+// dump one line of text from the buffer with VT100 color formatting
+void IQS62xDisplay::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]);
+            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
-      }
- }
+#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 IQS62x registers
-void IQS62xDisplay::showRegisters(char * buffer, char* color, bool debug) {
-    bool d = debug; // if this is true we always display all 16 values in the line
-    printf("\r\n\r\n  Device ID (43)  [00] "); showLine(buffer,color,0x00,d?0x0f:0x02);
-    printf("\r\n\r\n    System Flags  [10] "); showLine(buffer,color,0x10,d?0x1f:0x15);
-    printf("\r\n\r\n Raw Channels 0-5 [20] "); showLine(buffer,color,0x20,d?0x2f:0x2b);
-    printf("\r\n\r\n        Averages  [30] "); showLine(buffer,color,0x30,d?0x3f:0x33);
-    printf("\r\n\r\n     Touch Setup  [40] "); showLine(buffer,color,0x40,d?0x4f:0x49);
-    printf("\r\n\r\n Touch Thresholds [50] "); showLine(buffer,color,0x50,d?0x5f:0x54);
-    printf("\r\n\r\n   Hall Settings  [70] "); showLine(buffer,color,0x70,d?0x7f:0x7a);
-    printf("\r\n\r\n   Wheel Outputs  [80] "); showLine(buffer,color,0x80,d?0x8f:0x8f);
-    printf("\r\n\r\n    System Setup  [d0] "); showLine(buffer,color,0xd0,d?0xdf:0xd6);
+void IQS62xDisplay::showRegisters(char * buffer, char* color, bool showAllRegisters)
+{
+    bool d = showAllRegisters; // if true show all 16 registers per line
+    printf("\r\n\r\n  Device ID (43)  [00] ");    showLine(buffer,color,0x00,d?0x0f:0x02);
+    printf("\r\n\r\n    System Flags  [10] ");    showLine(buffer,color,0x10,d?0x1f:0x15);
+    printf("\r\n\r\n Raw Channels 0-5 [20] ");    showLine(buffer,color,0x20,d?0x2f:0x2b);
+    printf("\r\n\r\n        Averages  [30] ");    showLine(buffer,color,0x30,d?0x3f:0x33);
+    printf("\r\n\r\n     Touch Setup  [40] ");    showLine(buffer,color,0x40,d?0x4f:0x49);
+    printf("\r\n\r\n Touch Thresholds [50] ");    showLine(buffer,color,0x50,d?0x5f:0x54);
+    printf("\r\n\r\n   Hall Settings  [70] ");    showLine(buffer,color,0x70,d?0x7f:0x7a);
+    printf("\r\n\r\n   Wheel Outputs  [80] ");    showLine(buffer,color,0x80,d?0x8f:0x8f);
+    printf("\r\n\r\n    System Setup  [d0] ");    showLine(buffer,color,0xd0,d?0xdf:0xd6);
     printf("\r\n\r\n");
 }
\ No newline at end of file
--- a/IQSdisplayTerminal.h	Sun May 14 16:23:25 2017 +0000
+++ b/IQSdisplayTerminal.h	Sun May 14 19:56:28 2017 +0000
@@ -29,5 +29,5 @@
     void helloMessage(bool); // show startup message
     void showStatus(int,int); // show headings and I2C Error Count
     void showLine(char *, char *,int,int); // print a single line with color highlighting
-    void showRegisters(char *,char *,bool); // show IQS62x registers and debug option
+    void showRegisters(char *,char *,bool); // show IQS62x registers
 };
\ No newline at end of file