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
Revision 10:8fdac52881aa, committed 2017-05-12
- Comitter:
- AzqDev
- Date:
- Fri May 12 14:44:54 2017 +0000
- Parent:
- 9:7c2666dfbc9a
- Child:
- 11:4d6d1da5bd31
- Commit message:
- Changed readAll() to readIqs()
Changed in this revision
| IQS62x.cpp | Show annotated file Show diff for this revision Revisions of this file |
| IQS62x.h | Show annotated file Show diff for this revision Revisions of this file |
--- 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++;
--- a/IQS62x.h Fri May 12 05:01:18 2017 +0000
+++ b/IQS62x.h Fri May 12 14:44:54 2017 +0000
@@ -38,5 +38,6 @@
void writeRegister(int address, int data); // write a byte to a register
void configure(); // write configuration registers of the IQS62x
void readAll(); // read all registers from the IQS62x
+ void readIqs(int start, int count); // starting at "start" read count registers
void waitForReady(); // wait for IQS62x ready signal
};
\ No newline at end of file
IQS624
IQS620A
IQS620A-EVAL-1
IQS621
IQS621-EVAL-1
IQS622
IQS622-EVAL-1
IQS624-EVAL-1