Ulta Low Power I2C Multi-Sensor: Capacitive Touch, Magnetic Field & Inductive Proximity.
Dependencies: IQS620DisplayTerminal IQS62x mbed
Fork of IQS620_HelloWorld by
Hello World! From Azoteq's IQS620 Ultra Low Power Multi-Sensor
This is an mbed hardware demo program for the Azoteq IQS620 ultra low power multisensor.
More details on the IQS620 (and verified mbed boards) on these component pages:
IQS620 Eval Kit board Connected to mbed LPC1768 board.
main.cpp@9:b289fdc8ce32, 2017-05-13 (annotated)
- Committer:
- AzqDev
- Date:
- Sat May 13 16:16:43 2017 +0000
- Revision:
- 9:b289fdc8ce32
- Parent:
- 8:fddce3223a97
- Child:
- 10:3f86cd2277cc
liibrary update & cosmetics
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AzqDev | 0:f1f07b4c5580 | 1 | // IQS620-HelloWorld.cpp |
AzqDev | 0:f1f07b4c5580 | 2 | |
AzqDev | 0:f1f07b4c5580 | 3 | // Hello World program for Azoteq IQS620 ultra low power sensor for magnetic field, capacitive touch and inductive proximity sensor. |
AzqDev | 0:f1f07b4c5580 | 4 | |
AzqDev | 0:f1f07b4c5580 | 5 | // More info on IQS620 sensor IC: http://bit.ly/IQS620-info |
AzqDev | 0:f1f07b4c5580 | 6 | |
AzqDev | 0:f1f07b4c5580 | 7 | // IQS620 1-minute youtube video: N.A. |
AzqDev | 0:f1f07b4c5580 | 8 | |
AzqDev | 0:f1f07b4c5580 | 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:f1f07b4c5580 | 10 | |
AzqDev | 0:f1f07b4c5580 | 11 | // Output is via the USB debug serial port to a terminal program |
AzqDev | 0:f1f07b4c5580 | 12 | |
AzqDev | 0:f1f07b4c5580 | 13 | // Tested on the following MBED hardware - mostly using Azoteq-to-Arduino Adapter Boards |
AzqDev | 0:f1f07b4c5580 | 14 | // Note: When compiling for new hardware, use "Compile All" to rebuild everything |
AzqDev | 0:f1f07b4c5580 | 15 | // Note 2: If you get "unkown target type" in USBxxx.h, remove the USB library |
AzqDev | 3:481d56f2b398 | 16 | // 1. ST Micro Nucleo-L152RE Azoteq Adapter Boards: AZP694A02, AZP690A02 |
AzqDev | 3:481d56f2b398 | 17 | // 2. ST Micro Nucleo-F401RE Azoteq Adapter Boards: AZP694A02, AZP690A02 |
AzqDev | 3:481d56f2b398 | 18 | // 3. ST Micro Nucleo-L476RG Azoteq Adapter Boards: AZP694A02, AZP690A02 |
AzqDev | 3:481d56f2b398 | 19 | // 4. ST Micro Nucleo-L053R8 Azoteq Adapter Boards: AZP694A02, AZP690A02 |
AzqDev | 3:481d56f2b398 | 20 | // 5. ST Micro Nucleo-F446RE Azoteq Adapter Boards: AZP694A02, AZP690A02 |
AzqDev | 3:481d56f2b398 | 21 | // 6. ST Micro Disco-F746NG Azoteq Adapter Boards: AZP694A02, AZP690A02 |
AzqDev | 3:481d56f2b398 | 22 | // 7. Freescale FRDM-KL46Z Azoteq Adapter Boards: AZP694A02, AZP690A02 |
AzqDev | 3:481d56f2b398 | 23 | // 8. Freescale FRDM-KL25Z Azoteq Adapter Boards: AZP694A02, AZP690A02 |
AzqDev | 0:f1f07b4c5580 | 24 | // 9. mbed LPC1768 Azoteq adapter AZP690A02 [SDA,SCL,RDY] wired to LPC1768 [p28,p27,p26] |
AzqDev | 0:f1f07b4c5580 | 25 | // 10. mbed LPC11U24 Azoteq adapter AZP690A02 [SDA,SCL,RDY] wired to LPC11U24 [p28,p27,p26] |
AzqDev | 0:f1f07b4c5580 | 26 | |
AzqDev | 0:f1f07b4c5580 | 27 | // These two boards additionally require the USBDevice library: https://developer.mbed.org/users/mbed_official/code/USBDevice/ |
AzqDev | 2:ce90bf4d3273 | 28 | // 11. Teensy 3.1 Azoteq adapter AZP690A02 [SDA,SCL,RDY] wired to Teensy 3.1 [p18,p19,p2] |
AzqDev | 2:ce90bf4d3273 | 29 | // 12. Teensy 3.2 Azoteq adapter AZP690A02 [SDA,SCL,RDY] wired to Teensy 3.2 [p18,p19,p2] |
AzqDev | 0:f1f07b4c5580 | 30 | |
AzqDev | 3:481d56f2b398 | 31 | // Direct wiring of ST Micro Nucleo boards to AZP690B02 (IQS620-EVAL-1 board) |
AzqDev | 3:481d56f2b398 | 32 | // CN10-3 = SCL, CN10-5 = SDA, CN10-33 = RDY, CN11 = GND, CN7-16 = 3.3V |
AzqDev | 3:481d56f2b398 | 33 | |
AzqDev | 3:481d56f2b398 | 34 | |
AzqDev | 0:f1f07b4c5580 | 35 | #include "mbed.h" |
AzqDev | 0:f1f07b4c5580 | 36 | #include "IQS62x.h" |
AzqDev | 0:f1f07b4c5580 | 37 | #include "IQS620DisplayTerminal.h" |
AzqDev | 0:f1f07b4c5580 | 38 | |
AzqDev | 0:f1f07b4c5580 | 39 | IQS620Display terminal; // class to display IQS62x registers on a terminal |
AzqDev | 0:f1f07b4c5580 | 40 | IQS62xIO iqs62x; // class for basic IQS62x block read and write |
AzqDev | 0:f1f07b4c5580 | 41 | |
AzqDev | 0:f1f07b4c5580 | 42 | int main() { |
AzqDev | 2:ce90bf4d3273 | 43 | terminal.helloMessage(false); // say hello but don't wait for a keypress |
AzqDev | 0:f1f07b4c5580 | 44 | iqs62x.configure(); // configure the IC |
AzqDev | 8:fddce3223a97 | 45 | while(1) { // main loop to continuously dump all registers |
AzqDev | 6:250df5794541 | 46 | iqs62x.readIqsRegisters(0,NUMBER_OF_REGISTERS); // read all the registers |
AzqDev | 8:fddce3223a97 | 47 | |
AzqDev | 0:f1f07b4c5580 | 48 | terminal.showStatus(iqs62x.I2Cspeed,iqs62x.I2CErrorCount); // show heading and number of I2C errors |
AzqDev | 8:fddce3223a97 | 49 | |
AzqDev | 9:b289fdc8ce32 | 50 | char * highlightTable; // a highlight table contains 1 byte per register - if the byte != 0 the register will be highlighted during display |
AzqDev | 9:b289fdc8ce32 | 51 | highlightTable = 0; // use a NULL table to make all registers print plain with no highlighting |
AzqDev | 9:b289fdc8ce32 | 52 | highlightTable = iqs62x.writeChanges; // table that highlights all registers that were written/configured but now contain a different value |
AzqDev | 9:b289fdc8ce32 | 53 | highlightTable = iqs62x.readChangesEver; // table that highlights all registers that ever changed since the previous read |
AzqDev | 9:b289fdc8ce32 | 54 | highlightTable = iqs62x.readChanges; // table that highlights all registers that changed since the previous read |
AzqDev | 9:b289fdc8ce32 | 55 | highlightTable = iqs62x.writeFlag; // table that highlights all registers that were written/initialized - can be used to verify configure() |
AzqDev | 9:b289fdc8ce32 | 56 | |
AzqDev | 9:b289fdc8ce32 | 57 | terminal.showRegisters(iqs62x.registers, highlightTable); // display the registers and highlight the ones marked in the highlight table |
AzqDev | 0:f1f07b4c5580 | 58 | } |
AzqDev | 0:f1f07b4c5580 | 59 | } |
AzqDev | 0:f1f07b4c5580 | 60 | // end of IQS620_HelloWorld.cpp |