Azoteq / Mbed 2 deprecated IQS624_HelloWorld Featured

Dependencies:   IQS62x IQSDisplayTerminal mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 // IQS624-HelloWorld.cpp
00002 
00003 // Hello World program for Azoteq IQS624 ultra low power sensor for 2D magnetic angle, capacitive touch and inductive proximity sensor.
00004 
00005 // More info on Azoteq IQS624 page: http://www.azoteq.com/products/proxfusion/iqs624?mbed
00006 
00007 // IQS624 1-minute youtube video: http://bit.ly/IQS624Video
00008 
00009 // IQS624 hardware page on mbed: https://developer.mbed.org/components/IQS624/
00010 
00011 // IQS624 eval kit page on mbed: https://developer.mbed.org/components/IQS624-EVAL-1/
00012 
00013 // 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.
00014 
00015 // Output is via the USB debug serial port to any VT100-compatible terminal emulator such as Tera Term or Putty. (Set background to white)
00016 
00017 // Tested on the following MBED hardware
00018 // Note: When compiling for new hardware, use "Compile All" to rebuild everything
00019 //  1. ST Micro Nucleo-L152RE   Azoteq Adapter Boards: AZP675E02, AZP694A02, AZP690E01
00020 //  2. ST Micro Nucleo-F401RE   Azoteq Adapter Boards: AZP675E02, AZP694A02, AZP690E01
00021 //  3. ST Micro Nucleo-L476RG   Azoteq Adapter Boards: AZP675E02, AZP694A02, AZP690E01
00022 //  4. ST Micro Nucleo-L053R8   Azoteq Adapter Boards: AZP675E02, AZP694A02, AZP690E01
00023 //  5. ST Micro Nucleo-F446RE   Azoteq Adapter Boards: AZP675E02, AZP694A02, AZP690E01
00024 //  6. ST Micro Disco-F746NG    Azoteq Adapter Boards: AZP675E02, AZP694A02, AZP690E01
00025 //  7. Freescale FRDM-KL46Z     Azoteq Adapter Boards: AZP675E02, AZP694A02, AZP690E01
00026 //  8. Freescale FRDM-KL25Z     Azoteq Adapter Boards: AZP675E02, AZP694A02, AZP690E01
00027 //  9. mbed LPC1768             Azoteq adapter AZP690E01 [SDA,SCL,RDY] wired to LPC1768 [p28,p27,p26]
00028 // 10. mbed LPC11U24            Azoteq adapter AZP690E01 [SDA,SCL,RDY] wired to LPC11U24 [p28,p27,p26]
00029 
00030 // These two boards additionally require the USBDevice library: https://developer.mbed.org/users/mbed_official/code/USBDevice/
00031 // 11. Teensy 3.1               Azoteq adapter AZP690E01 [SDA,SCL,RDY] wired to Teensy 3.1 [p18,p19,p2]
00032 // 12. Teensy 3.2               Azoteq adapter AZP690E01 [SDA,SCL,RDY] wired to Teensy 3.2 [p18,p19,p2]
00033 
00034 // Direct wiring of ST Micro Nucleo boards to AZP690B02 (IQS620-EVAL-1 board)
00035 // [SDA,SCL,RDY] wired to Nucleo [CN10-5,CN10-3,CN10-33], [GND,3.3V] wired to Nucleo [CN11,CN7-16]
00036 
00037 
00038 #include "mbed.h"
00039 #include "IQS62x.h"
00040 #include "IQSdisplayTerminal.h"
00041 
00042 IQS62xDisplay terminal;   // class to display IQS62x registers on a terminal
00043 IQS62xIO iqs62x;          // class for basic IQS62x block read and write
00044 
00045 int main() {
00046     terminal.helloMessage(false); // say hello but don't wait for a keypress
00047     iqs62x.configure(); // configure the IC
00048     char * color = iqs62x.getTable(color_any_register_that_changed_in_the_previous_20_reads); // table that contains changes to register values
00049     while(1) {
00050         iqs62x.readIqsRegisters(0,NUMBER_OF_REGISTERS); // read all the registers
00051         terminal.showStatus(iqs62x.I2Cspeed,iqs62x.I2CErrorCount); // show heading and number of I2C errors
00052         terminal.showRegisters(iqs62x.registers, color, false); // display registers, color the registers that changed
00053     }    
00054 }
00055 // end of IQS624_HelloWorld.cpp