INSAT Mini Project

Dependencies:   ST_INTERFACES X_NUCLEO_COMMON

Fork of X_NUCLEO_6180XA1 by ST

Committer:
mapellil
Date:
Tue Nov 10 10:46:15 2015 +0000
Revision:
32:ef97c377d27b
Parent:
31:f99c53a51917
Child:
35:407b0b127eb8
Extended Doxy doc

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gallonm 1:1de1ea2994d9 1 /**
gallonm 1:1de1ea2994d9 2 ******************************************************************************
gallonm 1:1de1ea2994d9 3 * @file vl6180x_class.h
gallonm 1:1de1ea2994d9 4 * @author AST / EST
gallonm 1:1de1ea2994d9 5 * @version V0.0.1
mapellil 30:75bf50276881 6 * @date 9-November-2015
gallonm 1:1de1ea2994d9 7 * @brief Header file for component VL6180X
gallonm 1:1de1ea2994d9 8 ******************************************************************************
gallonm 1:1de1ea2994d9 9 * @attention
gallonm 1:1de1ea2994d9 10 *
gallonm 1:1de1ea2994d9 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
gallonm 1:1de1ea2994d9 12 *
gallonm 1:1de1ea2994d9 13 * Redistribution and use in source and binary forms, with or without modification,
gallonm 1:1de1ea2994d9 14 * are permitted provided that the following conditions are met:
gallonm 1:1de1ea2994d9 15 * 1. Redistributions of source code must retain the above copyright notice,
gallonm 1:1de1ea2994d9 16 * this list of conditions and the following disclaimer.
gallonm 1:1de1ea2994d9 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
gallonm 1:1de1ea2994d9 18 * this list of conditions and the following disclaimer in the documentation
gallonm 1:1de1ea2994d9 19 * and/or other materials provided with the distribution.
gallonm 1:1de1ea2994d9 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
gallonm 1:1de1ea2994d9 21 * may be used to endorse or promote products derived from this software
gallonm 1:1de1ea2994d9 22 * without specific prior written permission.
gallonm 1:1de1ea2994d9 23 *
gallonm 1:1de1ea2994d9 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
gallonm 1:1de1ea2994d9 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
gallonm 1:1de1ea2994d9 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
gallonm 1:1de1ea2994d9 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
gallonm 1:1de1ea2994d9 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
gallonm 1:1de1ea2994d9 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
gallonm 1:1de1ea2994d9 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
gallonm 1:1de1ea2994d9 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
gallonm 1:1de1ea2994d9 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
gallonm 1:1de1ea2994d9 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
gallonm 1:1de1ea2994d9 34 *
gallonm 1:1de1ea2994d9 35 ******************************************************************************
gallonm 1:1de1ea2994d9 36 */
gallonm 1:1de1ea2994d9 37
gallonm 1:1de1ea2994d9 38 #ifndef __VL6180X_CLASS_H
gallonm 1:1de1ea2994d9 39 #define __VL6180X_CLASS_H
gallonm 1:1de1ea2994d9 40
gallonm 1:1de1ea2994d9 41 /* Includes ------------------------------------------------------------------*/
gallonm 1:1de1ea2994d9 42 #include "RangeSensor.h"
gallonm 1:1de1ea2994d9 43 #include "LightSensor.h"
gallonm 10:4954b09b72d8 44 #include "DevI2C.h"
gallonm 10:4954b09b72d8 45 #include "vl6180x_api.h"
gallonm 10:4954b09b72d8 46 #include "vl6180x_cfg.h"
gallonm 10:4954b09b72d8 47 #include "vl6180x_def.h"
gallonm 10:4954b09b72d8 48 #include "vl6180x_types.h"
gallonm 1:1de1ea2994d9 49 #include "vl6180x_platform.h"
licio.mapelli@st.com 8:f943a1fca15f 50 //#include "vl6180x_appcfg.h"
gallonm 18:c98aa73dc4a5 51 #include "stmpe1600_class.h"
gallonm 1:1de1ea2994d9 52
gallonm 14:0effa0bbf192 53 /* data struct containing range measure, light measure and type of error provided to the user
gallonm 14:0effa0bbf192 54 in case of invalid data range_mm=0xFFFFFFFF and lux=0xFFFFFFFF */
gallonm 12:71d589e6fd2c 55 typedef struct MeasureData
gallonm 12:71d589e6fd2c 56 {
gallonm 16:0d4776564733 57 uint32_t range_mm;
gallonm 16:0d4776564733 58 uint32_t lux;
gallonm 16:0d4776564733 59 uint32_t range_error;
gallonm 16:0d4776564733 60 uint32_t als_error;
gallonm 16:0d4776564733 61 uint32_t int_error;
gallonm 12:71d589e6fd2c 62 }MeasureData_t;
gallonm 12:71d589e6fd2c 63
gallonm 12:71d589e6fd2c 64 /* sensor operating modes */
gallonm 12:71d589e6fd2c 65 typedef enum
gallonm 12:71d589e6fd2c 66 {
gallonm 16:0d4776564733 67 range_single_shot_polling=1,
gallonm 16:0d4776564733 68 als_single_shot_polling,
gallonm 16:0d4776564733 69 range_continuous_polling,
gallonm 16:0d4776564733 70 als_continuous_polling,
gallonm 16:0d4776564733 71 range_continuous_interrupt,
gallonm 16:0d4776564733 72 als_continuous_interrupt,
gallonm 16:0d4776564733 73 interleaved_mode_interrupt,
gallonm 16:0d4776564733 74 range_continuous_polling_low_threshold,
gallonm 16:0d4776564733 75 range_continuous_polling_high_threshold,
gallonm 16:0d4776564733 76 range_continuous_polling_out_of_window,
gallonm 16:0d4776564733 77 als_continuous_polling_low_threshold,
gallonm 16:0d4776564733 78 als_continuous_polling_high_threshold,
gallonm 16:0d4776564733 79 als_continuous_polling_out_of_window,
gallonm 16:0d4776564733 80 range_continuous_interrupt_low_threshold,
gallonm 26:db0cdc5ecc0a 81 range_continuous_interrupt_high_threshold,
gallonm 16:0d4776564733 82 range_continuous_interrupt_out_of_window,
gallonm 16:0d4776564733 83 als_continuous_interrupt_low_threshold,
gallonm 16:0d4776564733 84 als_continuous_interrupt_high_threshold,
gallonm 16:0d4776564733 85 als_continuous_interrupt_out_of_window,
gallonm 16:0d4776564733 86 range_continuous_als_single_shot,
gallonm 16:0d4776564733 87 range_single_shot_als_continuous,
gallonm 12:71d589e6fd2c 88 }OperatingMode;
gallonm 12:71d589e6fd2c 89
gallonm 4:a5abf7757947 90 /** default device address */
gallonm 4:a5abf7757947 91 #define DEFAULT_DEVICE_ADDRESS 0x29
gallonm 4:a5abf7757947 92
gallonm 1:1de1ea2994d9 93 /* Classes -------------------------------------------------------------------*/
gallonm 1:1de1ea2994d9 94 /** Class representing a VL6180X sensor component
gallonm 1:1de1ea2994d9 95 */
gallonm 7:2dc81120c917 96 class VL6180X : public RangeSensor, public LightSensor
gallonm 7:2dc81120c917 97 {
gallonm 1:1de1ea2994d9 98 public:
mapellil 30:75bf50276881 99 /** Constructor 1
mapellil 30:75bf50276881 100 * @param[in] &i2c device I2C to be used for communication
mapellil 30:75bf50276881 101 * @param[in] &pin Mbed DigitalOut pin to be used as component GPIO_0 CE
mapellil 30:75bf50276881 102 * @param[in] pin_gpio1 pin Mbed InterruptIn PinName to be used as component GPIO_1 INT
mapellil 30:75bf50276881 103 * @param[in] DevAddr device address, 0x29 by default
gallonm 1:1de1ea2994d9 104 */
mapellil 32:ef97c377d27b 105 VL6180X(DevI2C &i2c, DigitalOut &pin, PinName pin_gpio1, uint8_t DevAddr=DEFAULT_DEVICE_ADDRESS) : RangeSensor(), LightSensor(), dev_i2c(i2c), gpio0(&pin), gpio1Int(pin_gpio1)
gallonm 16:0d4776564733 106 {
gallonm 16:0d4776564733 107 MyDevice.I2cAddr=DevAddr;
gallonm 16:0d4776564733 108 MyDevice.Present=0;
gallonm 16:0d4776564733 109 MyDevice.Ready=0;
gallonm 16:0d4776564733 110 Device=&MyDevice;;
gallonm 16:0d4776564733 111 expgpio0=NULL;
gallonm 16:0d4776564733 112 }
mapellil 30:75bf50276881 113 /** Constructor 2
mapellil 30:75bf50276881 114 * @param[in] i2c device I2C to be used for communication
mapellil 30:75bf50276881 115 * @param[in] &pin Gpio Expander STMPE1600DigiOut pin to be used as component GPIO_0 CE
mapellil 30:75bf50276881 116 * @param[in] pin_gpio1 pin Mbed InterruptIn PinName to be used as component GPIO_1 INT
mapellil 30:75bf50276881 117 * @param[in] device address, 0x29 by default
mapellil 30:75bf50276881 118 */
mapellil 32:ef97c377d27b 119 VL6180X(DevI2C &i2c, STMPE1600DigiOut &pin, PinName pin_gpio1, uint8_t DevAddr=DEFAULT_DEVICE_ADDRESS) : RangeSensor(), LightSensor(), dev_i2c(i2c), expgpio0(&pin), gpio1Int(pin_gpio1)
gallonm 16:0d4776564733 120 {
gallonm 16:0d4776564733 121 MyDevice.I2cAddr=DevAddr;
gallonm 16:0d4776564733 122 MyDevice.Present=0;
gallonm 16:0d4776564733 123 MyDevice.Ready=0;
gallonm 16:0d4776564733 124 Device=&MyDevice;
gallonm 16:0d4776564733 125 gpio0=NULL;
gallonm 16:0d4776564733 126 }
gallonm 4:a5abf7757947 127
gallonm 7:2dc81120c917 128 /** Destructor
gallonm 7:2dc81120c917 129 */
mapellil 31:f99c53a51917 130 virtual ~VL6180X(){}
gallonm 28:7c9031e96c22 131 /* warning: VL6180X class inherits from GenericSensor, RangeSensor and LightSensor, that haven`t a destructor.
gallonm 23:dfb5ccc7b780 132 The warning should request to introduce a virtual destructor to make sure to delete the object */
mapellil 31:f99c53a51917 133
mapellil 31:f99c53a51917 134 /*** Interface Methods ***/
mapellil 32:ef97c377d27b 135 /*** High level API ***/
mapellil 31:f99c53a51917 136 /**
mapellil 31:f99c53a51917 137 * @brief PowerOn the sensor
mapellil 31:f99c53a51917 138 * @return void
mapellil 31:f99c53a51917 139 */
gallonm 14:0effa0bbf192 140 /* turns on the sensor */
gallonm 16:0d4776564733 141 void VL6180x_On(void)
gallonm 16:0d4776564733 142 {
gallonm 16:0d4776564733 143 if(gpio0)
gallonm 16:0d4776564733 144 *gpio0=1;
gallonm 16:0d4776564733 145 else if(expgpio0)
gallonm 16:0d4776564733 146 *expgpio0=1;
gallonm 16:0d4776564733 147 }
mapellil 31:f99c53a51917 148
mapellil 31:f99c53a51917 149 /**
mapellil 31:f99c53a51917 150 * @brief PowerOff the sensor
mapellil 31:f99c53a51917 151 * @return void
mapellil 31:f99c53a51917 152 */
gallonm 16:0d4776564733 153 /* turns off the sensor */
gallonm 14:0effa0bbf192 154 void VL6180x_Off(void)
gallonm 16:0d4776564733 155 {
gallonm 16:0d4776564733 156 if(gpio0)
gallonm 16:0d4776564733 157 *gpio0=0;
gallonm 16:0d4776564733 158 else if(expgpio0)
gallonm 16:0d4776564733 159 *expgpio0=0;
gallonm 16:0d4776564733 160 }
mapellil 31:f99c53a51917 161
mapellil 31:f99c53a51917 162 /**
mapellil 31:f99c53a51917 163 * @brief Initialize the sensor with default values
mapellil 31:f99c53a51917 164 * @return 0 on Success
mapellil 31:f99c53a51917 165 */
gallonm 16:0d4776564733 166 int InitSensor(uint8_t NewAddr);
mapellil 31:f99c53a51917 167
mapellil 31:f99c53a51917 168 /**
mapellil 31:f99c53a51917 169 * @brief Start the measure indicated by operating mode
mapellil 31:f99c53a51917 170 * @param[in] operating_mode specifies requested measure
mapellil 32:ef97c377d27b 171 * @param[in] fptr specifies call back function must be !NULL in case of interrupt measure
mapellil 32:ef97c377d27b 172 * @param[in] low specifies measure low threashold in Lux or in mm according to measure
mapellil 32:ef97c377d27b 173 * @param[in] high specifies measure high threashold in Lux or in mm according to measure
mapellil 31:f99c53a51917 174 * @return 0 on Success
mapellil 31:f99c53a51917 175 */
gallonm 24:025afc3fe30f 176 int StartMeasurement(OperatingMode operating_mode, void (*fptr)(void), uint16_t low, uint16_t high);
gallonm 12:71d589e6fd2c 177
mapellil 31:f99c53a51917 178 /**
mapellil 31:f99c53a51917 179 * @brief Get results for the measure indicated by operating mode
mapellil 31:f99c53a51917 180 * @param[in] operating_mode specifies requested measure results
mapellil 31:f99c53a51917 181 * @param[out] Data pointer to the MeasureData_t structure to read data in to
mapellil 31:f99c53a51917 182 * @return 0 on Success
mapellil 31:f99c53a51917 183 */
mapellil 31:f99c53a51917 184 int GetMeasurement(OperatingMode operating_mode, MeasureData_t *Data);
mapellil 31:f99c53a51917 185
mapellil 31:f99c53a51917 186 /**
mapellil 31:f99c53a51917 187 * @brief Stop the currently running measure indicate by operating_mode
mapellil 31:f99c53a51917 188 * @param[in] operating_mode specifies requested measure to stop
mapellil 31:f99c53a51917 189 * @return 0 on Success
mapellil 31:f99c53a51917 190 */
mapellil 31:f99c53a51917 191 int StopMeasurement(OperatingMode operating_mode);
mapellil 31:f99c53a51917 192
mapellil 32:ef97c377d27b 193 /**
mapellil 32:ef97c377d27b 194 * @brief Interrupt handling func to be called by user after an INT is occourred
mapellil 32:ef97c377d27b 195 * @param[in] opeating_mode indicating the in progress measure
mapellil 32:ef97c377d27b 196 * @param[out] Data pointer to the MeasureData_t structure to read data in to
mapellil 31:f99c53a51917 197 * @return 0 on Success
mapellil 32:ef97c377d27b 198 */
mapellil 32:ef97c377d27b 199 int HandleIRQ(OperatingMode operating_mode, MeasureData_t *Data);
gallonm 12:71d589e6fd2c 200
mapellil 31:f99c53a51917 201 /**
mapellil 31:f99c53a51917 202 * @brief Enable interrupt measure IRQ
mapellil 31:f99c53a51917 203 * @return 0 on Success
mapellil 31:f99c53a51917 204 */
gallonm 16:0d4776564733 205 void EnableInterruptMeasureDetectionIRQ(void)
gallonm 16:0d4776564733 206 {
mapellil 32:ef97c377d27b 207 gpio1Int.enable_irq();
gallonm 16:0d4776564733 208 }
gallonm 12:71d589e6fd2c 209
mapellil 31:f99c53a51917 210 /**
mapellil 31:f99c53a51917 211 * @brief Disable interrupt measure IRQ
mapellil 31:f99c53a51917 212 * @return 0 on Success
mapellil 31:f99c53a51917 213 */
gallonm 16:0d4776564733 214 void DisableInterruptMeasureDetectionIRQ(void)
gallonm 16:0d4776564733 215 {
mapellil 32:ef97c377d27b 216 gpio1Int.disable_irq();
mapellil 32:ef97c377d27b 217 }
mapellil 32:ef97c377d27b 218 /*** End High level API ***/
mapellil 32:ef97c377d27b 219
mapellil 32:ef97c377d27b 220 /**
mapellil 32:ef97c377d27b 221 * @brief Attach a function to call when an interrupt is detected, i.e. measurement is ready
mapellil 32:ef97c377d27b 222 * @param[in] fptr pointer to call back function to be called whenever an interrupt occours
mapellil 32:ef97c377d27b 223 * @return 0 on Success
mapellil 32:ef97c377d27b 224 */
mapellil 32:ef97c377d27b 225 void AttachInterruptMeasureDetectionIRQ(void (*fptr)(void))
mapellil 32:ef97c377d27b 226 {
mapellil 32:ef97c377d27b 227 gpio1Int.rise(fptr);
gallonm 16:0d4776564733 228 }
mapellil 31:f99c53a51917 229
mapellil 31:f99c53a51917 230 /**
mapellil 31:f99c53a51917 231 * @brief Check the sensor presence
mapellil 31:f99c53a51917 232 * @return 1 when device is present
mapellil 31:f99c53a51917 233 */
gallonm 16:0d4776564733 234 unsigned Present()
gallonm 16:0d4776564733 235 {
gallonm 16:0d4776564733 236 return Device->Present;
gallonm 16:0d4776564733 237 }
gallonm 15:454710d17358 238
mapellil 32:ef97c377d27b 239 /** Wrapper functions */
mapellil 32:ef97c377d27b 240
mapellil 32:ef97c377d27b 241 /**
mapellil 32:ef97c377d27b 242 * @brief Wait sensor to boot
mapellil 32:ef97c377d27b 243 * @return 0 when device is booted
mapellil 32:ef97c377d27b 244 */
gallonm 16:0d4776564733 245 int WaitDeviceBooted()
gallonm 16:0d4776564733 246 {
gallonm 16:0d4776564733 247 return VL6180x_WaitDeviceBooted(Device);
gallonm 16:0d4776564733 248 }
gallonm 12:71d589e6fd2c 249
gallonm 16:0d4776564733 250 int Init()
gallonm 12:71d589e6fd2c 251 {
gallonm 12:71d589e6fd2c 252 return VL6180x_InitData(Device);
gallonm 12:71d589e6fd2c 253 }
gallonm 12:71d589e6fd2c 254
gallonm 16:0d4776564733 255 int SetupGPIO1(uint8_t InitFunction, int ActiveHigh)
gallonm 16:0d4776564733 256 {
gallonm 16:0d4776564733 257 return VL6180x_SetupGPIO1(Device, InitFunction, ActiveHigh);
gallonm 16:0d4776564733 258 }
gallonm 10:4954b09b72d8 259
gallonm 16:0d4776564733 260 int Prepare()
gallonm 16:0d4776564733 261 {
gallonm 16:0d4776564733 262 return VL6180x_Prepare(Device);
gallonm 16:0d4776564733 263 }
gallonm 10:4954b09b72d8 264
gallonm 16:0d4776564733 265 int RangeStartContinuousMode()
gallonm 16:0d4776564733 266 {
gallonm 16:0d4776564733 267 return VL6180x_RangeStartContinuousMode(Device);
gallonm 16:0d4776564733 268 }
gallonm 12:71d589e6fd2c 269
gallonm 16:0d4776564733 270 int RangeStartSingleShot()
gallonm 16:0d4776564733 271 {
gallonm 16:0d4776564733 272 return VL6180x_RangeStartSingleShot(Device);
gallonm 16:0d4776564733 273 }
gallonm 12:71d589e6fd2c 274
gallonm 16:0d4776564733 275 int RangeSetMaxConvergenceTime(uint8_t MaxConTime_msec)
gallonm 16:0d4776564733 276 {
gallonm 16:0d4776564733 277 return VL6180x_RangeSetMaxConvergenceTime(Device, MaxConTime_msec);
gallonm 16:0d4776564733 278 }
gallonm 12:71d589e6fd2c 279
gallonm 16:0d4776564733 280 int RangePollMeasurement(VL6180x_RangeData_t *pRangeData)
gallonm 16:0d4776564733 281 {
gallonm 16:0d4776564733 282 return VL6180x_RangePollMeasurement(Device, pRangeData);
gallonm 16:0d4776564733 283 }
gallonm 12:71d589e6fd2c 284
gallonm 16:0d4776564733 285 int RangeGetMeasurementIfReady(VL6180x_RangeData_t *pRangeData)
gallonm 16:0d4776564733 286 {
gallonm 16:0d4776564733 287 return VL6180x_RangeGetMeasurementIfReady(Device, pRangeData);
gallonm 16:0d4776564733 288 }
gallonm 12:71d589e6fd2c 289
gallonm 16:0d4776564733 290 int RangeGetMeasurement(VL6180x_RangeData_t *pRangeData)
gallonm 16:0d4776564733 291 {
gallonm 16:0d4776564733 292 return VL6180x_RangeGetMeasurement(Device, pRangeData);
gallonm 16:0d4776564733 293 }
gallonm 12:71d589e6fd2c 294
gallonm 16:0d4776564733 295 int GetRange(int32_t *piData)
gallonm 16:0d4776564733 296 {
gallonm 16:0d4776564733 297 return VL6180x_RangeGetResult(Device, piData);
gallonm 16:0d4776564733 298 }
gallonm 12:71d589e6fd2c 299
gallonm 16:0d4776564733 300 int RangeConfigInterrupt(uint8_t ConfigGpioInt)
gallonm 16:0d4776564733 301 {
gallonm 16:0d4776564733 302 return VL6180x_RangeConfigInterrupt(Device, ConfigGpioInt);
gallonm 16:0d4776564733 303 }
gallonm 12:71d589e6fd2c 304
gallonm 16:0d4776564733 305 int RangeGetInterruptStatus(uint8_t *pIntStatus)
gallonm 16:0d4776564733 306 {
gallonm 16:0d4776564733 307 return VL6180x_RangeGetInterruptStatus(Device, pIntStatus);
gallonm 16:0d4776564733 308 }
gallonm 12:71d589e6fd2c 309
gallonm 16:0d4776564733 310 int AlsPollMeasurement(VL6180x_AlsData_t *pAlsData)
gallonm 16:0d4776564733 311 {
gallonm 16:0d4776564733 312 return VL6180x_AlsPollMeasurement(Device, pAlsData);
gallonm 16:0d4776564733 313 }
gallonm 12:71d589e6fd2c 314
gallonm 16:0d4776564733 315 int AlsGetMeasurement(VL6180x_AlsData_t *pAlsData)
gallonm 16:0d4776564733 316 {
gallonm 16:0d4776564733 317 return VL6180x_AlsGetMeasurement(Device, pAlsData);
gallonm 16:0d4776564733 318 }
gallonm 12:71d589e6fd2c 319
gallonm 16:0d4776564733 320 int AlsConfigInterrupt(uint8_t ConfigGpioInt)
gallonm 16:0d4776564733 321 {
gallonm 16:0d4776564733 322 return VL6180x_AlsConfigInterrupt(Device, ConfigGpioInt);
gallonm 16:0d4776564733 323 }
gallonm 12:71d589e6fd2c 324
gallonm 16:0d4776564733 325 int AlsSetIntegrationPeriod(uint16_t period_ms)
gallonm 16:0d4776564733 326 {
gallonm 12:71d589e6fd2c 327 return VL6180x_AlsSetIntegrationPeriod(Device, period_ms);
gallonm 16:0d4776564733 328 }
gallonm 12:71d589e6fd2c 329
gallonm 16:0d4776564733 330 int AlsSetInterMeasurementPeriod(uint16_t intermeasurement_period_ms)
gallonm 16:0d4776564733 331 {
gallonm 12:71d589e6fd2c 332 return VL6180x_AlsSetInterMeasurementPeriod(Device, intermeasurement_period_ms);
gallonm 12:71d589e6fd2c 333 }
gallonm 12:71d589e6fd2c 334
gallonm 12:71d589e6fd2c 335 int AlsSetAnalogueGain(uint8_t gain)
gallonm 16:0d4776564733 336 {
gallonm 16:0d4776564733 337 return VL6180x_AlsSetAnalogueGain(Device, gain);
gallonm 16:0d4776564733 338 }
gallonm 12:71d589e6fd2c 339
gallonm 28:7c9031e96c22 340 int AlsSetThresholds(uint16_t lux_threshold_low, uint16_t lux_threshold_high);
gallonm 12:71d589e6fd2c 341
gallonm 12:71d589e6fd2c 342 int AlsGetInterruptStatus(uint8_t *pIntStatus)
gallonm 28:7c9031e96c22 343 {
gallonm 12:71d589e6fd2c 344 return VL6180x_AlsGetInterruptStatus(Device, pIntStatus);
gallonm 12:71d589e6fd2c 345 }
gallonm 12:71d589e6fd2c 346
gallonm 12:71d589e6fd2c 347 int StaticInit()
gallonm 16:0d4776564733 348 {
gallonm 16:0d4776564733 349 return VL6180x_StaticInit(Device);
gallonm 16:0d4776564733 350 }
gallonm 12:71d589e6fd2c 351
gallonm 16:0d4776564733 352 int RangeWaitDeviceReady(int MaxLoop )
gallonm 16:0d4776564733 353 {
gallonm 16:0d4776564733 354 return VL6180x_RangeWaitDeviceReady(Device, MaxLoop);
gallonm 16:0d4776564733 355 }
gallonm 12:71d589e6fd2c 356
gallonm 16:0d4776564733 357 int RangeSetInterMeasPeriod(uint32_t InterMeasTime_msec)
gallonm 16:0d4776564733 358 {
gallonm 16:0d4776564733 359 return VL6180x_RangeSetInterMeasPeriod(Device, InterMeasTime_msec);
gallonm 16:0d4776564733 360 }
gallonm 12:71d589e6fd2c 361
gallonm 16:0d4776564733 362 int UpscaleSetScaling(uint8_t scaling)
gallonm 16:0d4776564733 363 {
gallonm 16:0d4776564733 364 return VL6180x_UpscaleSetScaling(Device, scaling);
gallonm 16:0d4776564733 365 }
gallonm 12:71d589e6fd2c 366
gallonm 16:0d4776564733 367 int UpscaleGetScaling()
gallonm 16:0d4776564733 368 {
gallonm 16:0d4776564733 369 return VL6180x_UpscaleGetScaling(Device);
gallonm 16:0d4776564733 370 }
gallonm 12:71d589e6fd2c 371
gallonm 16:0d4776564733 372 uint16_t GetUpperLimit()
gallonm 16:0d4776564733 373 {
gallonm 16:0d4776564733 374 return VL6180x_GetUpperLimit(Device);
gallonm 16:0d4776564733 375 }
gallonm 12:71d589e6fd2c 376
gallonm 16:0d4776564733 377 int RangeSetThresholds(uint16_t low, uint16_t high, int SafeHold)
gallonm 16:0d4776564733 378 {
gallonm 16:0d4776564733 379 return VL6180x_RangeSetThresholds(Device, low, high, SafeHold);
gallonm 16:0d4776564733 380 }
gallonm 12:71d589e6fd2c 381
gallonm 16:0d4776564733 382 int RangeGetThresholds(uint16_t *low, uint16_t *high)
gallonm 16:0d4776564733 383 {
gallonm 16:0d4776564733 384 return VL6180x_RangeGetThresholds(Device, low, high);
gallonm 16:0d4776564733 385 }
gallonm 12:71d589e6fd2c 386
gallonm 16:0d4776564733 387 int RangeSetRawThresholds(uint8_t low, uint8_t high)
gallonm 16:0d4776564733 388 {
gallonm 16:0d4776564733 389 return VL6180x_RangeSetRawThresholds(Device, low, high);
gallonm 16:0d4776564733 390 }
gallonm 12:71d589e6fd2c 391
gallonm 16:0d4776564733 392 int RangeSetEceFactor(uint16_t FactorM, uint16_t FactorD)
gallonm 16:0d4776564733 393 {
gallonm 16:0d4776564733 394 return VL6180x_RangeSetEceFactor(Device, FactorM, FactorD);
gallonm 16:0d4776564733 395 }
gallonm 12:71d589e6fd2c 396
gallonm 16:0d4776564733 397 int RangeSetEceState(int enable)
gallonm 16:0d4776564733 398 {
gallonm 16:0d4776564733 399 return VL6180x_RangeSetEceState(Device, enable);
gallonm 16:0d4776564733 400 }
gallonm 12:71d589e6fd2c 401
gallonm 16:0d4776564733 402 int FilterSetState(int state)
gallonm 16:0d4776564733 403 {
gallonm 16:0d4776564733 404 return VL6180x_FilterSetState(Device, state);
gallonm 16:0d4776564733 405 }
gallonm 12:71d589e6fd2c 406
gallonm 16:0d4776564733 407 int FilterGetState()
gallonm 16:0d4776564733 408 {
gallonm 16:0d4776564733 409 return VL6180x_FilterGetState(Device);
gallonm 16:0d4776564733 410 }
gallonm 12:71d589e6fd2c 411
gallonm 16:0d4776564733 412 int DMaxSetState(int state)
gallonm 16:0d4776564733 413 {
gallonm 16:0d4776564733 414 return VL6180x_DMaxSetState(Device, state);
gallonm 16:0d4776564733 415 }
gallonm 12:71d589e6fd2c 416
gallonm 16:0d4776564733 417 int DMaxGetState()
gallonm 16:0d4776564733 418 {
gallonm 16:0d4776564733 419 return VL6180x_DMaxGetState(Device);
gallonm 16:0d4776564733 420 }
gallonm 12:71d589e6fd2c 421
gallonm 16:0d4776564733 422 int RangeSetSystemMode(uint8_t mode)
gallonm 16:0d4776564733 423 {
gallonm 16:0d4776564733 424 return VL6180x_RangeSetSystemMode(Device, mode);
gallonm 16:0d4776564733 425 }
gallonm 12:71d589e6fd2c 426
gallonm 16:0d4776564733 427 int8_t GetOffsetCalibrationData()
gallonm 16:0d4776564733 428 {
gallonm 16:0d4776564733 429 return VL6180x_GetOffsetCalibrationData(Device);
gallonm 16:0d4776564733 430 }
gallonm 12:71d589e6fd2c 431
gallonm 16:0d4776564733 432 void SetOffsetCalibrationData(int8_t offset)
gallonm 16:0d4776564733 433 {
gallonm 16:0d4776564733 434 return VL6180x_SetOffsetCalibrationData(Device, offset);
gallonm 16:0d4776564733 435 }
gallonm 12:71d589e6fd2c 436
gallonm 16:0d4776564733 437 int SetXTalkCompensationRate(FixPoint97_t Rate)
gallonm 16:0d4776564733 438 {
gallonm 16:0d4776564733 439 return VL6180x_SetXTalkCompensationRate(Device, Rate);
gallonm 16:0d4776564733 440 }
gallonm 12:71d589e6fd2c 441
gallonm 16:0d4776564733 442 int AlsWaitDeviceReady(int MaxLoop)
gallonm 16:0d4776564733 443 {
gallonm 16:0d4776564733 444 return VL6180x_AlsWaitDeviceReady(Device, MaxLoop);
gallonm 16:0d4776564733 445 }
gallonm 12:71d589e6fd2c 446
gallonm 16:0d4776564733 447 int AlsSetSystemMode(uint8_t mode)
gallonm 16:0d4776564733 448 {
gallonm 16:0d4776564733 449 return VL6180x_AlsSetSystemMode(Device, mode);
gallonm 16:0d4776564733 450 }
gallonm 12:71d589e6fd2c 451
gallonm 16:0d4776564733 452 int SetGroupParamHold(int Hold)
gallonm 16:0d4776564733 453 {
gallonm 16:0d4776564733 454 return VL6180x_SetGroupParamHold(Device, Hold);
gallonm 16:0d4776564733 455 }
gallonm 12:71d589e6fd2c 456
gallonm 16:0d4776564733 457 int SetI2CAddress(int NewAddr)
gallonm 16:0d4776564733 458 {
gallonm 16:0d4776564733 459 int status;
gallonm 10:4954b09b72d8 460
gallonm 16:0d4776564733 461 status=VL6180x_SetI2CAddress(Device, NewAddr);
gallonm 16:0d4776564733 462 if(!status)
gallonm 16:0d4776564733 463 Device->I2cAddr=NewAddr;
gallonm 16:0d4776564733 464 return status;
gallonm 16:0d4776564733 465 }
gallonm 10:4954b09b72d8 466
gallonm 16:0d4776564733 467 int SetupGPIOx(int pin, uint8_t IntFunction, int ActiveHigh)
gallonm 16:0d4776564733 468 {
gallonm 16:0d4776564733 469 return VL6180x_SetupGPIOx(Device, pin, IntFunction, ActiveHigh);
gallonm 16:0d4776564733 470 }
gallonm 10:4954b09b72d8 471
gallonm 16:0d4776564733 472 int SetGPIOxPolarity(int pin, int active_high)
gallonm 16:0d4776564733 473 {
gallonm 16:0d4776564733 474 return VL6180x_SetGPIOxPolarity(Device, pin, active_high);
gallonm 16:0d4776564733 475 }
gallonm 12:71d589e6fd2c 476
gallonm 16:0d4776564733 477 int SetGPIOxFunctionality(int pin, uint8_t functionality)
gallonm 16:0d4776564733 478 {
gallonm 16:0d4776564733 479 return VL6180x_SetGPIOxFunctionality(Device, pin, functionality);
gallonm 16:0d4776564733 480 }
gallonm 12:71d589e6fd2c 481
gallonm 16:0d4776564733 482 int DisableGPIOxOut(int pin)
gallonm 16:0d4776564733 483 {
gallonm 16:0d4776564733 484 return VL6180x_DisableGPIOxOut(Device, pin);
gallonm 16:0d4776564733 485 }
gallonm 10:4954b09b72d8 486
gallonm 16:0d4776564733 487 int GetInterruptStatus(uint8_t *status)
gallonm 16:0d4776564733 488 {
gallonm 16:0d4776564733 489 return VL6180x_GetInterruptStatus(Device, status);
gallonm 16:0d4776564733 490 }
gallonm 12:71d589e6fd2c 491
gallonm 16:0d4776564733 492 int ClearInterrupt(uint8_t IntClear)
gallonm 16:0d4776564733 493 {
gallonm 16:0d4776564733 494 return VL6180x_ClearInterrupt(Device, IntClear );
gallonm 16:0d4776564733 495 }
gallonm 12:71d589e6fd2c 496
gallonm 16:0d4776564733 497 int GetLight(uint32_t *piData)
gallonm 16:0d4776564733 498 {
gallonm 16:0d4776564733 499 return VL6180x_AlsGetLux(Device, piData);
gallonm 16:0d4776564733 500 }
gallonm 12:71d589e6fd2c 501
gallonm 16:0d4776564733 502 int AlsStartContinuousMode()
gallonm 16:0d4776564733 503 {
gallonm 16:0d4776564733 504 return VL6180x_AlsSetSystemMode(Device, MODE_START_STOP|MODE_CONTINUOUS);
gallonm 16:0d4776564733 505 }
gallonm 24:025afc3fe30f 506
gallonm 24:025afc3fe30f 507 int AlsStartSingleShot()
gallonm 24:025afc3fe30f 508 {
gallonm 24:025afc3fe30f 509 return VL6180x_AlsSetSystemMode(Device, MODE_START_STOP|MODE_SINGLESHOT);
gallonm 24:025afc3fe30f 510 }
gallonm 12:71d589e6fd2c 511
gallonm 16:0d4776564733 512 private:
gallonm 16:0d4776564733 513 /* api.h functions */
gallonm 16:0d4776564733 514 int VL6180x_WaitDeviceBooted(VL6180xDev_t dev);
gallonm 16:0d4776564733 515 int VL6180x_InitData(VL6180xDev_t dev );
gallonm 16:0d4776564733 516 int VL6180x_SetupGPIO1(VL6180xDev_t dev, uint8_t IntFunction, int ActiveHigh);
gallonm 16:0d4776564733 517 int VL6180x_Prepare(VL6180xDev_t dev);
gallonm 16:0d4776564733 518 int VL6180x_RangeStartContinuousMode(VL6180xDev_t dev);
gallonm 16:0d4776564733 519 int VL6180x_RangeStartSingleShot(VL6180xDev_t dev);
gallonm 16:0d4776564733 520 int VL6180x_RangeSetMaxConvergenceTime(VL6180xDev_t dev, uint8_t MaxConTime_msec);
gallonm 16:0d4776564733 521 int VL6180x_RangePollMeasurement(VL6180xDev_t dev, VL6180x_RangeData_t *pRangeData);
gallonm 16:0d4776564733 522 int VL6180x_RangeGetMeasurementIfReady(VL6180xDev_t dev, VL6180x_RangeData_t *pRangeData);
gallonm 16:0d4776564733 523 int VL6180x_RangeGetMeasurement(VL6180xDev_t dev, VL6180x_RangeData_t *pRangeData);
gallonm 16:0d4776564733 524 int VL6180x_RangeGetResult(VL6180xDev_t dev, int32_t *pRange_mm);
gallonm 16:0d4776564733 525 int VL6180x_RangeConfigInterrupt(VL6180xDev_t dev, uint8_t ConfigGpioInt);
gallonm 16:0d4776564733 526 int VL6180x_RangeGetInterruptStatus(VL6180xDev_t dev, uint8_t *pIntStatus);
gallonm 16:0d4776564733 527 int VL6180x_AlsPollMeasurement(VL6180xDev_t dev, VL6180x_AlsData_t *pAlsData);
gallonm 16:0d4776564733 528 int VL6180x_AlsGetMeasurement(VL6180xDev_t dev, VL6180x_AlsData_t *pAlsData);
gallonm 16:0d4776564733 529 int VL6180x_AlsConfigInterrupt(VL6180xDev_t dev, uint8_t ConfigGpioInt);
gallonm 16:0d4776564733 530 int VL6180x_AlsSetIntegrationPeriod(VL6180xDev_t dev, uint16_t period_ms);
gallonm 16:0d4776564733 531 int VL6180x_AlsSetInterMeasurementPeriod(VL6180xDev_t dev, uint16_t intermeasurement_period_ms);
gallonm 16:0d4776564733 532 int VL6180x_AlsSetAnalogueGain(VL6180xDev_t dev, uint8_t gain);
gallonm 28:7c9031e96c22 533 int VL6180x_AlsSetThresholds(VL6180xDev_t dev, uint16_t low, uint16_t high);
gallonm 16:0d4776564733 534 int VL6180x_AlsGetInterruptStatus(VL6180xDev_t dev, uint8_t *pIntStatus);
gallonm 16:0d4776564733 535 int VL6180x_StaticInit(VL6180xDev_t dev);
gallonm 16:0d4776564733 536 int VL6180x_RangeWaitDeviceReady(VL6180xDev_t dev, int MaxLoop );
gallonm 16:0d4776564733 537 int VL6180x_RangeSetInterMeasPeriod(VL6180xDev_t dev, uint32_t InterMeasTime_msec);
gallonm 16:0d4776564733 538 int VL6180x_UpscaleSetScaling(VL6180xDev_t dev, uint8_t scaling);
gallonm 16:0d4776564733 539 int VL6180x_UpscaleGetScaling(VL6180xDev_t dev);
gallonm 16:0d4776564733 540 uint16_t VL6180x_GetUpperLimit(VL6180xDev_t dev);
gallonm 16:0d4776564733 541 int VL6180x_RangeSetThresholds(VL6180xDev_t dev, uint16_t low, uint16_t high, int SafeHold);
gallonm 16:0d4776564733 542 int VL6180x_RangeGetThresholds(VL6180xDev_t dev, uint16_t *low, uint16_t *high);
gallonm 16:0d4776564733 543 int VL6180x_RangeSetRawThresholds(VL6180xDev_t dev, uint8_t low, uint8_t high);
gallonm 16:0d4776564733 544 int VL6180x_RangeSetEceFactor(VL6180xDev_t dev, uint16_t FactorM, uint16_t FactorD);
gallonm 16:0d4776564733 545 int VL6180x_RangeSetEceState(VL6180xDev_t dev, int enable );
gallonm 16:0d4776564733 546 int VL6180x_FilterSetState(VL6180xDev_t dev, int state);
gallonm 16:0d4776564733 547 int VL6180x_FilterGetState(VL6180xDev_t dev);
gallonm 16:0d4776564733 548 int VL6180x_DMaxSetState(VL6180xDev_t dev, int state);
gallonm 16:0d4776564733 549 int VL6180x_DMaxGetState(VL6180xDev_t dev);
gallonm 16:0d4776564733 550 int VL6180x_RangeSetSystemMode(VL6180xDev_t dev, uint8_t mode);
gallonm 16:0d4776564733 551 int8_t VL6180x_GetOffsetCalibrationData(VL6180xDev_t dev);
gallonm 16:0d4776564733 552 void VL6180x_SetOffsetCalibrationData(VL6180xDev_t dev, int8_t offset);
gallonm 16:0d4776564733 553 int VL6180x_SetXTalkCompensationRate(VL6180xDev_t dev, FixPoint97_t Rate);
gallonm 16:0d4776564733 554 int VL6180x_AlsWaitDeviceReady(VL6180xDev_t dev, int MaxLoop );
gallonm 16:0d4776564733 555 int VL6180x_AlsSetSystemMode(VL6180xDev_t dev, uint8_t mode);
gallonm 16:0d4776564733 556 int VL6180x_SetGroupParamHold(VL6180xDev_t dev, int Hold);
gallonm 16:0d4776564733 557 int VL6180x_SetI2CAddress(VL6180xDev_t dev, uint8_t NewAddr);
gallonm 16:0d4776564733 558 int VL6180x_SetupGPIOx(VL6180xDev_t dev, int pin, uint8_t IntFunction, int ActiveHigh);
gallonm 16:0d4776564733 559 int VL6180x_SetGPIOxPolarity(VL6180xDev_t dev, int pin, int active_high);
gallonm 16:0d4776564733 560 int VL6180x_SetGPIOxFunctionality(VL6180xDev_t dev, int pin, uint8_t functionality);
gallonm 16:0d4776564733 561 int VL6180x_DisableGPIOxOut(VL6180xDev_t dev, int pin);
gallonm 16:0d4776564733 562 int VL6180x_GetInterruptStatus(VL6180xDev_t dev, uint8_t *status);
gallonm 16:0d4776564733 563 int VL6180x_ClearInterrupt(VL6180xDev_t dev, uint8_t IntClear );
gallonm 12:71d589e6fd2c 564
gallonm 16:0d4776564733 565 /* Other functions defined in api.c */
gallonm 16:0d4776564733 566 int VL6180x_RangeStaticInit(VL6180xDev_t dev);
gallonm 16:0d4776564733 567 int VL6180x_UpscaleRegInit(VL6180xDev_t dev);
gallonm 16:0d4776564733 568 int VL6180x_UpscaleStaticInit(VL6180xDev_t dev);
gallonm 16:0d4776564733 569 int VL6180x_AlsGetLux(VL6180xDev_t dev, lux_t *pLux);
gallonm 16:0d4776564733 570 int _UpscaleInitPatch0(VL6180xDev_t dev);
gallonm 16:0d4776564733 571 int VL6180x_RangeGetDeviceReady(VL6180xDev_t dev, int * Ready);
gallonm 16:0d4776564733 572 int VL6180x_RangeSetEarlyConvergenceEestimateThreshold(VL6180xDev_t dev);
gallonm 16:0d4776564733 573 int32_t _GetAveTotalTime(VL6180xDev_t dev);
gallonm 16:0d4776564733 574 int32_t _filter_Start(VL6180xDev_t dev, uint16_t m_trueRange_mm, uint16_t m_rawRange_mm, uint32_t m_rtnSignalRate, uint32_t m_rtnAmbientRate, uint16_t errorCode);
gallonm 16:0d4776564733 575 int _filter_GetResult(VL6180xDev_t dev, VL6180x_RangeData_t *pRangeData);
gallonm 16:0d4776564733 576 int _GetRateResult(VL6180xDev_t dev, VL6180x_RangeData_t *pRangeData);
gallonm 16:0d4776564733 577 int _DMax_InitData(VL6180xDev_t dev);
gallonm 7:2dc81120c917 578
gallonm 10:4954b09b72d8 579 /* Read function of the ID device */
gallonm 10:4954b09b72d8 580 int ReadID();
gallonm 4:a5abf7757947 581
gallonm 4:a5abf7757947 582 /* Write and read functions from I2C */
gallonm 4:a5abf7757947 583 int VL6180x_WrByte(VL6180xDev_t dev, uint16_t index, uint8_t data);
gallonm 4:a5abf7757947 584 int VL6180x_WrWord(VL6180xDev_t dev, uint16_t index, uint16_t data);
gallonm 4:a5abf7757947 585 int VL6180x_WrDWord(VL6180xDev_t dev, uint16_t index, uint32_t data);
gallonm 4:a5abf7757947 586 int VL6180x_RdByte(VL6180xDev_t dev, uint16_t index, uint8_t *data);
gallonm 4:a5abf7757947 587 int VL6180x_RdWord(VL6180xDev_t dev, uint16_t index, uint16_t *data);
gallonm 4:a5abf7757947 588 int VL6180x_RdDWord(VL6180xDev_t dev, uint16_t index, uint32_t *data);
gallonm 16:0d4776564733 589 int VL6180x_UpdateByte(VL6180xDev_t dev, uint16_t index, uint8_t AndData, uint8_t OrData);
gallonm 4:a5abf7757947 590 int VL6180x_I2CWrite(uint8_t DeviceAddr, uint16_t RegisterAddr, uint8_t *pBuffer, uint16_t NumByteToWrite);
gallonm 4:a5abf7757947 591 int VL6180x_I2CRead(uint8_t DeviceAddr, uint16_t RegisterAddr, uint8_t *pBuffer, uint16_t NumByteToRead);
gallonm 14:0effa0bbf192 592
gallonm 14:0effa0bbf192 593
gallonm 16:0d4776564733 594 int IsPresent()
gallonm 16:0d4776564733 595 {
gallonm 16:0d4776564733 596 int status;
gallonm 14:0effa0bbf192 597
gallonm 16:0d4776564733 598 status=ReadID();
gallonm 14:0effa0bbf192 599 if(status)
gallonm 27:22c6f69967d9 600 VL6180x_ErrLog("Failed to read ID device. Device not present!\n\r");
gallonm 16:0d4776564733 601 return status;
gallonm 16:0d4776564733 602 }
gallonm 16:0d4776564733 603 int StopRangeMeasurement(OperatingMode operating_mode);
gallonm 16:0d4776564733 604 int StopAlsMeasurement(OperatingMode operating_mode);
gallonm 16:0d4776564733 605 int GetRangeMeas(OperatingMode operating_mode, MeasureData_t *Data);
gallonm 16:0d4776564733 606 int GetAlsMeas(OperatingMode operating_mode, MeasureData_t *Data);
gallonm 16:0d4776564733 607 int GetRangeAlsMeas(MeasureData_t *Data);
gallonm 16:0d4776564733 608 int RangeSetLowThreshold(uint16_t threshold);
gallonm 16:0d4776564733 609 int RangeSetHighThreshold(uint16_t threshold);
gallonm 16:0d4776564733 610 int AlsSetLowThreshold(uint16_t threshold);
gallonm 16:0d4776564733 611 int AlsSetHighThreshold(uint16_t threshold);
gallonm 16:0d4776564733 612 int GetRangeError(MeasureData_t *Data, VL6180x_RangeData_t RangeData);
gallonm 16:0d4776564733 613 int GetAlsError(MeasureData_t *Data, VL6180x_AlsData_t AlsData);
gallonm 24:025afc3fe30f 614 int RangeMeasPollSingleShot();
gallonm 24:025afc3fe30f 615 int AlsMeasPollSingleShot();
gallonm 16:0d4776564733 616 int RangeMeasPollContinuousMode();
gallonm 16:0d4776564733 617 int AlsMeasPollContinuousMode();
gallonm 16:0d4776564733 618 int AlsGetMeasurementIfReady(VL6180xDev_t dev, VL6180x_AlsData_t *pAlsData);
gallonm 16:0d4776564733 619 int RangeMeasIntContinuousMode(void (*fptr)(void));
gallonm 16:0d4776564733 620 int AlsMeasIntContinuousMode(void (*fptr)(void));
gallonm 16:0d4776564733 621 int InterleavedMode(void (*fptr)(void));
gallonm 16:0d4776564733 622 int StartInterleavedMode();
gallonm 26:db0cdc5ecc0a 623 int AlsGetThresholds(VL6180xDev_t dev, lux_t *low, lux_t *high);
licio.mapelli@st.com 9:9cbc1736f148 624
gallonm 10:4954b09b72d8 625
gallonm 1:1de1ea2994d9 626 /* IO Device */
gallonm 7:2dc81120c917 627 DevI2C &dev_i2c;
gallonm 10:4954b09b72d8 628 /* Digital out pin */
gallonm 7:2dc81120c917 629 DigitalOut *gpio0;
gallonm 10:4954b09b72d8 630 /* GPIO expander */
gallonm 10:4954b09b72d8 631 STMPE1600DigiOut *expgpio0;
gallonm 12:71d589e6fd2c 632 /* Measure detection IRQ */
mapellil 32:ef97c377d27b 633 InterruptIn gpio1Int;
gallonm 10:4954b09b72d8 634 /* Device data */
gallonm 10:4954b09b72d8 635 MyVL6180Dev_t MyDevice;
gallonm 10:4954b09b72d8 636 VL6180xDev_t Device;
gallonm 1:1de1ea2994d9 637 };
gallonm 1:1de1ea2994d9 638
gallonm 4:a5abf7757947 639 #endif // __VL6180X_CLASS_H