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.
Revision 2:bd4b620316aa, committed 2020-01-01
- Comitter:
- skydarc
- Date:
- Wed Jan 01 16:39:19 2020 +0000
- Parent:
- 1:65f5b13e6177
- Commit message:
- done ! the rdy pin is functionnal. the "system config 1" register need to be properly configured.
Changed in this revision
IQS5xx/IQS5xx.cpp | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/IQS5xx/IQS5xx.cpp Wed Jan 01 12:58:46 2020 +0000 +++ b/IQS5xx/IQS5xx.cpp Wed Jan 01 16:39:19 2020 +0000 @@ -56,13 +56,31 @@ //////////////////////// // check other address : //////////////////////// + + // System Config 1 + ui8DataBuffer[0] = 3; + I2C_Write(SystemConfig1_adr, &ui8DataBuffer[0] ,1); + I2C_Read(SystemConfig1_adr, &ui8DataBuffer[0] ,1); + printf("System Config : %d\n", ui8DataBuffer[0]); // swipe initial distance - ui8DataBuffer[1] = 180; ui8DataBuffer[0] = 0; + ui8DataBuffer[1] = 150; ui8DataBuffer[0] = 0; I2C_Write(SwipeInitDistance_adr, &ui8DataBuffer[0] ,2); I2C_Read(SwipeInitDistance_adr, &ui8DataBuffer[0] ,2); printf("Swp init dist. : %d\n", (ui8DataBuffer[0]<<8) + ui8DataBuffer[1]); + // X resolution + ui8DataBuffer[1] = 0; ui8DataBuffer[0] = 8; + I2C_Write(XResolution_adr, &ui8DataBuffer[0] ,2); + I2C_Read(XResolution_adr, &ui8DataBuffer[0] ,2); + printf("X resolution : %d\n", (ui8DataBuffer[0]<<8) + ui8DataBuffer[1]); + + // Yresolution + ui8DataBuffer[1] = 0; ui8DataBuffer[0] = 8; + I2C_Write(YResolution_adr, &ui8DataBuffer[0] ,2); + I2C_Read(YResolution_adr, &ui8DataBuffer[0] ,2); + printf("Y resolution : %d\n", (ui8DataBuffer[0]<<8) + ui8DataBuffer[1]); + // Rx mapping I2C_Read(RxMapping_adr, &ui8DataBuffer[0] ,10); printf("mapping Rx :"); @@ -88,10 +106,14 @@ printf(" %d\n", ui8DataBuffer[7]); // total chanel Rx + ui8DataBuffer[0] = 3; + I2C_Write(TotalRx_adr, &ui8DataBuffer[0] ,1); I2C_Read(TotalRx_adr, &ui8DataBuffer[0] ,1); printf("nombre cannaux Rx : %d\n", ui8DataBuffer[0]); // total chanel Tx + ui8DataBuffer[0] = 4; + I2C_Write(TotalTx_adr, &ui8DataBuffer[0] ,1); I2C_Read(TotalTx_adr, &ui8DataBuffer[0] ,1); printf("nombre cannaux Tx : %d\n", ui8DataBuffer[0]); } @@ -176,7 +198,7 @@ // if((ui8SystemFlags[0] & SHOW_RESET) != 0) { - printf("RESET DETECTED"); + printf("RESET DETECTED\n"); AcknowledgeReset(); return; }
--- a/main.cpp Wed Jan 01 12:58:46 2020 +0000 +++ b/main.cpp Wed Jan 01 16:39:19 2020 +0000 @@ -5,36 +5,13 @@ IQS5xx trackPad(p28, p27, p17); DigitalOut led1(LED1); -DigitalOut led3(LED3); -DigitalOut led4(LED4); -DigitalIn rdy(p17); -//InterruptIn rdyInter(p17); +//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); - } + uint8_t ui8TempData[30], i; trackPad.I2C_Read(GestureEvents0_adr, &trackPad.Data_Buff[0], 44); @@ -59,11 +36,26 @@ // Process received data // trackPad.Process_XY(); +} + +int main() { + + //rdy.mode(PullUp); + + rdyInter.rise(&ISR1); + + trackPad.AcknowledgeReset(); + + trackPad.checkVersion(); + + while(1) { + + led1 = 1; - wait(0.01); + wait(0.5); led1 = 0; - wait(0.01); + wait(0.5); } }