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/VL6180X/vl6180x_cfg.h@57:fa4c622b04a7, 2017-03-13 (annotated)
- Committer:
- Davidroid
- Date:
- Mon Mar 13 19:08:10 2017 +0000
- Revision:
- 57:fa4c622b04a7
- Parent:
- 35:407b0b127eb8
Aligned to ARM mbed coding style.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gallonm | 1:1de1ea2994d9 | 1 | /******************************************************************************* |
gallonm | 1:1de1ea2994d9 | 2 | Copyright © 2014, STMicroelectronics International N.V. |
gallonm | 1:1de1ea2994d9 | 3 | All rights reserved. |
gallonm | 1:1de1ea2994d9 | 4 | |
gallonm | 1:1de1ea2994d9 | 5 | Redistribution and use in source and binary forms, with or without |
gallonm | 1:1de1ea2994d9 | 6 | modification, are permitted provided that the following conditions are met: |
gallonm | 1:1de1ea2994d9 | 7 | * Redistributions of source code must retain the above copyright |
gallonm | 1:1de1ea2994d9 | 8 | notice, this list of conditions and the following disclaimer. |
gallonm | 1:1de1ea2994d9 | 9 | * Redistributions in binary form must reproduce the above copyright |
gallonm | 1:1de1ea2994d9 | 10 | notice, this list of conditions and the following disclaimer in the |
gallonm | 1:1de1ea2994d9 | 11 | documentation and/or other materials provided with the distribution. |
gallonm | 1:1de1ea2994d9 | 12 | * Neither the name of STMicroelectronics nor the |
gallonm | 1:1de1ea2994d9 | 13 | names of its contributors may be used to endorse or promote products |
gallonm | 1:1de1ea2994d9 | 14 | derived from this software without specific prior written permission. |
gallonm | 1:1de1ea2994d9 | 15 | |
gallonm | 1:1de1ea2994d9 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
gallonm | 1:1de1ea2994d9 | 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
gallonm | 1:1de1ea2994d9 | 18 | WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND |
gallonm | 1:1de1ea2994d9 | 19 | NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED. |
gallonm | 1:1de1ea2994d9 | 20 | IN NO EVENT SHALL STMICROELECTRONICS INTERNATIONAL N.V. BE LIABLE FOR ANY |
gallonm | 1:1de1ea2994d9 | 21 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
gallonm | 1:1de1ea2994d9 | 22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
gallonm | 1:1de1ea2994d9 | 23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
gallonm | 1:1de1ea2994d9 | 24 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
gallonm | 1:1de1ea2994d9 | 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
gallonm | 1:1de1ea2994d9 | 26 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
gallonm | 1:1de1ea2994d9 | 27 | ********************************************************************************/ |
gallonm | 1:1de1ea2994d9 | 28 | /* |
gallonm | 1:1de1ea2994d9 | 29 | * $Date: 2015-01-08 14:35:34 +0100 (Thu, 08 Jan 2015) $ |
gallonm | 1:1de1ea2994d9 | 30 | * $Revision: 2042 $ |
gallonm | 1:1de1ea2994d9 | 31 | */ |
gallonm | 1:1de1ea2994d9 | 32 | |
gallonm | 1:1de1ea2994d9 | 33 | /** |
Davidroid | 57:fa4c622b04a7 | 34 | * @file VL6180X_cfg.h |
gallonm | 1:1de1ea2994d9 | 35 | * |
gallonm | 1:1de1ea2994d9 | 36 | * Proximity and ALS configuration |
gallonm | 1:1de1ea2994d9 | 37 | */ |
gallonm | 1:1de1ea2994d9 | 38 | |
Davidroid | 57:fa4c622b04a7 | 39 | #ifndef VL6180X_CFG_H_ |
Davidroid | 57:fa4c622b04a7 | 40 | #define VL6180X_CFG_H_ |
gallonm | 1:1de1ea2994d9 | 41 | |
gallonm | 1:1de1ea2994d9 | 42 | /** @defgroup api_config Configuration |
gallonm | 1:1de1ea2994d9 | 43 | * @brief API static configuration |
gallonm | 1:1de1ea2994d9 | 44 | */ |
gallonm | 1:1de1ea2994d9 | 45 | |
gallonm | 1:1de1ea2994d9 | 46 | |
gallonm | 1:1de1ea2994d9 | 47 | |
gallonm | 1:1de1ea2994d9 | 48 | /** @ingroup api_config |
gallonm | 1:1de1ea2994d9 | 49 | * @{*/ |
gallonm | 1:1de1ea2994d9 | 50 | |
gallonm | 1:1de1ea2994d9 | 51 | |
gallonm | 1:1de1ea2994d9 | 52 | /** |
Davidroid | 57:fa4c622b04a7 | 53 | * @def VL6180X_UPSCALE_SUPPORT |
gallonm | 1:1de1ea2994d9 | 54 | * @brief Configure up-scale capabilities and default up-scale factor for ranging operations |
gallonm | 1:1de1ea2994d9 | 55 | * |
gallonm | 1:1de1ea2994d9 | 56 | * @li 1 : Fixed scaling by 1 (no up-scaling support) |
gallonm | 1:1de1ea2994d9 | 57 | * @li 2 : Fixed scaling by 2 |
gallonm | 1:1de1ea2994d9 | 58 | * @li 3 : Fixed scaling by 3 |
Davidroid | 57:fa4c622b04a7 | 59 | * @li -1 -2 -3 : Run time programmable through @a VL6180X_UpscaleSetScaling(). Default scaling factore is -VL6180X_UPSCALE_SUPPORT \n |
gallonm | 1:1de1ea2994d9 | 60 | */ |
Davidroid | 57:fa4c622b04a7 | 61 | //#define VL6180X_UPSCALE_SUPPORT -1 |
gallonm | 1:1de1ea2994d9 | 62 | |
gallonm | 1:1de1ea2994d9 | 63 | /** |
Davidroid | 57:fa4c622b04a7 | 64 | * @def VL6180X_ALS_SUPPORT |
gallonm | 1:1de1ea2994d9 | 65 | * @brief Enable ALS support |
gallonm | 1:1de1ea2994d9 | 66 | * |
gallonm | 1:1de1ea2994d9 | 67 | * Set to 0 if ALS is not used in application. This can help reducing code size if it is a concern. |
gallonm | 1:1de1ea2994d9 | 68 | */ |
Davidroid | 57:fa4c622b04a7 | 69 | #define VL6180X_ALS_SUPPORT 1 |
gallonm | 1:1de1ea2994d9 | 70 | |
gallonm | 1:1de1ea2994d9 | 71 | /** |
Davidroid | 57:fa4c622b04a7 | 72 | * @def VL6180X_HAVE_DMAX_RANGING |
gallonm | 1:1de1ea2994d9 | 73 | * @brief Enable DMax calculation for ranging applications. |
gallonm | 1:1de1ea2994d9 | 74 | * |
Davidroid | 57:fa4c622b04a7 | 75 | * When set to 1, __Dmax__ is returned by API typically when @a VL6180X_RangePollMeasurement() high level |
Davidroid | 57:fa4c622b04a7 | 76 | * function is called (this is returned in @a VL6180X_RangeData_t structure). |
gallonm | 1:1de1ea2994d9 | 77 | * __Dmax__ is an estimation of the maximum distance (in mm) the product can report a valid distance of a 17% target for |
gallonm | 1:1de1ea2994d9 | 78 | * the current ambient light conditions (__Dmax__ decreases when ambient light increases). __Dmax__ should be used only |
gallonm | 1:1de1ea2994d9 | 79 | * when the product is not able to return a valid distance (no object or object is too far from the ranging sensor). |
Davidroid | 57:fa4c622b04a7 | 80 | * Typically, this is done by checking the __errorStatus__ field of the @a VL6180X_RangeData_t structure returned by |
Davidroid | 57:fa4c622b04a7 | 81 | * the @a VL6180X_RangePollMeasurement() function. |
gallonm | 1:1de1ea2994d9 | 82 | * You may refer to ::RangeError_u to get full list of supported error codes. |
gallonm | 1:1de1ea2994d9 | 83 | * @warning Dmax is estimated for a 17% grey target. If the real target has a reflectance lower than 17%, report Dmax could be over-estimated |
gallonm | 1:1de1ea2994d9 | 84 | */ |
Davidroid | 57:fa4c622b04a7 | 85 | #define VL6180X_HAVE_DMAX_RANGING 1 |
gallonm | 1:1de1ea2994d9 | 86 | |
gallonm | 1:1de1ea2994d9 | 87 | /** |
Davidroid | 57:fa4c622b04a7 | 88 | * @def VL6180X_WRAP_AROUND_FILTER_SUPPORT |
gallonm | 1:1de1ea2994d9 | 89 | * @brief Enable wrap around filter (WAF) feature |
gallonm | 1:1de1ea2994d9 | 90 | * |
gallonm | 1:1de1ea2994d9 | 91 | * In specific conditions, when targeting a mirror or a very reflective metal, a __wrap around__ effect can occur internally to the |
gallonm | 1:1de1ea2994d9 | 92 | * ranging product which results in returning a wrong distance (under-estimated). Goal of the WAF is to detect this wrap arround effect |
gallonm | 1:1de1ea2994d9 | 93 | * and to filter it by returning a non-valid distance : __errorStatus__ set to 16 (see ::RangeError_u) |
gallonm | 1:1de1ea2994d9 | 94 | * @warning Wrap-around filter can not be used when device is running in continuous mode |
gallonm | 1:1de1ea2994d9 | 95 | * |
gallonm | 1:1de1ea2994d9 | 96 | * @li 0 : Filter is not supported, no filtering code is included in API |
gallonm | 1:1de1ea2994d9 | 97 | * @li 1 : Filter is supported and active by default |
Davidroid | 57:fa4c622b04a7 | 98 | * @li -1 : Filter is supported but is not active by default @a VL6180X_FilterSetState() can turn it on and off at any time |
gallonm | 1:1de1ea2994d9 | 99 | */ |
Davidroid | 57:fa4c622b04a7 | 100 | #define VL6180X_WRAP_AROUND_FILTER_SUPPORT 1 |
gallonm | 1:1de1ea2994d9 | 101 | |
gallonm | 1:1de1ea2994d9 | 102 | /** |
Davidroid | 57:fa4c622b04a7 | 103 | * @def VL6180X_EXTENDED_RANGE |
gallonm | 1:1de1ea2994d9 | 104 | * @brief Enable extended ranging support |
gallonm | 1:1de1ea2994d9 | 105 | * |
gallonm | 1:1de1ea2994d9 | 106 | * Device that do not formally support extended ranging should only be used with a scaling factor of 1. |
gallonm | 1:1de1ea2994d9 | 107 | * Correct operation with scaling factor other than 1 (>200mm ) is not granted by ST. |
gallonm | 1:1de1ea2994d9 | 108 | */ |
Davidroid | 57:fa4c622b04a7 | 109 | //#define VL6180X_EXTENDED_RANGE 0 |
gallonm | 24:025afc3fe30f | 110 | |
mapellil | 35:407b0b127eb8 | 111 | #define EXTENDED_RANGE_50CM 0 |
mapellil | 35:407b0b127eb8 | 112 | //#define EXTENDED_RANGE_50CM 1 |
gallonm | 1:1de1ea2994d9 | 113 | |
gallonm | 24:025afc3fe30f | 114 | #if EXTENDED_RANGE_50CM |
Davidroid | 57:fa4c622b04a7 | 115 | #define VL6180X_UPSCALE_SUPPORT -3 |
Davidroid | 57:fa4c622b04a7 | 116 | #define VL6180X_EXTENDED_RANGE 1 |
gallonm | 24:025afc3fe30f | 117 | #else |
Davidroid | 57:fa4c622b04a7 | 118 | #define VL6180X_UPSCALE_SUPPORT -1 |
Davidroid | 57:fa4c622b04a7 | 119 | #define VL6180X_EXTENDED_RANGE 0 |
gallonm | 24:025afc3fe30f | 120 | #endif |
gallonm | 1:1de1ea2994d9 | 121 | |
Davidroid | 57:fa4c622b04a7 | 122 | #if (VL6180X_EXTENDED_RANGE) && (VL6180X_ALS_SUPPORT) |
gallonm | 1:1de1ea2994d9 | 123 | #warning "Als support should be OFF for extended range" |
gallonm | 1:1de1ea2994d9 | 124 | #endif |
gallonm | 1:1de1ea2994d9 | 125 | |
gallonm | 1:1de1ea2994d9 | 126 | #endif |
gallonm | 1:1de1ea2994d9 | 127 | /** @} */ // end of api_config |
gallonm | 1:1de1ea2994d9 | 128 | |
Davidroid | 57:fa4c622b04a7 | 129 | /* VL6180X_CFG_H_ */ |