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.
IQS624 Summary
Ultra low power I2C sensor for 2D Magnetic Angle, Capacitive touch and Inductive Proximity
IQS624 mbed Component Link
IQS624 Pinout
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
Diff: IQSdisplayTerminal.cpp
- Revision:
- 0:77730e5a870b
- Child:
- 1:1c22cfb8b555
diff -r 000000000000 -r 77730e5a870b IQSdisplayTerminal.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IQSdisplayTerminal.cpp Sat Feb 04 07:19:33 2017 +0000 @@ -0,0 +1,48 @@ +// A class library to display Azoteq IQS62x registers on a terminal +#include "IQSdisplayTerminal.h" + +// constructor +IQS62xDisplay::IQS62xDisplay() : + pc( USBTX, USBRX ) // first we run the constructor for the Serial port class +{ + frameCounter=0; + pc.baud(DISPLAY_BAUD_RATE); +} + +// display a startup message to serial port +void IQS62xDisplay::helloMessage(bool waitForUser) { + puts("\x1b[2J \x1b[?25l \x1b[H"); // ANSII/VT100 codes to clear screen, invisible cursor, home cursor + printf(" IQS62x 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"); + if ( waitForUser ) while( ! pc.readable() ); // wait for keypress to continue + puts("\x1b[2J \x1b[?25l \x1b[H"); // ANSII/VT100 codes to clear screen, invisible cursor, home cursor +} + +// show headings and I2C error count +void IQS62xDisplay::showStatus(int I2Cspeed, int I2CErrorCount) { + frameCounter++; + puts("\x1b[H"); // ANSI/VT100 command for cursor home + printf("\t\t\t"); + printf("\t IQS62x 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); +} + +// formatted hex display of IQS62x registers +void IQS62xDisplay::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 [00] "); ShowLine(0x00,0x0f); + printf("\r\n\r\n System Flags [10] "); ShowLine(0x10,0x1f); + printf("\r\n\r\n Counters [20] "); ShowLine(0x20,0x2f); + printf("\r\n\r\n Averages [30] "); ShowLine(0x30,0x3f); + printf("\r\n\r\n Touch Setup [40] "); ShowLine(0x40,0x4f); + printf("\r\n\r\n Touch Threshold [50] "); ShowLine(0x50,0x5f); + printf("\r\n\r\n Small Usr Setup [60] "); ShowLine(0x60,0x6f); + printf("\r\n\r\n Hall Settings [70] "); ShowLine(0x70,0x7f); + printf("\r\n\r\n Wheel Values [80] "); ShowLine(0x80,0x8f); + printf("\r\n\r\n System Setup [d0] "); ShowLine(0xd0,0xdf); + printf("\r\n\r\n"); +} \ No newline at end of file