this is a first compilation of a library for IQS5xx. For now, it work with the iqs572ev02 devellopment board. The code is inspired with the sample code provide by Azotech. I have some issu with the interrupt pin RDY, which seem to be high even I don't touch de board.
main.cpp
- Committer:
- skydarc
- Date:
- 2020-01-01
- Revision:
- 1:65f5b13e6177
- Parent:
- 0:4907da2299a4
- Child:
- 2:bd4b620316aa
File content as of revision 1:65f5b13e6177:
#include "mbed.h" #include <IQS5xx.h> /***** Object Declarations *****/ IQS5xx trackPad(p28, p27, p17); DigitalOut led1(LED1); DigitalOut led3(LED3); DigitalOut led4(LED4); DigitalIn rdy(p17); //InterruptIn rdyInter(p17); void ISR1() { //this is the response to interrupt, i.e. the ISR led3 = !led3; } int main() { rdy.mode(PullUp); //rdyInter.rise(&ISR1); trackPad.AcknowledgeReset(); trackPad.checkVersion(); while(1) { uint8_t ui8TempData[30], i; while(!rdy) { led4 = 1; wait(0.05); led4 = 0; wait(0.05); } trackPad.I2C_Read(GestureEvents0_adr, &trackPad.Data_Buff[0], 44); if((trackPad.Data_Buff[3] & SNAP_TOGGLE) != 0) { // If there was a change in a snap status, then read the snap status // bytes additionally. Keep previous valus to identify a state change // trackPad.I2C_Read(SnapStatus_adr, &ui8TempData[0], 30); for(i = 0; i < 15; i++) { trackPad.ui16PrevSnap[i] = trackPad.ui16SnapStatus[i]; trackPad.ui16SnapStatus[i] = ((uint16_t)(ui8TempData[2*i])<<8) + (uint16_t)ui8TempData[(2*i)+1]; } } // // Terminate the communication session, so that the IQS5xx can continue // with sensing and processing // trackPad.Close_Comms(); // // Process received data // trackPad.Process_XY(); led1 = 1; wait(0.01); led1 = 0; wait(0.01); } }