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
A3pin; - to solder R47 resistor connected to
A5pin.
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
Revision 38:18abb7f7dcb2, committed 2015-12-03
- Comitter:
- mapellil
- Date:
- Thu Dec 03 09:45:40 2015 +0000
- Parent:
- 37:837cffa6b530
- Child:
- 39:3cce4ba37695
- Commit message:
- Fixed compilation warnings
Changed in this revision
--- a/Components/Interfaces/LightSensor.h Fri Nov 27 08:47:30 2015 +0000 +++ b/Components/Interfaces/LightSensor.h Thu Dec 03 09:45:40 2015 +0000 @@ -41,7 +41,7 @@ #define __LIGHT_SENSOR_CLASS_H /* Includes ------------------------------------------------------------------*/ -#include <GenericSensor.h> +#include "GenericSensor.h" /* Classes ------------------------------------------------------------------*/ /** An abstract class for ambient light sensors
--- a/Components/Interfaces/RangeSensor.h Fri Nov 27 08:47:30 2015 +0000 +++ b/Components/Interfaces/RangeSensor.h Thu Dec 03 09:45:40 2015 +0000 @@ -41,7 +41,7 @@ #define __RANGE_SENSOR_CLASS_H /* Includes ------------------------------------------------------------------*/ -#include <GenericSensor.h> +#include "GenericSensor.h" /* Classes ------------------------------------------------------------------*/ /** An abstract class for range sensors
--- a/Components/VL6180X/vl6180x_class.cpp Fri Nov 27 08:47:30 2015 +0000
+++ b/Components/VL6180X/vl6180x_class.cpp Thu Dec 03 09:45:40 2015 +0000
@@ -158,8 +158,8 @@
#define AN_GAIN_MULT (1<<GAIN_FIX_PREC)
-static int32_t _GetAveTotalTime(VL6180xDev_t dev);
-static int VL6180x_RangeSetEarlyConvergenceEestimateThreshold(VL6180xDev_t dev);
+//int32_t _GetAveTotalTime(VL6180xDev_t dev);
+//int VL6180x_RangeSetEarlyConvergenceEestimateThreshold(VL6180xDev_t dev);
/**
* ScalerLookUP scaling factor-1 to register #RANGE_SCALER lookup
@@ -253,18 +253,10 @@
};
#endif /* VL6180x_SINGLE_DEVICE_DRIVER */
-
-
#define Fix7_2_KCPs(x) ((((uint32_t)(x))*1000)>>7)
-
-#if VL6180x_WRAP_AROUND_FILTER_SUPPORT || VL6180x_HAVE_DMAX_RANGING
-static int _GetRateResult(VL6180xDev_t dev, VL6180x_RangeData_t *pRangeData);
-#endif
-
#if VL6180x_WRAP_AROUND_FILTER_SUPPORT
static int _filter_Init(VL6180xDev_t dev);
-static int _filter_GetResult(VL6180xDev_t dev, VL6180x_RangeData_t *pData);
#define _IsWrapArroundActive(dev) VL6180xDevDataGet(dev,WrapAroundFilterActive)
#else
#define _IsWrapArroundActive(dev) 0
@@ -273,7 +265,7 @@
#if VL6180x_HAVE_DMAX_RANGING
void _DMax_OneTimeInit(VL6180xDev_t dev);
- static int _DMax_InitData(VL6180xDev_t dev);
+// static int _DMax_InitData(VL6180xDev_t dev);
static int _DMax_Compute(VL6180xDev_t dev, VL6180x_RangeData_t *pRange);
#define _IsDMaxActive(dev) VL6180xDevDataGet(dev,DMaxEnable)
#else
@@ -282,8 +274,8 @@
#define _IsDMaxActive(...) 0
#endif
-static int VL6180x_RangeStaticInit(VL6180xDev_t dev);
-static int VL6180x_UpscaleStaticInit(VL6180xDev_t dev);
+//static int VL6180x_RangeStaticInit(VL6180xDev_t dev);
+//static int VL6180x_UpscaleStaticInit(VL6180xDev_t dev);
int VL6180X::VL6180x_WaitDeviceBooted(VL6180xDev_t dev){
uint8_t FreshOutReset;
@@ -1740,7 +1732,7 @@
/*
* One time init
*/
-int _filter_Init( VL6180xDev_t dev) {
+static int _filter_Init( VL6180xDev_t dev) {
int i;
_FilterData(MeasurementIndex) = 0;
--- a/Components/VL6180X/vl6180x_class.h Fri Nov 27 08:47:30 2015 +0000
+++ b/Components/VL6180X/vl6180x_class.h Thu Dec 03 09:45:40 2015 +0000
@@ -93,7 +93,7 @@
/* Classes -------------------------------------------------------------------*/
/** Class representing a VL6180X sensor component
*/
-class VL6180X : public RangeSensor, public LightSensor
+class VL6180X : public RangeSensor, public LightSensor
{
public:
/** Constructor 1
@@ -276,7 +276,7 @@
* @param void
* @return 0 on success, @a #CALIBRATION_WARNING if failed
*/
- int Init()
+ virtual int Init()
{
return VL6180x_InitData(Device);
}
@@ -434,7 +434,7 @@
* @param pRange_mm Pointer to range distance
* @return 0 on success
*/
- int GetRange(int32_t *piData)
+ virtual int GetRange(int32_t *piData)
{
return VL6180x_RangeGetResult(Device, piData);
}
@@ -1035,7 +1035,7 @@
* @param *piData The pointer to variable to write in the measure in Lux
* @return 0 On success
*/
- int GetLight(uint32_t *piData)
+ virtual int GetLight(uint32_t *piData)
{
return VL6180x_AlsGetLux(Device, piData);
}
@@ -1132,7 +1132,7 @@
int _DMax_InitData(VL6180xDev_t dev);
/* Read function of the ID device */
- int ReadID();
+ virtual int ReadID();
/* Write and read functions from I2C */
int VL6180x_WrByte(VL6180xDev_t dev, uint16_t index, uint8_t data);

X-NUCLEO-6180XA1 Proximity and Ambient Light Sensor