Ultra Low Power (5uA) I2C Sensor With Ambient Light Sensing (ALS) + Capacitive Proximity/Touch + Hall Effect Sensor + Inductive Proximity (Metal Detect)

Dependencies:   IQS621DisplayTerminal IQS62x mbed

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

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

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


Low Cost Evaluation Board For Azoteq IQS621ultra low power I2C sensor for ambient light, magnetic field, capacitance, inductive proximity and temperature.

Files at this revision

API Documentation at this revision

Comitter:
AzqDev
Date:
Fri May 12 17:26:45 2017 +0000
Parent:
5:275f494cbbe8
Child:
7:5161c542cdda
Commit message:
IQS621_Init.h processing

Changed in this revision

IQS621_Init/IQS621_Init.cpp Show annotated file Show diff for this revision Revisions of this file
IQS621_Init/IQS621_Init.h Show annotated file Show diff for this revision Revisions of this file
IQS62x.lib Show annotated file Show diff for this revision Revisions of this file
deviceType.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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/IQS621_Init/IQS621_Init.cpp	Fri May 12 17:26:45 2017 +0000
@@ -0,0 +1,91 @@
+#include "IQS62x.h"
+
+// Function to configure/initialize the IQS624
+// Uses the configuration data provided in "IQS624_Init.h"
+// The file "IQS624_Init.h" can be created/exported by the Azoteq software tools
+// The included version of "IQS624_Init.h" is a robust demo configuration
+// More info on IQS624: http://www.azoteq.com/products/proxfusion/iqs624?mbed
+
+#include "IQS621_Init.h"
+
+void IQS62xIO::configure() {
+
+/* Change the Prox Sensor Settings 0 */
+/* Memory Map Position 0x40 - 0x4D */
+  writeRegister( 0x40,  PXS_SETTINGS_0     );
+  writeRegister( 0x41,  PXS_SETTINGS_1     );
+  writeRegister( 0x42,  PXS_SETTINGS_2     );      
+  writeRegister( 0x43,  PXS_SETTINGS_3     );
+  writeRegister( 0x44,  PXS_SETTINGS_4     );
+  writeRegister( 0x45,  PXS_SETTINGS_5     );
+  writeRegister( 0x46,  PXS_SETTINGS_6     );     
+  writeRegister( 0x47,  PXS_SETTINGS_7     );
+  writeRegister( 0x48,  PXS_SETTINGS_8     );
+  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 */
+  writeRegister( 0x50,  PXS_UI_SETTINGS_0    );
+  writeRegister( 0x51,  PXS_UI_SETTINGS_1    );
+  writeRegister( 0x52,  PXS_UI_SETTINGS_2    );
+  writeRegister( 0x53,  PXS_UI_SETTINGS_3    );
+
+
+/* Change the Metal Detect UI Settings */
+/* Memory Map Position 0x60 - 0x63 */
+  writeRegister( 0x60,  METAL_UI_SETTINGS_0  );
+  writeRegister( 0x61,  METAL_UI_SETTINGS_1  );
+  writeRegister( 0x62,  METAL_UI_SETTINGS_2  );
+  writeRegister( 0x63,  METAL_UI_SETTINGS_3  );
+  
+/* Change the Light Sensor Settings */
+/* Memory Map Position 0x70 - 0x73 */
+  writeRegister( 0x70,  LIGHT_SENSOR_SETTINGS_0    );
+  writeRegister( 0x71,  LIGHT_SENSOR_SETTINGS_1    );
+  writeRegister( 0x72,  LIGHT_SENSOR_SETTINGS_2    );
+  writeRegister( 0x73,  LIGHT_SENSOR_SETTINGS_3    );
+  
+/* Change the ALS UI Settings */
+/* Memory Map Position 0x80 - 0x83 */
+  writeRegister( 0x80,  ALS_UI_SETTINGS_0    );
+  writeRegister( 0x81,  ALS_UI_SETTINGS_1    );
+  writeRegister( 0x82,  ALS_UI_SETTINGS_2    );
+  writeRegister( 0x83,  ALS_UI_SETTINGS_3    );
+
+/* Change the HALL Sensor Settings */
+/* Memory Map Position 0x90 - 0x93 */
+  writeRegister( 0x90,  HALL_SENSOR_SETTINGS_0    );
+  writeRegister( 0x91,  HALL_SENSOR_SETTINGS_1    );
+  writeRegister( 0x92,  HALL_SENSOR_SETTINGS_2    );
+  writeRegister( 0x93,  HALL_SENSOR_SETTINGS_3    );
+
+/* Change the HALL Switch UI Settings */
+/* Memory Map Position 0xA0 - 0xA2 */
+  writeRegister( 0xa0,  HALL_UI_SETTINGS_0    );
+  writeRegister( 0xa1,  HALL_UI_SETTINGS_1    );
+  writeRegister( 0xa2,  HALL_UI_SETTINGS_2    );
+
+/* Change the Temperature UI Settings */
+/* Memory Map Position 0xC0 - 0xC3 */
+  writeRegister( 0xc0,  TEMP_UI_SETTINGS_0    );
+  writeRegister( 0xc1,  TEMP_UI_SETTINGS_1    );
+  writeRegister( 0xc2,  TEMP_UI_SETTINGS_2    );
+  writeRegister( 0xc3,  TEMP_UI_SETTINGS_3    );
+
+/* Change the Device & PMU Settings */
+/* Memory Map Position 0xD0 - 0xD7 */
+  writeRegister( 0xd0,  SYSTEM_SETTINGS        );
+  writeRegister( 0xd1,  ACTIVE_CHS             );            
+  writeRegister( 0xd2,  PMU_SETTINGS           );
+  writeRegister( 0xd3,  REPORT_RATES_TIMINGS_0 );    
+  writeRegister( 0xd4,  REPORT_RATES_TIMINGS_1 );
+  writeRegister( 0xd5,  REPORT_RATES_TIMINGS_2 );
+  writeRegister( 0xd6,  REPORT_RATES_TIMINGS_3 );
+  writeRegister( 0xd7,  GLOBAL_EVENT_MASK      );
+
+}
+// end of IQS624_Init.cpp
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/IQS621_Init/IQS621_Init.h	Fri May 12 17:26:45 2017 +0000
@@ -0,0 +1,88 @@
+/*
+* This file contains all the necessary settings for the IQS621 and this file can
+* be changed from the GUI or edited here
+* File:   IQS621_init.h
+* Author: Azoteq
+*/
+
+#ifndef IQS621_INIT_H
+#define IQS621_INIT_H
+
+/* Change the Prox Sensor Settings */
+/* Memory Map Position 0x40 - 0x4D */
+#define PXS_SETTINGS_0                      0x01
+#define PXS_SETTINGS_1                      0x01
+#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                     0xA1
+#define PXS_SETTINGS_11                     0x65
+#define PXS_SETTINGS_12                     0x44
+#define PXS_SETTINGS_13                     0x0C
+
+/* 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_4                   0x28
+
+/* Change the Metal Detect UI Settings */
+/* Memory Map Position 0x60 - 0x63 */
+#define METAL_UI_SETTINGS_0                 0x00
+#define METAL_UI_SETTINGS_1                 0x01
+#define METAL_UI_SETTINGS_2                 0x14
+#define METAL_UI_SETTINGS_3                 0x20
+
+/* Change the Light Sensor Settings */
+/* Memory Map Position 0x70 - 0x73 */
+#define LIGHT_SENSOR_SETTINGS_0             0x14
+#define LIGHT_SENSOR_SETTINGS_1             0x80
+#define LIGHT_SENSOR_SETTINGS_2             0x07
+#define LIGHT_SENSOR_SETTINGS_3             0x00
+
+/* Change the ALS UI Settings */
+/* Memory Map Position 0x80 - 0x83 */
+#define ALS_UI_SETTINGS_0                   0x0A
+#define ALS_UI_SETTINGS_1                   0x0A
+#define ALS_UI_SETTINGS_2                   0x27
+#define ALS_UI_SETTINGS_3                   0x04
+
+/* Change the HALL Sensor Settings */
+/* Memory Map Position 0x90 - 0x93 */
+#define HALL_SENSOR_SETTINGS_0              0x03
+#define HALL_SENSOR_SETTINGS_1              0x50
+#define HALL_SENSOR_SETTINGS_2              0xB0
+#define HALL_SENSOR_SETTINGS_3              0x0A
+
+/* Change the HALL Switch UI Settings */
+/* Memory Map Position 0xA0 - 0xA2 */
+#define HALL_UI_SETTINGS_0                  0x11
+#define HALL_UI_SETTINGS_1                  0x19
+#define HALL_UI_SETTINGS_2                  0x19
+
+/* Change the Temperature UI Settings */
+/* Memory Map Position 0xC0 - 0xC3 */
+#define TEMP_UI_SETTINGS_0                  0x00
+#define TEMP_UI_SETTINGS_1                  0x08
+#define TEMP_UI_SETTINGS_2                  0x79
+#define TEMP_UI_SETTINGS_3                  0xFF
+
+/* Change the Device & PMU Settings */
+/* Memory Map Position 0xD0 - 0xD7 */
+#define SYSTEM_SETTINGS                     0x08
+#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 GLOBAL_EVENT_MASK                   0x00
+
+#endif  /* IQS621_INIT_H */
--- a/IQS62x.lib	Fri May 12 05:12:03 2017 +0000
+++ b/IQS62x.lib	Fri May 12 17:26:45 2017 +0000
@@ -1,1 +1,1 @@
-https://mbed.org/teams/Azoteq/code/IQS62x/#7c2666dfbc9a
+https://mbed.org/teams/Azoteq/code/IQS62x/#4d6d1da5bd31
--- a/deviceType.h	Fri May 12 05:12:03 2017 +0000
+++ b/deviceType.h	Fri May 12 17:26:45 2017 +0000
@@ -1,2 +1,5 @@
 // device type
-#define DEVICE_TYPE_IQS621 1
\ No newline at end of file
+#define DEVICE_TYPE_IQS621 1
+
+// used by IQS62x lib when we want to override the simple configure() function
+#define OVERRIDE_CONFIGURE 1
\ No newline at end of file
--- a/main.cpp	Fri May 12 05:12:03 2017 +0000
+++ b/main.cpp	Fri May 12 17:26:45 2017 +0000
@@ -43,7 +43,7 @@
     wait(3);
     iqs62x.configure(); // configure the IC
     while(1) {
-        iqs62x.readAll(); // read all the registers
+        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); // show IQS62x registers
     }