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 ST Expansion SW Team

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:

  1. on-board VL6180X proximity and ambient light sensor,
  2. up to three additional VL6180X Satellites,
  3. 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

Files at this revision

API Documentation at this revision

Comitter:
mapellil
Date:
Mon Nov 09 15:37:48 2015 +0000
Parent:
30:75bf50276881
Child:
32:ef97c377d27b
Commit message:
Added Doxygen doc

Changed in this revision

Components/VL6180X/vl6180x_class.h Show annotated file Show diff for this revision Revisions of this file
--- a/Components/VL6180X/vl6180x_class.h	Mon Nov 09 09:38:34 2015 +0000
+++ b/Components/VL6180X/vl6180x_class.h	Mon Nov 09 15:37:48 2015 +0000
@@ -127,10 +127,15 @@
     
    /** Destructor
     */
-    virtual ~VL6180X(){} 
+    virtual ~VL6180X(){}     
     /* warning: VL6180X class inherits from GenericSensor, RangeSensor and LightSensor, that haven`t a destructor.
        The warning should request to introduce a virtual destructor to make sure to delete the object */
-		
+
+	/*** Interface Methods ***/	
+	/**
+	 * @brief       PowerOn the sensor
+	 * @return      void
+	 */		
     /* turns on the sensor */		 
     void VL6180x_On(void)
     {
@@ -139,7 +144,11 @@
        else if(expgpio0) 
 	  *expgpio0=1;
     } 
-		
+
+	/**
+	 * @brief       PowerOff the sensor
+	 * @return      void
+	 */		
     /* turns off the sensor */
     void VL6180x_Off(void) 
     {
@@ -148,39 +157,78 @@
        else if(expgpio0) 
 	  *expgpio0=0;			
     }
-		
+    
+	/**
+	 * @brief       Initialize the sensor with default values
+	 * @return      0 on Success
+	 */					 
     int InitSensor(uint8_t NewAddr);
+    
+	/**
+	 * @brief       Start the measure indicated by operating mode
+	 * @param[in]   operating_mode specifies requested measure 
+	 * @param[in]   fptr specifies call back function in case of interrupt measure	 
+	 * @param[in]   low specifies measure low threashold
+	 * @param[in]   high specifies measure high threashold	 
+	 * @return      0 on Success
+	 */					     
     int StartMeasurement(OperatingMode operating_mode, void (*fptr)(void), uint16_t low, uint16_t high);
-    int GetMeasurement(OperatingMode operating_mode, MeasureData_t *Data);		
-    int StopMeasurement(OperatingMode operating_mode);
 
-    /* handling functions of the interrupt_measure */
-		
-    /** Attach a function to call when an interrupt is detected, i.e. measurement is ready
-     *
-     *  @param[in] fptr A pointer to a void function, or 0 to set as none
-     */
+	/**
+	 * @brief       Get results for the measure indicated by operating mode
+	 * @param[in]   operating_mode specifies requested measure results
+	 * @param[out]  Data pointer to the MeasureData_t structure to read data in to
+	 * @return      0 on Success
+	 */					         
+    int GetMeasurement(OperatingMode operating_mode, MeasureData_t *Data);		
+
+	/**
+	 * @brief       Stop the currently running measure indicate by operating_mode
+	 * @param[in]   operating_mode specifies requested measure to stop
+	 * @return      0 on Success
+	 */					             
+    int StopMeasurement(OperatingMode operating_mode);
+     
+	/**
+	 * @brief       Attach a function to call when an interrupt is detected, i.e. measurement is ready
+	 * @param[in]   fptr pointer to call back function to be called whenever an interrupt occours
+	 * @return      0 on Success
+	 */					                  
     void AttachInterruptMeasureDetectionIRQ(void (*fptr)(void))
     {
        interrupt_measure.rise(fptr);
     }
 
-    /** Enable interrupt measure IRQ
-     */
+	/**
+	 * @brief       Enable interrupt measure IRQ
+	 * @return      0 on Success
+	 */					     
     void EnableInterruptMeasureDetectionIRQ(void) 
     {
        interrupt_measure.enable_irq();
     }
 
-    /** Disable interrupt measure IRQ
-     */
+	/**
+	 * @brief       Disable interrupt measure IRQ
+	 * @return      0 on Success
+	 */					          
     void DisableInterruptMeasureDetectionIRQ(void) 
     {
        interrupt_measure.disable_irq();
     }
-		
+    
+	/**
+	 * @brief       Interrupt handling func to be called by user after an INT is occourred
+	 * @param[in]   opeating_mode indicating the in progress measure
+	 * @param[out]  Data pointer to the MeasureData_t structure to read data in to
+	 * @return      0 on Success
+	 */					          		
     int HandleIRQ(OperatingMode operating_mode, MeasureData_t *Data);
-		
+
+	/**
+	 * @brief       Check the sensor presence
+	 * @return      1 when device is present
+	 */						
     unsigned Present()
     {
        return Device->Present;