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

Committer:
AzqDev
Date:
Sat Feb 04 07:19:33 2017 +0000
Revision:
0:77730e5a870b
Child:
1:1c22cfb8b555
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AzqDev 0:77730e5a870b 1 // A class library to display Azoteq IQS62x registers on a terminal
AzqDev 0:77730e5a870b 2 #include "IQSdisplayTerminal.h"
AzqDev 0:77730e5a870b 3
AzqDev 0:77730e5a870b 4 // constructor
AzqDev 0:77730e5a870b 5 IQS62xDisplay::IQS62xDisplay() :
AzqDev 0:77730e5a870b 6 pc( USBTX, USBRX ) // first we run the constructor for the Serial port class
AzqDev 0:77730e5a870b 7 {
AzqDev 0:77730e5a870b 8 frameCounter=0;
AzqDev 0:77730e5a870b 9 pc.baud(DISPLAY_BAUD_RATE);
AzqDev 0:77730e5a870b 10 }
AzqDev 0:77730e5a870b 11
AzqDev 0:77730e5a870b 12 // display a startup message to serial port
AzqDev 0:77730e5a870b 13 void IQS62xDisplay::helloMessage(bool waitForUser) {
AzqDev 0:77730e5a870b 14 puts("\x1b[2J \x1b[?25l \x1b[H"); // ANSII/VT100 codes to clear screen, invisible cursor, home cursor
AzqDev 0:77730e5a870b 15 printf(" IQS62x Register Display\r\n\r\n");
AzqDev 0:77730e5a870b 16 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:77730e5a870b 17 printf("Handy hint - In many terminal programs, Alt-B (break) will reset your Nucleo Board.\r\n\r\n");
AzqDev 0:77730e5a870b 18 printf("Press any key to continue...\r\n");
AzqDev 0:77730e5a870b 19 if ( waitForUser ) while( ! pc.readable() ); // wait for keypress to continue
AzqDev 0:77730e5a870b 20 puts("\x1b[2J \x1b[?25l \x1b[H"); // ANSII/VT100 codes to clear screen, invisible cursor, home cursor
AzqDev 0:77730e5a870b 21 }
AzqDev 0:77730e5a870b 22
AzqDev 0:77730e5a870b 23 // show headings and I2C error count
AzqDev 0:77730e5a870b 24 void IQS62xDisplay::showStatus(int I2Cspeed, int I2CErrorCount) {
AzqDev 0:77730e5a870b 25 frameCounter++;
AzqDev 0:77730e5a870b 26 puts("\x1b[H"); // ANSI/VT100 command for cursor home
AzqDev 0:77730e5a870b 27 printf("\t\t\t");
AzqDev 0:77730e5a870b 28 printf("\t IQS62x Register Display\r\n\r\n"); // heading
AzqDev 0:77730e5a870b 29 printf("\t Frame number %06d", frameCounter);
AzqDev 0:77730e5a870b 30 printf("\t I2C Speed %dk", I2Cspeed/1000);
AzqDev 0:77730e5a870b 31 printf("\t I2C Errors %d", I2CErrorCount);
AzqDev 0:77730e5a870b 32 }
AzqDev 0:77730e5a870b 33
AzqDev 0:77730e5a870b 34 // formatted hex display of IQS62x registers
AzqDev 0:77730e5a870b 35 void IQS62xDisplay::showRegisters(char * buffer) {
AzqDev 0:77730e5a870b 36 #define ShowLine(FROM,TO) for(int j=(FROM);j<=(TO);j++)printf("%02x ",buffer[j])
AzqDev 0:77730e5a870b 37 printf("\r\n\r\n Device ID [00] "); ShowLine(0x00,0x0f);
AzqDev 0:77730e5a870b 38 printf("\r\n\r\n System Flags [10] "); ShowLine(0x10,0x1f);
AzqDev 0:77730e5a870b 39 printf("\r\n\r\n Counters [20] "); ShowLine(0x20,0x2f);
AzqDev 0:77730e5a870b 40 printf("\r\n\r\n Averages [30] "); ShowLine(0x30,0x3f);
AzqDev 0:77730e5a870b 41 printf("\r\n\r\n Touch Setup [40] "); ShowLine(0x40,0x4f);
AzqDev 0:77730e5a870b 42 printf("\r\n\r\n Touch Threshold [50] "); ShowLine(0x50,0x5f);
AzqDev 0:77730e5a870b 43 printf("\r\n\r\n Small Usr Setup [60] "); ShowLine(0x60,0x6f);
AzqDev 0:77730e5a870b 44 printf("\r\n\r\n Hall Settings [70] "); ShowLine(0x70,0x7f);
AzqDev 0:77730e5a870b 45 printf("\r\n\r\n Wheel Values [80] "); ShowLine(0x80,0x8f);
AzqDev 0:77730e5a870b 46 printf("\r\n\r\n System Setup [d0] "); ShowLine(0xd0,0xdf);
AzqDev 0:77730e5a870b 47 printf("\r\n\r\n");
AzqDev 0:77730e5a870b 48 }