Library to read and write Azoteq IQS6xx device registers via I2C.
Dependents: IQS620_HelloWorld IQS622_HelloWorld IQS624_HelloWorld IQS621_HelloWorld ... more
Library: IQS62x
Library to read and write Azoteq IQS6xx device registers via I2C.
Supported Devices
Handy Table of ProxFusion Device Features
ALS = Ambient Light Sensor PIR = Passive Infrared
Diff: IQS62x.cpp
- Revision:
- 10:8fdac52881aa
- Parent:
- 9:7c2666dfbc9a
- Child:
- 11:4d6d1da5bd31
diff -r 7c2666dfbc9a -r 8fdac52881aa IQS62x.cpp
--- a/IQS62x.cpp Fri May 12 05:01:18 2017 +0000
+++ b/IQS62x.cpp Fri May 12 14:44:54 2017 +0000
@@ -38,17 +38,18 @@
}
#endif
-// read all registers from the IQS62x
-void IQS62xIO::readAll() {
+// read N registers, starting at provided offset
+void IQS62xIO::readIqs(int start, int count){
+ memset(I2CBuffer,0x55,I2CBufferSize); // "clear" i2c receive buffer
waitForReady();
- const static char i2c_start_address [] = { 0x0 };
- int numberOfBytes = sizeof( i2c_start_address );
- // write 0 to the IQS62x address register
+ char i2c_start_address [1];
+ i2c_start_address[0] = start & 0xff;
+ int numberOfBytes = 1;
+ // write start address to the IQS62x address register
if(0!=i2c.write(I2C_ADR,i2c_start_address,numberOfBytes,false))
I2CErrorCount++;
waitForReady();
- memset(I2CBuffer,0x55,I2CBufferSize); // "clear" i2c receive buffer
- numberOfBytes = NUMBER_OF_REGISTERS;
+ numberOfBytes = count % I2CBufferSize;
// read register values into a buffer
if(0!=i2c.read(I2C_ADR,I2CBuffer,numberOfBytes,false))
I2CErrorCount++;
IQS624
IQS620A
IQS620A-EVAL-1
IQS621
IQS621-EVAL-1
IQS622
IQS622-EVAL-1
IQS624-EVAL-1