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

Components / IQS620A
Ultra low power sensor for magnetic field, capacitive touch and inductive proximity. Empowers next-generation user interfaces.

Components / IQS621
Azoteq IQS621 ultra low power sensor for ambient light, magnetic field, capacitance and inductive proximity. Empowers next-generation user interfaces.

Components / IQS622
Azoteq IQS622 ultra low power sensor for ambient light, active (reflective) IR, magnetic field, capacitance and inductive proximity. Empowers next-generation user interfaces.

Components / IQS624
Ultra low power sensor for rotating magnetic field, capacitive touch, and inductive proximity. Empowers next-generation user interfaces.

Handy Table of ProxFusion Device Features


ALS = Ambient Light Sensor PIR = Passive Infrared

/media/uploads/AzqDev/mbed-azoteq-proxfusion-handy-table-of-product-features.jpg

Files at this revision

API Documentation at this revision

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