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

Committer:
AzqDev
Date:
Sat May 13 09:31:10 2017 +0000
Revision:
8:57dbc9c20428
Parent:
7:926e53f6ac94
Child:
9:81b52cfc7814
Highlight tables

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AzqDev 0:91dc088313ac 1 // IQS622-HelloWorld.cpp
AzqDev 0:91dc088313ac 2
AzqDev 0:91dc088313ac 3 // Hello World program for Azoteq IQS622 ultra low power sensor for ambient light, magnetic field, capacitive touch and inductive proximity.
AzqDev 0:91dc088313ac 4
AzqDev 0:91dc088313ac 5 // More info on IQS622 sensor IC: http://bit.ly/IQS622-Info
AzqDev 0:91dc088313ac 6
AzqDev 0:91dc088313ac 7 // Proxsense Video: http://bit.ly/IQS621-Youtube-Video
AzqDev 0:91dc088313ac 8
AzqDev 0:91dc088313ac 9 // Copyright 2017 Azoteq. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
AzqDev 0:91dc088313ac 10
AzqDev 0:91dc088313ac 11 // Output is via the USB debug serial port to a terminal program
AzqDev 0:91dc088313ac 12
AzqDev 0:91dc088313ac 13 // Tested on the following MBED hardware - mostly using Azoteq-to-Arduino Adapter Boards
AzqDev 0:91dc088313ac 14 // Note: When compiling for new hardware, use "Compile All" to rebuild everything
AzqDev 0:91dc088313ac 15
AzqDev 0:91dc088313ac 16 // 1. ST Micro Nucleo-L152RE Azoteq Adapter Boards: AZP694A02, AZP690B02
AzqDev 0:91dc088313ac 17 // 2. ST Micro Nucleo-F401RE Azoteq Adapter Boards: AZP694A02, AZP690B02
AzqDev 0:91dc088313ac 18 // 3. ST Micro Nucleo-L476RG Azoteq Adapter Boards: AZP694A02, AZP690B02
AzqDev 0:91dc088313ac 19 // 4. ST Micro Nucleo-L053R8 Azoteq Adapter Boards: AZP694A02, AZP690B02
AzqDev 0:91dc088313ac 20 // 5. ST Micro Nucleo-F446RE Azoteq Adapter Boards: AZP694A02, AZP690B02
AzqDev 0:91dc088313ac 21 // 6. ST Micro Disco-F746NG Azoteq Adapter Boards: AZP694A02, AZP690B02
AzqDev 0:91dc088313ac 22 // 7. Freescale FRDM-KL46Z Azoteq Adapter Boards: AZP694A02, AZP690B02
AzqDev 0:91dc088313ac 23 // 8. Freescale FRDM-KL25Z Azoteq Adapter Boards: AZP694A02, AZP690B02
AzqDev 0:91dc088313ac 24 // 9. mbed LPC1768 Azoteq adapter AZP690B02 [SDA,SCL,RDY] wired to LPC1768 [p28,p27,p26]
AzqDev 0:91dc088313ac 25 // 10. mbed LPC11U24 Azoteq adapter AZP690B02 [SDA,SCL,RDY] wired to LPC11U24 [p28,p27,p26]
AzqDev 0:91dc088313ac 26
AzqDev 0:91dc088313ac 27 // These two boards additionally require the USBDevice library: https://developer.mbed.org/users/mbed_official/code/USBDevice/
AzqDev 0:91dc088313ac 28 // 11. Teensy 3.1 Azoteq adapter AZP690B02 [SDA,SCL,RDY] wired to Teensy 3.1 [p18,p19,p2]
AzqDev 0:91dc088313ac 29 // 12. Teensy 3.2 Azoteq adapter AZP690B02 [SDA,SCL,RDY] wired to Teensy 3.2 [p18,p19,p2]
AzqDev 0:91dc088313ac 30
AzqDev 0:91dc088313ac 31 // Direct wiring of ST Micro Nucleo boards to AZP690B02 (IQS622-EVAL-1 board)
AzqDev 0:91dc088313ac 32 // CN10-3 = SCL, CN10-5 = SDA, CN10-33 = RDY, CN11 = GND, CN7-16 = 3.3V
AzqDev 0:91dc088313ac 33
AzqDev 0:91dc088313ac 34 #include "mbed.h"
AzqDev 0:91dc088313ac 35 #include "IQS62x.h"
AzqDev 0:91dc088313ac 36 #include "IQS622DisplayTerminal.h"
AzqDev 0:91dc088313ac 37
AzqDev 0:91dc088313ac 38 IQS622Display terminal; // class to display IQS62x registers on a terminal
AzqDev 0:91dc088313ac 39 IQS62xIO iqs62x; // class for basic IQS62x block read and write
AzqDev 0:91dc088313ac 40
AzqDev 0:91dc088313ac 41 int main() {
AzqDev 0:91dc088313ac 42 terminal.helloMessage(false); // say hello but don't wait for a keypress
AzqDev 0:91dc088313ac 43 wait(3);
AzqDev 0:91dc088313ac 44 iqs62x.configure(); // configure the IC
AzqDev 8:57dbc9c20428 45 while(1) { // main loop to continuously dump all registers
AzqDev 3:9592cb4b5ba0 46 iqs62x.readIqsRegisters(0,NUMBER_OF_REGISTERS); // read all the registers
AzqDev 8:57dbc9c20428 47
AzqDev 0:91dc088313ac 48 terminal.showStatus(iqs62x.I2Cspeed,iqs62x.I2CErrorCount); // show heading and number of I2C errors
AzqDev 5:c88aa2de6f61 49
AzqDev 7:926e53f6ac94 50 char * highlightTable; // a highlight table contains 1 byte for every register
AzqDev 8:57dbc9c20428 51 // if a byte in a highlight table is nonzero, the corresponding register value will be highlighted during display
AzqDev 7:926e53f6ac94 52 highlightTable = 0; // use a NULL table to make all registers print plain with no highlighting
AzqDev 7:926e53f6ac94 53 highlightTable = iqs62x.readChanges; // special table to highlight all registers that changed since the previous read
AzqDev 8:57dbc9c20428 54 highlightTable = iqs62x.writeChanges; // special table to highlight all registers that were written/configured but now contain a different value
AzqDev 8:57dbc9c20428 55 highlightTable = iqs62x.writeFlag; // special table to highlight all registers that were initialized - can be used to verify configure()
AzqDev 5:c88aa2de6f61 56
AzqDev 7:926e53f6ac94 57 terminal.showRegisters(iqs62x.registers, highlightTable); // display the registers and highlight the ones marked in the table
AzqDev 8:57dbc9c20428 58
AzqDev 0:91dc088313ac 59 }
AzqDev 0:91dc088313ac 60 }
AzqDev 8:57dbc9c20428 61 // end of IQS622_HelloWorld.cpp
AzqDev 0:91dc088313ac 62
AzqDev 0:91dc088313ac 63 // end of IQS622_HelloWorld.cpp