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.

Committer:
AzqDev
Date:
Sun May 14 19:50:26 2017 +0000
Revision:
12:158b7c3dc8dc
Parent:
11:6258c43f559f
Child:
13:12c6c0af1536
Simplified main

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AzqDev 0:55d94d451e3c 1 // IQS621-HelloWorld.cpp
AzqDev 0:55d94d451e3c 2
AzqDev 0:55d94d451e3c 3 // Hello World program for Azoteq IQS621 ultra low power sensor for ambient light, magnetic field, capacitive touch and inductive proximity.
AzqDev 0:55d94d451e3c 4
AzqDev 0:55d94d451e3c 5 // More info on IQS621 sensor IC: http://bit.ly/IQS621-Info
AzqDev 0:55d94d451e3c 6
AzqDev 1:cc56f48afce2 7 // Video: http://bit.ly/IQS621-Youtube-Video
AzqDev 0:55d94d451e3c 8
AzqDev 0:55d94d451e3c 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:55d94d451e3c 10
AzqDev 0:55d94d451e3c 11 // Output is via the USB debug serial port to a terminal program
AzqDev 0:55d94d451e3c 12
AzqDev 0:55d94d451e3c 13 // Tested on the following MBED hardware - mostly using Azoteq-to-Arduino Adapter Boards
AzqDev 0:55d94d451e3c 14 // Note: When compiling for new hardware, use "Compile All" to rebuild everything
AzqDev 1:cc56f48afce2 15
AzqDev 3:8cce0e52f708 16 // 1. ST Micro Nucleo-L152RE Azoteq Adapter Boards: AZP694A02, AZP690A02
AzqDev 3:8cce0e52f708 17 // 2. ST Micro Nucleo-F401RE Azoteq Adapter Boards: AZP694A02, AZP690A02
AzqDev 3:8cce0e52f708 18 // 3. ST Micro Nucleo-L476RG Azoteq Adapter Boards: AZP694A02, AZP690A02
AzqDev 3:8cce0e52f708 19 // 4. ST Micro Nucleo-L053R8 Azoteq Adapter Boards: AZP694A02, AZP690A02
AzqDev 3:8cce0e52f708 20 // 5. ST Micro Nucleo-F446RE Azoteq Adapter Boards: AZP694A02, AZP690A02
AzqDev 3:8cce0e52f708 21 // 6. ST Micro Disco-F746NG Azoteq Adapter Boards: AZP694A02, AZP690A02
AzqDev 3:8cce0e52f708 22 // 7. Freescale FRDM-KL46Z Azoteq Adapter Boards: AZP694A02, AZP690A02
AzqDev 3:8cce0e52f708 23 // 8. Freescale FRDM-KL25Z Azoteq Adapter Boards: AZP694A02, AZP690A02
AzqDev 0:55d94d451e3c 24 // 9. mbed LPC1768 Azoteq adapter AZP690A02 [SDA,SCL,RDY] wired to LPC1768 [p28,p27,p26]
AzqDev 0:55d94d451e3c 25 // 10. mbed LPC11U24 Azoteq adapter AZP690A02 [SDA,SCL,RDY] wired to LPC11U24 [p28,p27,p26]
AzqDev 0:55d94d451e3c 26
AzqDev 0:55d94d451e3c 27 // These two boards additionally require the USBDevice library: https://developer.mbed.org/users/mbed_official/code/USBDevice/
AzqDev 0:55d94d451e3c 28 // 11. Teensy 3.1 Azoteq adapter AZP690A02 [SDA,SCL,RDY] wired to Teensy 3.1 [p18,p19,p2]
AzqDev 0:55d94d451e3c 29 // 12. Teensy 3.2 Azoteq adapter AZP690A02 [SDA,SCL,RDY] wired to Teensy 3.2 [p18,p19,p2]
AzqDev 0:55d94d451e3c 30
AzqDev 2:b66a5d2f7583 31 // Direct wiring of ST Micro Nucleo boards to AZP690A02 (IQS621-EVAL-1 board)
AzqDev 2:b66a5d2f7583 32 // CN10-3 = SCL, CN10-5 = SDA, CN10-33 = RDY, CN11 = GND, CN7-16 = 3.3V
AzqDev 2:b66a5d2f7583 33
AzqDev 0:55d94d451e3c 34 #include "mbed.h"
AzqDev 0:55d94d451e3c 35 #include "IQS62x.h"
AzqDev 0:55d94d451e3c 36 #include "IQS621DisplayTerminal.h"
AzqDev 0:55d94d451e3c 37
AzqDev 0:55d94d451e3c 38 IQS621Display terminal; // class to display IQS62x registers on a terminal
AzqDev 0:55d94d451e3c 39 IQS62xIO iqs62x; // class for basic IQS62x block read and write
AzqDev 0:55d94d451e3c 40
AzqDev 0:55d94d451e3c 41 int main() {
AzqDev 0:55d94d451e3c 42 terminal.helloMessage(false); // say hello but don't wait for a keypress
AzqDev 0:55d94d451e3c 43 iqs62x.configure(); // configure the IC
AzqDev 12:158b7c3dc8dc 44 char * color = iqs62x.getTable(color_any_register_that_changed_in_the_previous_20_reads) ;
AzqDev 0:55d94d451e3c 45 while(1) {
AzqDev 6:f64e7e8d5283 46 iqs62x.readIqsRegisters(0,NUMBER_OF_REGISTERS); // read all the registers
AzqDev 0:55d94d451e3c 47 terminal.showStatus(iqs62x.I2Cspeed,iqs62x.I2CErrorCount); // show heading and number of I2C errors
AzqDev 12:158b7c3dc8dc 48 terminal.showRegisters(iqs62x.registers, color, false); // display registers, color the registers that changed
AzqDev 9:37cf595b0f7d 49 }
AzqDev 0:55d94d451e3c 50 }
AzqDev 0:55d94d451e3c 51 // end of IQS621_HelloWorld.cpp