![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
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.
IQS5xx/IQS5xx.h@2:bd4b620316aa, 2020-01-01 (annotated)
- Committer:
- skydarc
- Date:
- Wed Jan 01 16:39:19 2020 +0000
- Revision:
- 2:bd4b620316aa
- Parent:
- 0:4907da2299a4
done ! the rdy pin is functionnal. the "system config 1" register need to be properly configured.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
skydarc | 0:4907da2299a4 | 1 | /* IQS5xx.h |
skydarc | 0:4907da2299a4 | 2 | * Tested with mbed board: LPC1768 |
skydarc | 0:4907da2299a4 | 3 | * Author: Kevin Sac |
skydarc | 0:4907da2299a4 | 4 | * skydarc@gmail.com |
skydarc | 0:4907da2299a4 | 5 | */ |
skydarc | 0:4907da2299a4 | 6 | |
skydarc | 0:4907da2299a4 | 7 | #include "mbed.h" |
skydarc | 0:4907da2299a4 | 8 | |
skydarc | 0:4907da2299a4 | 9 | #include "IQS5xx_addresses.h" |
skydarc | 0:4907da2299a4 | 10 | |
skydarc | 0:4907da2299a4 | 11 | |
skydarc | 0:4907da2299a4 | 12 | |
skydarc | 0:4907da2299a4 | 13 | |
skydarc | 0:4907da2299a4 | 14 | /** |
skydarc | 0:4907da2299a4 | 15 | * This class allows for easy control over a IQS5xx IC. |
skydarc | 0:4907da2299a4 | 16 | */ |
skydarc | 0:4907da2299a4 | 17 | class IQS5xx { |
skydarc | 0:4907da2299a4 | 18 | public: |
skydarc | 0:4907da2299a4 | 19 | |
skydarc | 0:4907da2299a4 | 20 | uint8_t Data_Buff[44]; |
skydarc | 0:4907da2299a4 | 21 | uint16_t ui16SnapStatus[15], ui16PrevSnap[15]; |
skydarc | 0:4907da2299a4 | 22 | |
skydarc | 0:4907da2299a4 | 23 | /** |
skydarc | 0:4907da2299a4 | 24 | * @param sda the pin identifier for SDA I2C signal |
skydarc | 0:4907da2299a4 | 25 | * @param scl the pin identifier for SCL I2C signal |
skydarc | 0:4907da2299a4 | 26 | * @param i2c_addr the 8-bit I2C address for this device. Note that LSB is a don't care. |
skydarc | 0:4907da2299a4 | 27 | */ |
skydarc | 0:4907da2299a4 | 28 | IQS5xx(PinName sda, PinName scl, PinName rdy); |
skydarc | 0:4907da2299a4 | 29 | |
skydarc | 0:4907da2299a4 | 30 | uint8_t I2C_Write(uint16_t ui16RegisterAddress, uint8_t *pData, uint8_t ui8NoOfBytes); |
skydarc | 0:4907da2299a4 | 31 | uint8_t I2C_Read(uint16_t ui16RegisterAddress, uint8_t *pData, uint8_t ui8NoOfBytes); |
skydarc | 0:4907da2299a4 | 32 | |
skydarc | 0:4907da2299a4 | 33 | // Public Methods |
skydarc | 0:4907da2299a4 | 34 | void AcknowledgeReset(void); |
skydarc | 0:4907da2299a4 | 35 | void checkVersion(void); |
skydarc | 0:4907da2299a4 | 36 | void DisplaySnap(void); |
skydarc | 0:4907da2299a4 | 37 | void Process_XY(void); |
skydarc | 0:4907da2299a4 | 38 | void Close_Comms(); |
skydarc | 0:4907da2299a4 | 39 | |
skydarc | 0:4907da2299a4 | 40 | private: |
skydarc | 0:4907da2299a4 | 41 | // Private Variables |
skydarc | 0:4907da2299a4 | 42 | I2C &i2c_; |
skydarc | 0:4907da2299a4 | 43 | char i2cRaw[sizeof(I2C)]; |
skydarc | 0:4907da2299a4 | 44 | DigitalIn _readyPin; |
skydarc | 0:4907da2299a4 | 45 | uint8_t ui8Success; |
skydarc | 0:4907da2299a4 | 46 | |
skydarc | 0:4907da2299a4 | 47 | |
skydarc | 0:4907da2299a4 | 48 | // Private Methods |
skydarc | 0:4907da2299a4 | 49 | |
skydarc | 0:4907da2299a4 | 50 | |
skydarc | 0:4907da2299a4 | 51 | uint8_t I2C_Write2(uint16_t ui16RegisterAddress, uint8_t *pData, uint8_t ui8NoOfBytes); |
skydarc | 0:4907da2299a4 | 52 | uint8_t I2C_Read2(uint16_t ui16RegisterAddress, uint8_t *pData, uint8_t ui8NoOfBytes); |
skydarc | 0:4907da2299a4 | 53 | |
skydarc | 0:4907da2299a4 | 54 | void Print_signed(int16_t i16Num); |
skydarc | 0:4907da2299a4 | 55 | void Print_unsigned(uint16_t ui16Num); |
skydarc | 0:4907da2299a4 | 56 | |
skydarc | 0:4907da2299a4 | 57 | }; |
skydarc | 0:4907da2299a4 | 58 | |
skydarc | 0:4907da2299a4 | 59 |