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
main.cpp
00001 // IQS621-HelloWorld.cpp 00002 00003 // Hello World program for Azoteq IQS621 ultra low power sensor for ambient light, magnetic field, capacitive touch and inductive proximity. 00004 00005 // More info on IQS621 sensor IC: http://bit.ly/IQS621-Info 00006 00007 // Video: http://bit.ly/IQS621-Youtube-Video 00008 00009 // 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. 00010 00011 // Output is via the USB debug serial port to a terminal program 00012 00013 // Tested on the following MBED hardware - mostly using Azoteq-to-Arduino Adapter Boards 00014 // Note: When compiling for new hardware, use "Compile All" to rebuild everything 00015 00016 // 1. ST Micro Nucleo-L152RE Azoteq Adapter Boards: AZP694A02, AZP690A02 00017 // 2. ST Micro Nucleo-F401RE Azoteq Adapter Boards: AZP694A02, AZP690A02 00018 // 3. ST Micro Nucleo-L476RG Azoteq Adapter Boards: AZP694A02, AZP690A02 00019 // 4. ST Micro Nucleo-L053R8 Azoteq Adapter Boards: AZP694A02, AZP690A02 00020 // 5. ST Micro Nucleo-F446RE Azoteq Adapter Boards: AZP694A02, AZP690A02 00021 // 6. ST Micro Disco-F746NG Azoteq Adapter Boards: AZP694A02, AZP690A02 00022 // 7. Freescale FRDM-KL46Z Azoteq Adapter Boards: AZP694A02, AZP690A02 00023 // 8. Freescale FRDM-KL25Z Azoteq Adapter Boards: AZP694A02, AZP690A02 00024 // 9. mbed LPC1768 Azoteq adapter AZP690A02 [SDA,SCL,RDY] wired to LPC1768 [p28,p27,p26] 00025 // 10. mbed LPC11U24 Azoteq adapter AZP690A02 [SDA,SCL,RDY] wired to LPC11U24 [p28,p27,p26] 00026 00027 // These two boards additionally require the USBDevice library: https://developer.mbed.org/users/mbed_official/code/USBDevice/ 00028 // 11. Teensy 3.1 Azoteq adapter AZP690A02 [SDA,SCL,RDY] wired to Teensy 3.1 [p18,p19,p2] 00029 // 12. Teensy 3.2 Azoteq adapter AZP690A02 [SDA,SCL,RDY] wired to Teensy 3.2 [p18,p19,p2] 00030 00031 // Direct wiring of ST Micro Nucleo boards to AZP690A02 (IQS621-EVAL-1 board) 00032 // CN10-3 = SCL, CN10-5 = SDA, CN10-33 = RDY, CN11 = GND, CN7-16 = 3.3V 00033 00034 #include "mbed.h" 00035 #include "IQS62x.h" 00036 #include "IQS621DisplayTerminal.h" 00037 00038 IQS621Display terminal; // class to display IQS62x registers on a terminal 00039 IQS62xIO iqs62x; // class for basic IQS62x block read and write 00040 00041 int main() { 00042 terminal.helloMessage(false); // say hello but don't wait for a keypress 00043 iqs62x.configure(); // configure the IC 00044 char * color = iqs62x.getTable( color_any_register_that_was_written_but_then_changed ); // color registers that differ from their initialized value 00045 while(1) { 00046 iqs62x.readIqsRegisters(0,NUMBER_OF_REGISTERS); // read all the registers 00047 terminal.showStatus(iqs62x.I2Cspeed,iqs62x.I2CErrorCount); // show heading and number of I2C errors 00048 terminal.showRegisters(iqs62x.registers, color, false); // display registers, color the registers that changed 00049 } 00050 } 00051 // end of IQS621_HelloWorld.cpp
Generated on Sat Jul 16 2022 05:42:09 by 1.7.2