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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers IQS621_Init.cpp Source File

IQS621_Init.cpp

00001 #include "IQS62x.h"
00002 
00003 // Function to configure/initialize the IQS624
00004 // Uses the configuration data provided in "IQS624_Init.h"
00005 // The file "IQS624_Init.h" can be created/exported by the Azoteq software tools
00006 // The included version of "IQS624_Init.h" is a robust demo configuration
00007 // More info on IQS624: http://www.azoteq.com/products/proxfusion/iqs624?mbed
00008 
00009 #include "IQS621_Init.h"
00010 
00011 void IQS62xIO::configure() {
00012 
00013 /* Change the Prox Sensor Settings 0 */
00014 /* Memory Map Position 0x40 - 0x4D */
00015   writeRegister( 0x40,  PXS_SETTINGS_0     );
00016   writeRegister( 0x41,  PXS_SETTINGS_1     );
00017   writeRegister( 0x42,  PXS_SETTINGS_2     );      
00018   writeRegister( 0x43,  PXS_SETTINGS_3     );
00019   writeRegister( 0x44,  PXS_SETTINGS_4     );
00020   writeRegister( 0x45,  PXS_SETTINGS_5     );
00021   writeRegister( 0x46,  PXS_SETTINGS_6     );     
00022   writeRegister( 0x47,  PXS_SETTINGS_7     );
00023   writeRegister( 0x48,  PXS_SETTINGS_8     );
00024   writeRegister( 0x49,  PXS_SETTINGS_9     );     
00025   writeRegister( 0x4a,  PXS_SETTINGS_10    );     
00026   writeRegister( 0x4b,  PXS_SETTINGS_11    );     
00027   writeRegister( 0x4c,  PXS_SETTINGS_12    );     
00028   writeRegister( 0x4d,  PXS_SETTINGS_13    );     
00029 
00030 /* Change the Prox UI Settings */
00031 /* Memory Map Position 0x50 - 0x54 */
00032   writeRegister( 0x50,  PXS_UI_SETTINGS_0    );
00033   writeRegister( 0x51,  PXS_UI_SETTINGS_1    );
00034   writeRegister( 0x52,  PXS_UI_SETTINGS_2    );
00035   writeRegister( 0x53,  PXS_UI_SETTINGS_3    );
00036   writeRegister( 0x54,  PXS_UI_SETTINGS_4    );
00037 
00038 
00039 /* Change the Metal Detect UI Settings */
00040 /* Memory Map Position 0x60 - 0x63 */
00041   writeRegister( 0x60,  METAL_UI_SETTINGS_0  );
00042   writeRegister( 0x61,  METAL_UI_SETTINGS_1  );
00043   writeRegister( 0x62,  METAL_UI_SETTINGS_2  );
00044   writeRegister( 0x63,  METAL_UI_SETTINGS_3  );
00045   
00046 /* Change the Light Sensor Settings */
00047 /* Memory Map Position 0x70 - 0x73 */
00048   writeRegister( 0x70,  LIGHT_SENSOR_SETTINGS_0    );
00049   writeRegister( 0x71,  LIGHT_SENSOR_SETTINGS_1    );
00050   writeRegister( 0x72,  LIGHT_SENSOR_SETTINGS_2    );
00051   writeRegister( 0x73,  LIGHT_SENSOR_SETTINGS_3    );
00052   
00053 /* Change the ALS UI Settings */
00054 /* Memory Map Position 0x80 - 0x83 */
00055   writeRegister( 0x80,  ALS_UI_SETTINGS_0    );
00056   writeRegister( 0x81,  ALS_UI_SETTINGS_1    );
00057   writeRegister( 0x82,  ALS_UI_SETTINGS_2    );
00058   writeRegister( 0x83,  ALS_UI_SETTINGS_3    );
00059 
00060 /* Change the HALL Sensor Settings */
00061 /* Memory Map Position 0x90 - 0x93 */
00062   writeRegister( 0x90,  HALL_SENSOR_SETTINGS_0    );
00063   writeRegister( 0x91,  HALL_SENSOR_SETTINGS_1    );
00064   writeRegister( 0x92,  HALL_SENSOR_SETTINGS_2    );
00065   writeRegister( 0x93,  HALL_SENSOR_SETTINGS_3    );
00066 
00067 /* Change the HALL Switch UI Settings */
00068 /* Memory Map Position 0xA0 - 0xA2 */
00069   writeRegister( 0xa0,  HALL_UI_SETTINGS_0    );
00070   writeRegister( 0xa1,  HALL_UI_SETTINGS_1    );
00071   writeRegister( 0xa2,  HALL_UI_SETTINGS_2    );
00072 
00073 /* Change the Temperature UI Settings */
00074 /* Memory Map Position 0xC0 - 0xC3 */
00075   writeRegister( 0xc0,  TEMP_UI_SETTINGS_0    );
00076   writeRegister( 0xc1,  TEMP_UI_SETTINGS_1    );
00077   writeRegister( 0xc2,  TEMP_UI_SETTINGS_2    );
00078   writeRegister( 0xc3,  TEMP_UI_SETTINGS_3    );
00079 
00080 /* Change the Device & PMU Settings */
00081 /* Memory Map Position 0xD0 - 0xD7 */
00082   writeRegister( 0xd0,  SYSTEM_SETTINGS        );
00083   writeRegister( 0xd1,  ACTIVE_CHS             );            
00084   writeRegister( 0xd2,  PMU_SETTINGS           );
00085   writeRegister( 0xd3,  REPORT_RATES_TIMINGS_0 );    
00086   writeRegister( 0xd4,  REPORT_RATES_TIMINGS_1 );
00087   writeRegister( 0xd5,  REPORT_RATES_TIMINGS_2 );
00088   writeRegister( 0xd6,  REPORT_RATES_TIMINGS_3 );
00089   writeRegister( 0xd7,  GLOBAL_EVENT_MASK      );
00090 
00091 }
00092 // end of IQS624_Init.cpp