Library to handle the X-NUCLEO-6180XA1 Proximity and ambient light sensor expansion board based on VL6180X.
Dependencies: X_NUCLEO_COMMON ST_INTERFACES
Dependents: HelloWorld_6180XA1 SunTracker_BLE Servo_6180XA1 BLE_HR_Light ... more
Fork of X_NUCLEO_6180XA1 by
X-NUCLEO-6180XA1 Proximity and Ambient Light Sensor Expansion Board Firmware Package
Introduction
This firmware package includes Components Device Drivers and Board Support Package for STMicroelectronics' X-NUCLEO-6180XA1 Proximity and ambient light sensor expansion board based on VL6180X.
Firmware Library
Class X_NUCLEO_6180XA1 is intended to represent the Proximity and ambient light sensor expansion board with the same name.
The expansion board is providing the support of the following components:
- on-board VL6180X proximity and ambient light sensor,
- up to three additional VL6180X Satellites,
- on-board 4-digit display
It is intentionally implemented as a singleton because only one X-NUCLEO-VL6180XA1 at a time might be deployed in a HW component stack. In order to get the singleton instance you have to call class method `Instance()`, e.g.:
// Sensors expansion board singleton instance static X_NUCLEO_6180XA1 *6180X_expansion_board = X_NUCLEO_6180XA1::Instance();
Arduino Connector Compatibility Warning
Using the X-NUCLEO-6180XA1 expansion board with the NUCLEO-F429ZI
requires adopting the following patch:
- to remove R46 resistor connected to
A3
pin; - to solder R47 resistor connected to
A5
pin.
Alternatively, you can route the Nucleo board’s A5
pin directly to the expansion board’s A3
pin with a wire.
In case you patch your expansion board or route the pin, the interrupt signal for the front sensor will be driven on A5
pin rather than on A3
pin.
Example Applications
Components/Switch/Switch.h@58:1e9a3a46f814, 2017-08-21 (annotated)
- Committer:
- nikapov
- Date:
- Mon Aug 21 15:44:34 2017 +0000
- Revision:
- 58:1e9a3a46f814
- Parent:
- 57:fa4c622b04a7
Make compatible with non-copyable version of I2C.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
davide.aliprandi@st.com | 56:37d1736bd896 | 1 | /** |
davide.aliprandi@st.com | 56:37d1736bd896 | 2 | ****************************************************************************** |
davide.aliprandi@st.com | 56:37d1736bd896 | 3 | * @file Switch.h |
davide.aliprandi@st.com | 56:37d1736bd896 | 4 | * @author AST / EST |
davide.aliprandi@st.com | 56:37d1736bd896 | 5 | * @version V0.0.1 |
davide.aliprandi@st.com | 56:37d1736bd896 | 6 | * @date 14-April-2015 |
davide.aliprandi@st.com | 56:37d1736bd896 | 7 | * @brief Header file for red switch |
davide.aliprandi@st.com | 56:37d1736bd896 | 8 | ****************************************************************************** |
davide.aliprandi@st.com | 56:37d1736bd896 | 9 | * @attention |
davide.aliprandi@st.com | 56:37d1736bd896 | 10 | * |
davide.aliprandi@st.com | 56:37d1736bd896 | 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
davide.aliprandi@st.com | 56:37d1736bd896 | 12 | * |
davide.aliprandi@st.com | 56:37d1736bd896 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
davide.aliprandi@st.com | 56:37d1736bd896 | 14 | * are permitted provided that the following conditions are met: |
davide.aliprandi@st.com | 56:37d1736bd896 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
davide.aliprandi@st.com | 56:37d1736bd896 | 16 | * this list of conditions and the following disclaimer. |
davide.aliprandi@st.com | 56:37d1736bd896 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
davide.aliprandi@st.com | 56:37d1736bd896 | 18 | * this list of conditions and the following disclaimer in the documentation |
davide.aliprandi@st.com | 56:37d1736bd896 | 19 | * and/or other materials provided with the distribution. |
davide.aliprandi@st.com | 56:37d1736bd896 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
davide.aliprandi@st.com | 56:37d1736bd896 | 21 | * may be used to endorse or promote products derived from this software |
davide.aliprandi@st.com | 56:37d1736bd896 | 22 | * without specific prior written permission. |
davide.aliprandi@st.com | 56:37d1736bd896 | 23 | * |
davide.aliprandi@st.com | 56:37d1736bd896 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
davide.aliprandi@st.com | 56:37d1736bd896 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
davide.aliprandi@st.com | 56:37d1736bd896 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
davide.aliprandi@st.com | 56:37d1736bd896 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
davide.aliprandi@st.com | 56:37d1736bd896 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
davide.aliprandi@st.com | 56:37d1736bd896 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
davide.aliprandi@st.com | 56:37d1736bd896 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
davide.aliprandi@st.com | 56:37d1736bd896 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
davide.aliprandi@st.com | 56:37d1736bd896 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
davide.aliprandi@st.com | 56:37d1736bd896 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
davide.aliprandi@st.com | 56:37d1736bd896 | 34 | * |
davide.aliprandi@st.com | 56:37d1736bd896 | 35 | ****************************************************************************** |
davide.aliprandi@st.com | 56:37d1736bd896 | 36 | */ |
davide.aliprandi@st.com | 56:37d1736bd896 | 37 | |
davide.aliprandi@st.com | 56:37d1736bd896 | 38 | |
davide.aliprandi@st.com | 56:37d1736bd896 | 39 | #ifndef __SWITCH_H |
davide.aliprandi@st.com | 56:37d1736bd896 | 40 | #define __SWITCH_H |
davide.aliprandi@st.com | 56:37d1736bd896 | 41 | |
davide.aliprandi@st.com | 56:37d1736bd896 | 42 | |
davide.aliprandi@st.com | 56:37d1736bd896 | 43 | /* Includes ------------------------------------------------------------------*/ |
davide.aliprandi@st.com | 56:37d1736bd896 | 44 | |
davide.aliprandi@st.com | 56:37d1736bd896 | 45 | #include "mbed.h" |
Davidroid | 57:fa4c622b04a7 | 46 | #include "STMPE1600.h" |
davide.aliprandi@st.com | 56:37d1736bd896 | 47 | |
davide.aliprandi@st.com | 56:37d1736bd896 | 48 | #ifdef __cplusplus |
davide.aliprandi@st.com | 56:37d1736bd896 | 49 | extern "C" { |
davide.aliprandi@st.com | 56:37d1736bd896 | 50 | #endif |
davide.aliprandi@st.com | 56:37d1736bd896 | 51 | |
davide.aliprandi@st.com | 56:37d1736bd896 | 52 | typedef enum { |
davide.aliprandi@st.com | 56:37d1736bd896 | 53 | RANGE = 0, |
davide.aliprandi@st.com | 56:37d1736bd896 | 54 | ALS |
davide.aliprandi@st.com | 56:37d1736bd896 | 55 | } SwitchState; |
davide.aliprandi@st.com | 56:37d1736bd896 | 56 | |
davide.aliprandi@st.com | 56:37d1736bd896 | 57 | |
davide.aliprandi@st.com | 56:37d1736bd896 | 58 | /* Classes -------------------------------------------------------------------*/ |
davide.aliprandi@st.com | 56:37d1736bd896 | 59 | |
davide.aliprandi@st.com | 56:37d1736bd896 | 60 | /** |
davide.aliprandi@st.com | 56:37d1736bd896 | 61 | * Class representing Red Switch |
davide.aliprandi@st.com | 56:37d1736bd896 | 62 | */ |
davide.aliprandi@st.com | 56:37d1736bd896 | 63 | |
davide.aliprandi@st.com | 56:37d1736bd896 | 64 | class Switch |
davide.aliprandi@st.com | 56:37d1736bd896 | 65 | { |
davide.aliprandi@st.com | 56:37d1736bd896 | 66 | public: |
Davidroid | 57:fa4c622b04a7 | 67 | Switch(STMPE1600 &stmpe_1600, exp_gpio_pin_name Pin_Name=GPIO_11) : stmpe1600(stmpe_1600), PinName(Pin_Name) { |
davide.aliprandi@st.com | 56:37d1736bd896 | 68 | stmpe1600.set_gpio_dir(PinName, INPUT); |
davide.aliprandi@st.com | 56:37d1736bd896 | 69 | } |
davide.aliprandi@st.com | 56:37d1736bd896 | 70 | |
davide.aliprandi@st.com | 56:37d1736bd896 | 71 | bool rd_switch () { |
davide.aliprandi@st.com | 56:37d1736bd896 | 72 | return stmpe1600.rd_gpio(PinName); |
davide.aliprandi@st.com | 56:37d1736bd896 | 73 | } |
davide.aliprandi@st.com | 56:37d1736bd896 | 74 | |
davide.aliprandi@st.com | 56:37d1736bd896 | 75 | operator int() { |
davide.aliprandi@st.com | 56:37d1736bd896 | 76 | return rd_switch(); |
davide.aliprandi@st.com | 56:37d1736bd896 | 77 | } |
davide.aliprandi@st.com | 56:37d1736bd896 | 78 | |
davide.aliprandi@st.com | 56:37d1736bd896 | 79 | private: |
davide.aliprandi@st.com | 56:37d1736bd896 | 80 | STMPE1600 &stmpe1600; |
Davidroid | 57:fa4c622b04a7 | 81 | exp_gpio_pin_name PinName; |
davide.aliprandi@st.com | 56:37d1736bd896 | 82 | }; |
davide.aliprandi@st.com | 56:37d1736bd896 | 83 | |
davide.aliprandi@st.com | 56:37d1736bd896 | 84 | #ifdef __cplusplus |
davide.aliprandi@st.com | 56:37d1736bd896 | 85 | } |
davide.aliprandi@st.com | 56:37d1736bd896 | 86 | #endif |
davide.aliprandi@st.com | 56:37d1736bd896 | 87 | #endif // __SWITCH_H |