Ultra Low Power (5uA) I2C Multi-Function Sensor with Light Sensor + Active (Reflective) IR + Touch + Hall Effect Sensor

Dependencies:   IQS622DisplayTerminal IQS62x mbed

Hello World! From Azoteq's IQS622 Ultra Low Power Multi-Sensor


This is a demo program for the Azoteq IQS622 ultra low power multi function sensor.

More details on the IQS622 component pages here:

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.


Low Cost Evaluation Board for Azoteq IQS622 Ultra Low Power (5uA) I2C Multi-Function Sensor with Light Sensor, Active (Reflective) IR, Touch and Hall Effect Sensor

Files at this revision

API Documentation at this revision

Comitter:
AzqDev
Date:
Sat May 13 02:49:40 2017 +0000
Parent:
4:2c5ea9dc0662
Child:
6:af5c5cf511a9
Commit message:
Added colorTable variable

Changed in this revision

IQS622DisplayTerminal.lib Show annotated file Show diff for this revision Revisions of this file
IQS622_Init/IQS622_Init.cpp Show annotated file Show diff for this revision Revisions of this file
IQS622_Init/IQS622_Init.h 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/IQS622DisplayTerminal.lib	Sat May 13 01:25:40 2017 +0000
+++ b/IQS622DisplayTerminal.lib	Sat May 13 02:49:40 2017 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/Azoteq/code/IQS622DisplayTerminal/#20266bfaa709
+https://developer.mbed.org/teams/Azoteq/code/IQS622DisplayTerminal/#fc73ce1a283a
--- a/IQS622_Init/IQS622_Init.cpp	Sat May 13 01:25:40 2017 +0000
+++ b/IQS622_Init/IQS622_Init.cpp	Sat May 13 02:49:40 2017 +0000
@@ -11,7 +11,7 @@
 void IQS62xIO::configure() {
 
 /* Change the Prox Sensor Settings */
-/* Memory Map Position 0x40 - 0x49 */
+/* Memory Map Position 0x40 - 0x4D */
   writeRegister( 0x40,  PXS_SETTINGS_0     );
   writeRegister( 0x41,  PXS_SETTINGS_1     );
   writeRegister( 0x42,  PXS_SETTINGS_2     );      
@@ -21,7 +21,11 @@
   writeRegister( 0x46,  PXS_SETTINGS_6     );     
   writeRegister( 0x47,  PXS_SETTINGS_7     );
   writeRegister( 0x48,  PXS_SETTINGS_8     );
-  writeRegister( 0x49,  PXS_SETTINGS_9     );     
+  writeRegister( 0x49,  PXS_SETTINGS_9     );
+  writeRegister( 0x4a,  PXS_SETTINGS_10    );
+  writeRegister( 0x4b,  PXS_SETTINGS_11    );
+  writeRegister( 0x4c,  PXS_SETTINGS_12    );
+  writeRegister( 0x4d,  PXS_SETTINGS_13    );
 
 /* Change the Prox UI Settings */
 /* Memory Map Position 0x50 - 0x54 */
@@ -31,20 +35,44 @@
   writeRegister( 0x53,  PXS_UI_SETTINGS_3  );
   writeRegister( 0x54,  PXS_UI_SETTINGS_4  );
 
+/* Change the Prox UI Settings */
+/* Memory Map Position 0x60 - 0x65 */
+  writeRegister( 0x60,  SAR_UI_SETTINGS_0  );
+  writeRegister( 0x61,  SAR_UI_SETTINGS_1  );
+  writeRegister( 0x62,  SAR_UI_SETTINGS_2  );
+  writeRegister( 0x63,  SAR_UI_SETTINGS_3  );
+  writeRegister( 0x64,  SAR_UI_SETTINGS_4  );
+  writeRegister( 0x65,  SAR_UI_SETTINGS_5  );
+
+/* Change the Light Sensor Settings */
+/* Memory Map Position 0x70 - 0x75 */
+  writeRegister( 0x70,  LIGHT_SENSOR_SETTINGS_0  );
+  writeRegister( 0x71,  LIGHT_SENSOR_SETTINGS_1  );
+  writeRegister( 0x72,  LIGHT_SENSOR_SETTINGS_2  );
+  writeRegister( 0x73,  LIGHT_SENSOR_SETTINGS_3  );
+  writeRegister( 0x74,  LIGHT_SENSOR_SETTINGS_4  );
+  writeRegister( 0x75,  LIGHT_SENSOR_SETTINGS_5  );
+
+/* Change the Active IR UI Settings */
+/* Memory Map Position 0x90 - 0x93 */
+  writeRegister( 0x90,  IR_UI_SETTINGS_0  );
+  writeRegister( 0x91,  IR_UI_SETTINGS_1  );
+  writeRegister( 0x92,  IR_UI_SETTINGS_2  );
+  writeRegister( 0x93,  IR_UI_SETTINGS_3  );
+
 /* Change the HALL Sensor Settings */
-/* Memory Map Position 0x70 - 0x7A */
-  writeRegister( 0x70,  HALL_SETTINGS_0    );
-  writeRegister( 0x71,  HALL_SETTINGS_1    );
-  writeRegister( 0x72,  HALL_SETTINGS_2    );
-  writeRegister( 0x73,  HALL_SETTINGS_3    );
-  writeRegister( 0x74,  HALL_SETTINGS_4    );
-  writeRegister( 0x75,  HALL_SETTINGS_5    );
-  writeRegister( 0x76,  HALL_SETTINGS_6    );
-  writeRegister( 0x77,  HALL_SETTINGS_7    );
-  writeRegister( 0x78,  HALL_SETTINGS_8    );
-  writeRegister( 0x79,  HALL_SETTINGS_9    );
-  writeRegister( 0x7a,  HALL_SETTINGS_10   );           
-
+/* Memory Map Position 0xA0 - 0xA3 */
+  writeRegister( 0xa0,  HALL_SENSOR_SETTINGS_0    );
+  writeRegister( 0xa1,  HALL_SENSOR_SETTINGS_1    );
+  writeRegister( 0xa2,  HALL_SENSOR_SETTINGS_2    );
+  writeRegister( 0xa3,  HALL_SENSOR_SETTINGS_3    );
+  
+/* Change the HALL Switch UI Settings */
+/* Memory Map Position 0xB0 - 0xB2 */
+  writeRegister( 0xb0,  HALL_UI_SETTINGS_0    );
+  writeRegister( 0xb1,  HALL_UI_SETTINGS_1    );
+  writeRegister( 0xb2,  HALL_UI_SETTINGS_2    );
+    
 /* Change the Device & PMU Settings */
 /* Memory Map Position 0xD0 - 0xD7 */
   writeRegister( 0xd0,  SYSTEM_SETTINGS        );
@@ -54,7 +82,7 @@
   writeRegister( 0xd4,  REPORT_RATES_TIMINGS_1 );
   writeRegister( 0xd5,  REPORT_RATES_TIMINGS_2 );
   writeRegister( 0xd6,  REPORT_RATES_TIMINGS_3 );
-  writeRegister( 0xd7,  REPORT_RATES_TIMINGS_4 );
+  writeRegister( 0xd7,  GLOBAL_EVENT_MASK      );
 
 }
 // end of IQS624_Init.cpp
\ No newline at end of file
--- a/IQS622_Init/IQS622_Init.h	Sat May 13 01:25:40 2017 +0000
+++ b/IQS622_Init/IQS622_Init.h	Sat May 13 02:49:40 2017 +0000
@@ -1,57 +1,85 @@
 /*
-* This file contains all the necessary settings for the IQS624 and this file can
+* This file contains all the necessary settings for the IQS622 and this file can
 * be changed from the GUI or edited here
-* File:   IQS624_init.h
+* File:   IQS621_init.h
 * Author: Azoteq
 */
 
-#ifndef IQS624_INIT_H
-#define IQS624_INIT_H
+#ifndef IQS622_INIT_H
+#define IQS622_INIT_H
 
 /* Change the Prox Sensor Settings */
-/* Memory Map Position 0x40 - 0x49 */
+/* Memory Map Position 0x40 - 0x4D */
 #define PXS_SETTINGS_0                      0x01
 #define PXS_SETTINGS_1                      0x02
-#define PXS_SETTINGS_2                      0x5A
-#define PXS_SETTINGS_3                      0x18
-#define PXS_SETTINGS_4                      0xD0
-#define PXS_SETTINGS_5                      0x00
-#define PXS_SETTINGS_6                      0xE6
-#define PXS_SETTINGS_7                      0x9A
-#define PXS_SETTINGS_8                      0x81
-#define PXS_SETTINGS_9                      0x05
+#define PXS_SETTINGS_2                      0x57
+#define PXS_SETTINGS_3                      0x57
+#define PXS_SETTINGS_4                      0x18
+#define PXS_SETTINGS_5                      0xD0
+#define PXS_SETTINGS_6                      0x06
+#define PXS_SETTINGS_7                      0x06
+#define PXS_SETTINGS_8                      0x00
+#define PXS_SETTINGS_9                      0x01
+#define PXS_SETTINGS_10                     0x22
+#define PXS_SETTINGS_11                     0xB1
+#define PXS_SETTINGS_12                     0x81
+#define PXS_SETTINGS_13                     0x03
 
 /* Change the Prox UI Settings */
 /* Memory Map Position 0x50 - 0x54 */
 #define PXS_UI_SETTINGS_0                   0x14
 #define PXS_UI_SETTINGS_1                   0x20
 #define PXS_UI_SETTINGS_2                   0x14
-#define PXS_UI_SETTINGS_3                   0x20
+#define PXS_UI_SETTINGS_3                   0x25
 #define PXS_UI_SETTINGS_4                   0x28
 
+/* Change the SAR UI Settings */
+/* Memory Map Position 0x60 - 0x65 */
+#define SAR_UI_SETTINGS_0                   0x14
+#define SAR_UI_SETTINGS_1                   0x25
+#define SAR_UI_SETTINGS_2                   0x05
+#define SAR_UI_SETTINGS_3                   0x14
+#define SAR_UI_SETTINGS_4                   0x20
+#define SAR_UI_SETTINGS_5                   0x28
+
+/* Change the Light Sensor Settings */
+/* Memory Map Position 0x70 - 0x75 */
+#define LIGHT_SENSOR_SETTINGS_0             0x14
+#define LIGHT_SENSOR_SETTINGS_1             0x81
+#define LIGHT_SENSOR_SETTINGS_2             0x07
+#define LIGHT_SENSOR_SETTINGS_3             0x81
+#define LIGHT_SENSOR_SETTINGS_4             0x01
+#define LIGHT_SENSOR_SETTINGS_5             0x01
+
+/* Change the Active IR UI Settings */
+/* Memory Map Position 0x90 - 0x92 */
+#define IR_UI_SETTINGS_0                    0x11
+#define IR_UI_SETTINGS_1                    0x19
+#define IR_UI_SETTINGS_2                    0x19
+#define IR_UI_SETTINGS_3                    0x01
+
 /* Change the HALL Sensor Settings */
-/* Memory Map Position 0x70 - 0x7A */
-#define HALL_SETTINGS_0                     0x04
-#define HALL_SETTINGS_1                     0x03
-#define HALL_SETTINGS_2                     0x93
-#define HALL_SETTINGS_3                     0x93
-#define HALL_SETTINGS_4                     0xAC
-#define HALL_SETTINGS_5                     0xA1
-#define HALL_SETTINGS_6                     0x0A
-#define HALL_SETTINGS_7                     0x09
-#define HALL_SETTINGS_8                     0x46
-#define HALL_SETTINGS_9                     0x70
-#define HALL_SETTINGS_10                    0xE5
+/* Memory Map Position 0xA0 - 0xA3 */
+#define HALL_SENSOR_SETTINGS_0              0x03
+#define HALL_SENSOR_SETTINGS_1              0x50
+#define HALL_SENSOR_SETTINGS_2              0x20
+#define HALL_SENSOR_SETTINGS_3              0x4A
+
+/* Change the HALL Switch UI Settings */
+/* Memory Map Position 0xB0 - 0xB2 */
+#define HALL_UI_SETTINGS_0                  0x11
+#define HALL_UI_SETTINGS_1                  0x19
+#define HALL_UI_SETTINGS_2                  0x19
 
 /* Change the Device & PMU Settings */
 /* Memory Map Position 0xD0 - 0xD7 */
 #define SYSTEM_SETTINGS                     0x08
-#define ACTIVE_CHS                          0x3F
+#define ACTIVE_CHS                          0x7F
 #define PMU_SETTINGS                        0x03
 #define REPORT_RATES_TIMINGS_0              0x10
 #define REPORT_RATES_TIMINGS_1              0x64
 #define REPORT_RATES_TIMINGS_2              0x0A
 #define REPORT_RATES_TIMINGS_3              0x14
-#define REPORT_RATES_TIMINGS_4              0x07
+#define GLOBAL_EVENT_MASK                   0x00
 
-#endif  /* IQS624_INIT_H */
+#endif  /* IQS622_INIT_H */
--- a/main.cpp	Sat May 13 01:25:40 2017 +0000
+++ b/main.cpp	Sat May 13 02:49:40 2017 +0000
@@ -45,7 +45,13 @@
     while(1) {
         iqs62x.readIqsRegisters(0,NUMBER_OF_REGISTERS); // read all the registers
         terminal.showStatus(iqs62x.I2Cspeed,iqs62x.I2CErrorCount); // show heading and number of I2C errors
-        terminal.showRegisters(iqs62x.registers,iqs62x.writeChanges); // show IQS62x registers, color highlight of changes
+        
+        char * colorTable = iqs62x.writeFlag;        // table of all the registers that were written to (initialized)
+        // char * colorTable = iqs62x.readChanges;   // table of all the registers that changed since previous read
+        // char * colorTable = iqs62x.writeChanges;  // table of all the registers that changed since last write
+        // char * colorTable = 0;                    // no color highlighting
+        
+        terminal.showRegisters(iqs62x.registers,colorTable); // show IQS62x registers, color-highlight the registers flagged in colorTable
     }
 }