INSAT Mini Project
Dependencies: ST_INTERFACES X_NUCLEO_COMMON
Fork of X_NUCLEO_6180XA1 by
Components/VL6180X/vl6180x_class.h@12:71d589e6fd2c, 2015-10-13 (annotated)
- Committer:
- gallonm
- Date:
- Tue Oct 13 14:22:45 2015 +0200
- Revision:
- 12:71d589e6fd2c
- Parent:
- 11:88541229403e
- Child:
- 14:0effa0bbf192
Introduced virtual functions GetRange and GetLight of the sensor classes.
Fixed as wrapper functions of VL6180x_RangeGetResult and VL6180x_AlsGetLux.
Fixed a comment of the stmpe1600_class.h
Fixed the function InitSensor.
Introduced the function StartMeasurement to choose the operating mode.
Introduced the funcions RangeMeasPollSingleShot, AlsMeasPollSingleShot,
RangeMeasPollContinuousMode, AlsMeasPollContinuousMode, RangeMeasIntContinuousMode,
AlsMeasIntContinuousMode and InterleavedMode to manage different type of operating
mode.
Introduced the functions GetRangeError and GetAlsError to verify error measurement.
Introduced the functions GetRangeMeasContinuousMode and GetAlsMeasContinuousMode
to get the result of the measure in continuous mode.
Introduced the function StartInterleavedMode to start the interleaved mode.
Introduced the function HandleIRQ to manage the interrupt request.
Introduced MeasureData_t struct that contains the results of range and als measure
and related error (range, als and gpio).
Introduced enum OperatingMode and MeasureType.
Fixed the Vl6180x constructor, introducing the parameter PinName gpio1 needed to
interrupt_measure.
Introduced the wrapper functions.
Introducede InterruptIn interrupt_measure to handle the interrupt request.
Fixed the x_nucleo_6180xa1 constructor.
Fixed the object sensor_top.
Who changed what in which revision?
User | Revision | Line number | New 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 |
gallonm | 1:1de1ea2994d9 | 6 | * @date 14-April-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>© 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 | 7:2dc81120c917 | 51 | #include "STMPE1600_class.h" |
gallonm | 1:1de1ea2994d9 | 52 | |
gallonm | 12:71d589e6fd2c | 53 | /* data struct containing range measure, light measure and type of error provided to the user */ |
gallonm | 12:71d589e6fd2c | 54 | typedef struct MeasureData |
gallonm | 12:71d589e6fd2c | 55 | { |
gallonm | 12:71d589e6fd2c | 56 | int32_t range_mm; |
gallonm | 12:71d589e6fd2c | 57 | uint32_t lux; |
gallonm | 12:71d589e6fd2c | 58 | uint32_t range_error; |
gallonm | 12:71d589e6fd2c | 59 | uint32_t als_error; |
gallonm | 12:71d589e6fd2c | 60 | uint32_t int_error; |
gallonm | 12:71d589e6fd2c | 61 | }MeasureData_t; |
gallonm | 12:71d589e6fd2c | 62 | |
gallonm | 12:71d589e6fd2c | 63 | /* sensor operating modes */ |
gallonm | 12:71d589e6fd2c | 64 | typedef enum |
gallonm | 12:71d589e6fd2c | 65 | { |
gallonm | 12:71d589e6fd2c | 66 | range_single_shot_polling=1, |
gallonm | 12:71d589e6fd2c | 67 | als_single_shot_polling, |
gallonm | 12:71d589e6fd2c | 68 | range_continuous_polling, |
gallonm | 12:71d589e6fd2c | 69 | als_continuous_polling, |
gallonm | 12:71d589e6fd2c | 70 | range_continuous_interrupt, |
gallonm | 12:71d589e6fd2c | 71 | als_continuous_interrupt, |
gallonm | 12:71d589e6fd2c | 72 | range_continuous_als_single_shot, |
gallonm | 12:71d589e6fd2c | 73 | range_single_shot_als_continuous, |
gallonm | 12:71d589e6fd2c | 74 | interleaved_mode, |
gallonm | 12:71d589e6fd2c | 75 | }OperatingMode; |
gallonm | 12:71d589e6fd2c | 76 | |
gallonm | 12:71d589e6fd2c | 77 | /* type of sensor measurement */ |
gallonm | 12:71d589e6fd2c | 78 | typedef enum |
gallonm | 12:71d589e6fd2c | 79 | { |
gallonm | 12:71d589e6fd2c | 80 | range_measure=1, |
gallonm | 12:71d589e6fd2c | 81 | light_measure, |
gallonm | 12:71d589e6fd2c | 82 | light_range_measure, |
gallonm | 12:71d589e6fd2c | 83 | }MeasureType; |
gallonm | 12:71d589e6fd2c | 84 | |
gallonm | 12:71d589e6fd2c | 85 | |
gallonm | 4:a5abf7757947 | 86 | /** default device address */ |
gallonm | 4:a5abf7757947 | 87 | #define DEFAULT_DEVICE_ADDRESS 0x29 |
gallonm | 4:a5abf7757947 | 88 | |
gallonm | 1:1de1ea2994d9 | 89 | /* Classes -------------------------------------------------------------------*/ |
gallonm | 1:1de1ea2994d9 | 90 | /** Class representing a VL6180X sensor component |
gallonm | 1:1de1ea2994d9 | 91 | */ |
gallonm | 7:2dc81120c917 | 92 | class VL6180X : public RangeSensor, public LightSensor |
gallonm | 7:2dc81120c917 | 93 | { |
gallonm | 1:1de1ea2994d9 | 94 | public: |
gallonm | 1:1de1ea2994d9 | 95 | /** Constructor |
gallonm | 1:1de1ea2994d9 | 96 | * @param[in] i2c device I2C to be used for communication |
gallonm | 7:2dc81120c917 | 97 | * @param[in] digital out pin/STMPE1600DigiOut pin to be used for GPIO expander communication |
gallonm | 12:71d589e6fd2c | 98 | * @param[in] gpio1 pin |
gallonm | 12:71d589e6fd2c | 99 | * @param[in] device address, 0x29 by default |
gallonm | 1:1de1ea2994d9 | 100 | */ |
gallonm | 12:71d589e6fd2c | 101 | VL6180X(DevI2C &i2c, DigitalOut &pin, PinName pin_gpio1, uint8_t DevAddr=DEFAULT_DEVICE_ADDRESS) : RangeSensor(), LightSensor(), dev_i2c(i2c), gpio0(&pin), interrupt_measure(pin_gpio1) |
gallonm | 7:2dc81120c917 | 102 | { |
gallonm | 10:4954b09b72d8 | 103 | MyDevice.I2cAddr=DevAddr; |
gallonm | 10:4954b09b72d8 | 104 | MyDevice.Present=0; |
gallonm | 10:4954b09b72d8 | 105 | MyDevice.Ready=0; |
gallonm | 10:4954b09b72d8 | 106 | Device=&MyDevice;; |
gallonm | 10:4954b09b72d8 | 107 | expgpio0=NULL; |
gallonm | 7:2dc81120c917 | 108 | } |
gallonm | 10:4954b09b72d8 | 109 | |
gallonm | 12:71d589e6fd2c | 110 | VL6180X(DevI2C &i2c, STMPE1600DigiOut &pin, PinName pin_gpio1, uint8_t DevAddr=DEFAULT_DEVICE_ADDRESS) : RangeSensor(), LightSensor(), dev_i2c(i2c), expgpio0(&pin), interrupt_measure(pin_gpio1) |
gallonm | 7:2dc81120c917 | 111 | { |
gallonm | 10:4954b09b72d8 | 112 | MyDevice.I2cAddr=DevAddr; |
gallonm | 10:4954b09b72d8 | 113 | MyDevice.Present=0; |
gallonm | 10:4954b09b72d8 | 114 | MyDevice.Ready=0; |
gallonm | 10:4954b09b72d8 | 115 | Device=&MyDevice; |
gallonm | 12:71d589e6fd2c | 116 | gpio0=NULL; |
gallonm | 12:71d589e6fd2c | 117 | } |
gallonm | 4:a5abf7757947 | 118 | |
gallonm | 7:2dc81120c917 | 119 | /** Destructor |
gallonm | 7:2dc81120c917 | 120 | */ |
gallonm | 12:71d589e6fd2c | 121 | //~VL6180X(){} |
gallonm | 7:2dc81120c917 | 122 | |
gallonm | 7:2dc81120c917 | 123 | void VL6180x_On(void) { |
gallonm | 7:2dc81120c917 | 124 | if (gpio0) *gpio0=1; |
gallonm | 7:2dc81120c917 | 125 | else if (expgpio0) *expgpio0=1; |
gallonm | 7:2dc81120c917 | 126 | } |
gallonm | 7:2dc81120c917 | 127 | |
gallonm | 7:2dc81120c917 | 128 | void VL6180x_Off(void) { |
gallonm | 7:2dc81120c917 | 129 | if (gpio0) *gpio0=0; |
gallonm | 7:2dc81120c917 | 130 | else if (expgpio0) *expgpio0=0; |
gallonm | 7:2dc81120c917 | 131 | } |
gallonm | 12:71d589e6fd2c | 132 | |
gallonm | 10:4954b09b72d8 | 133 | int IsPresent() |
gallonm | 10:4954b09b72d8 | 134 | { |
gallonm | 10:4954b09b72d8 | 135 | int status; |
gallonm | 10:4954b09b72d8 | 136 | |
gallonm | 10:4954b09b72d8 | 137 | status=ReadID(); |
gallonm | 12:71d589e6fd2c | 138 | if(status) |
gallonm | 12:71d589e6fd2c | 139 | printf("Failed to read ID device! Device not present!\n"); //FIXME da sistemare la funzione di stampa errore ErrLog da platform.h |
gallonm | 10:4954b09b72d8 | 140 | return status; |
gallonm | 10:4954b09b72d8 | 141 | } |
gallonm | 10:4954b09b72d8 | 142 | |
gallonm | 12:71d589e6fd2c | 143 | int InitSensor(uint8_t NewAddr); |
gallonm | 12:71d589e6fd2c | 144 | |
gallonm | 12:71d589e6fd2c | 145 | int StartMeasurement(OperatingMode operating_mode, void (*fptr)(void), MeasureData_t *Data); |
gallonm | 12:71d589e6fd2c | 146 | |
gallonm | 12:71d589e6fd2c | 147 | int GetRangeError(MeasureData_t *Data, VL6180x_RangeData_t RangeData); |
gallonm | 12:71d589e6fd2c | 148 | |
gallonm | 12:71d589e6fd2c | 149 | int GetAlsError(MeasureData_t *Data, VL6180x_AlsData_t AlsData); |
gallonm | 12:71d589e6fd2c | 150 | |
gallonm | 12:71d589e6fd2c | 151 | int RangeMeasPollSingleShot(MeasureData_t *Data); |
gallonm | 12:71d589e6fd2c | 152 | |
gallonm | 12:71d589e6fd2c | 153 | int AlsMeasPollSingleShot(MeasureData_t *Data); |
gallonm | 12:71d589e6fd2c | 154 | |
gallonm | 12:71d589e6fd2c | 155 | int AlsStartContinuousMode() |
gallonm | 7:2dc81120c917 | 156 | { |
gallonm | 12:71d589e6fd2c | 157 | return VL6180x_AlsSetSystemMode(Device, MODE_START_STOP|MODE_CONTINUOUS); |
gallonm | 7:2dc81120c917 | 158 | } |
gallonm | 7:2dc81120c917 | 159 | |
gallonm | 12:71d589e6fd2c | 160 | int RangeMeasPollContinuousMode(MeasureData_t *Data); |
gallonm | 12:71d589e6fd2c | 161 | |
gallonm | 12:71d589e6fd2c | 162 | int AlsMeasPollContinuousMode(MeasureData_t *Data); |
gallonm | 12:71d589e6fd2c | 163 | |
gallonm | 12:71d589e6fd2c | 164 | int GetRangeMeasContinuousMode(MeasureData_t *Data); |
gallonm | 12:71d589e6fd2c | 165 | |
gallonm | 12:71d589e6fd2c | 166 | int GetAlsMeasContinuousMode(MeasureData_t *Data); |
gallonm | 12:71d589e6fd2c | 167 | |
gallonm | 12:71d589e6fd2c | 168 | int RangeMeasIntContinuousMode(void (*fptr)(void)); |
gallonm | 12:71d589e6fd2c | 169 | |
gallonm | 12:71d589e6fd2c | 170 | int AlsMeasIntContinuousMode(void (*fptr)(void)); |
gallonm | 12:71d589e6fd2c | 171 | |
gallonm | 12:71d589e6fd2c | 172 | int InterleavedMode(void (*fptr)(void)); |
gallonm | 12:71d589e6fd2c | 173 | |
gallonm | 12:71d589e6fd2c | 174 | int StartInterleavedMode(); |
gallonm | 12:71d589e6fd2c | 175 | |
gallonm | 12:71d589e6fd2c | 176 | /* handling functions of the interrupt_measure */ |
gallonm | 12:71d589e6fd2c | 177 | |
gallonm | 12:71d589e6fd2c | 178 | /** Attach a function to call when an interrupt is detected, i.e. measurement is ready |
gallonm | 12:71d589e6fd2c | 179 | * |
gallonm | 12:71d589e6fd2c | 180 | * @param[in] fptr A pointer to a void function, or 0 to set as none |
gallonm | 12:71d589e6fd2c | 181 | */ |
gallonm | 12:71d589e6fd2c | 182 | void AttachInterruptMeasureDetectionIRQ(void (*fptr)(void)) |
gallonm | 7:2dc81120c917 | 183 | { |
gallonm | 12:71d589e6fd2c | 184 | interrupt_measure.rise(fptr); |
gallonm | 12:71d589e6fd2c | 185 | } |
gallonm | 12:71d589e6fd2c | 186 | |
gallonm | 12:71d589e6fd2c | 187 | /** Enable interrupt measure IRQ |
gallonm | 12:71d589e6fd2c | 188 | */ |
gallonm | 12:71d589e6fd2c | 189 | void EnableInterruptMeasureDetectionIRQ(void) |
gallonm | 12:71d589e6fd2c | 190 | { |
gallonm | 12:71d589e6fd2c | 191 | interrupt_measure.enable_irq(); |
gallonm | 12:71d589e6fd2c | 192 | } |
gallonm | 12:71d589e6fd2c | 193 | |
gallonm | 12:71d589e6fd2c | 194 | /** Disable interrupt measure IRQ |
gallonm | 12:71d589e6fd2c | 195 | */ |
gallonm | 12:71d589e6fd2c | 196 | void DisableInterruptMeasureDetectionIRQ(void) |
gallonm | 12:71d589e6fd2c | 197 | { |
gallonm | 12:71d589e6fd2c | 198 | interrupt_measure.disable_irq(); |
gallonm | 12:71d589e6fd2c | 199 | } |
gallonm | 12:71d589e6fd2c | 200 | |
gallonm | 12:71d589e6fd2c | 201 | void HandleIRQ(MeasureType measure_type, MeasureData_t *Data); // FIXME sistemare la sequenza delle funzioni completandola con i print degli errori |
gallonm | 12:71d589e6fd2c | 202 | |
gallonm | 12:71d589e6fd2c | 203 | /* Wrapper functions */ |
gallonm | 12:71d589e6fd2c | 204 | int WaitDeviceBooted() |
gallonm | 12:71d589e6fd2c | 205 | { |
gallonm | 12:71d589e6fd2c | 206 | return VL6180x_WaitDeviceBooted(Device); |
gallonm | 12:71d589e6fd2c | 207 | } |
gallonm | 12:71d589e6fd2c | 208 | |
gallonm | 12:71d589e6fd2c | 209 | int Init() |
gallonm | 12:71d589e6fd2c | 210 | { |
gallonm | 12:71d589e6fd2c | 211 | return VL6180x_InitData(Device); |
gallonm | 12:71d589e6fd2c | 212 | } |
gallonm | 12:71d589e6fd2c | 213 | |
gallonm | 12:71d589e6fd2c | 214 | int SetupGPIO1(uint8_t InitFunction, int ActiveHigh) |
gallonm | 12:71d589e6fd2c | 215 | { |
gallonm | 12:71d589e6fd2c | 216 | return VL6180x_SetupGPIO1(Device, InitFunction, ActiveHigh); |
gallonm | 10:4954b09b72d8 | 217 | } |
gallonm | 10:4954b09b72d8 | 218 | |
gallonm | 10:4954b09b72d8 | 219 | int Prepare() |
gallonm | 10:4954b09b72d8 | 220 | { |
gallonm | 10:4954b09b72d8 | 221 | return VL6180x_Prepare(Device); |
gallonm | 10:4954b09b72d8 | 222 | } |
gallonm | 10:4954b09b72d8 | 223 | |
gallonm | 12:71d589e6fd2c | 224 | int RangeStartContinuousMode() |
gallonm | 12:71d589e6fd2c | 225 | { |
gallonm | 12:71d589e6fd2c | 226 | return VL6180x_RangeStartContinuousMode(Device); |
gallonm | 12:71d589e6fd2c | 227 | } |
gallonm | 12:71d589e6fd2c | 228 | |
gallonm | 12:71d589e6fd2c | 229 | int RangeStartSingleShot() |
gallonm | 12:71d589e6fd2c | 230 | { |
gallonm | 12:71d589e6fd2c | 231 | return VL6180x_RangeStartSingleShot(Device); |
gallonm | 12:71d589e6fd2c | 232 | } |
gallonm | 12:71d589e6fd2c | 233 | |
gallonm | 12:71d589e6fd2c | 234 | int RangeSetMaxConvergenceTime(uint8_t MaxConTime_msec) |
gallonm | 12:71d589e6fd2c | 235 | { |
gallonm | 12:71d589e6fd2c | 236 | return VL6180x_RangeSetMaxConvergenceTime(Device, MaxConTime_msec); |
gallonm | 12:71d589e6fd2c | 237 | } |
gallonm | 12:71d589e6fd2c | 238 | |
gallonm | 12:71d589e6fd2c | 239 | int RangePollMeasurement(VL6180x_RangeData_t *pRangeData) |
gallonm | 12:71d589e6fd2c | 240 | { |
gallonm | 12:71d589e6fd2c | 241 | return VL6180x_RangePollMeasurement(Device, pRangeData); |
gallonm | 12:71d589e6fd2c | 242 | } |
gallonm | 12:71d589e6fd2c | 243 | |
gallonm | 12:71d589e6fd2c | 244 | int RangeGetMeasurementIfReady(VL6180x_RangeData_t *pRangeData) |
gallonm | 12:71d589e6fd2c | 245 | { |
gallonm | 12:71d589e6fd2c | 246 | return VL6180x_RangeGetMeasurementIfReady(Device, pRangeData); |
gallonm | 12:71d589e6fd2c | 247 | } |
gallonm | 12:71d589e6fd2c | 248 | |
gallonm | 12:71d589e6fd2c | 249 | int RangeGetMeasurement(VL6180x_RangeData_t *pRangeData) |
gallonm | 12:71d589e6fd2c | 250 | { |
gallonm | 12:71d589e6fd2c | 251 | return VL6180x_RangeGetMeasurement(Device, pRangeData); |
gallonm | 12:71d589e6fd2c | 252 | } |
gallonm | 12:71d589e6fd2c | 253 | |
gallonm | 12:71d589e6fd2c | 254 | int GetRange(int32_t *piData) |
gallonm | 12:71d589e6fd2c | 255 | { |
gallonm | 12:71d589e6fd2c | 256 | return VL6180x_RangeGetResult(Device, piData); |
gallonm | 12:71d589e6fd2c | 257 | } |
gallonm | 12:71d589e6fd2c | 258 | |
gallonm | 12:71d589e6fd2c | 259 | int RangeConfigInterrupt(uint8_t ConfigGpioInt) |
gallonm | 12:71d589e6fd2c | 260 | { |
gallonm | 12:71d589e6fd2c | 261 | return VL6180x_RangeConfigInterrupt(Device, ConfigGpioInt); |
gallonm | 12:71d589e6fd2c | 262 | } |
gallonm | 12:71d589e6fd2c | 263 | |
gallonm | 12:71d589e6fd2c | 264 | int RangeGetInterruptStatus(uint8_t *pIntStatus) |
gallonm | 12:71d589e6fd2c | 265 | { |
gallonm | 12:71d589e6fd2c | 266 | return VL6180x_RangeGetInterruptStatus(Device, pIntStatus); |
gallonm | 12:71d589e6fd2c | 267 | } |
gallonm | 12:71d589e6fd2c | 268 | |
gallonm | 12:71d589e6fd2c | 269 | int AlsPollMeasurement(VL6180x_AlsData_t *pAlsData) |
gallonm | 12:71d589e6fd2c | 270 | { |
gallonm | 12:71d589e6fd2c | 271 | return VL6180x_AlsPollMeasurement(Device, pAlsData); |
gallonm | 12:71d589e6fd2c | 272 | } |
gallonm | 12:71d589e6fd2c | 273 | |
gallonm | 12:71d589e6fd2c | 274 | int AlsGetMeasurement(VL6180x_AlsData_t *pAlsData) |
gallonm | 12:71d589e6fd2c | 275 | { |
gallonm | 12:71d589e6fd2c | 276 | return VL6180x_AlsGetMeasurement(Device, pAlsData); |
gallonm | 12:71d589e6fd2c | 277 | } |
gallonm | 12:71d589e6fd2c | 278 | |
gallonm | 12:71d589e6fd2c | 279 | int AlsConfigInterrupt(uint8_t ConfigGpioInt) |
gallonm | 12:71d589e6fd2c | 280 | { |
gallonm | 12:71d589e6fd2c | 281 | return VL6180x_AlsConfigInterrupt(Device, ConfigGpioInt); |
gallonm | 12:71d589e6fd2c | 282 | } |
gallonm | 12:71d589e6fd2c | 283 | |
gallonm | 12:71d589e6fd2c | 284 | int AlsSetIntegrationPeriod(uint16_t period_ms) |
gallonm | 12:71d589e6fd2c | 285 | { |
gallonm | 12:71d589e6fd2c | 286 | return VL6180x_AlsSetIntegrationPeriod(Device, period_ms); |
gallonm | 12:71d589e6fd2c | 287 | } |
gallonm | 12:71d589e6fd2c | 288 | |
gallonm | 12:71d589e6fd2c | 289 | int AlsSetInterMeasurementPeriod(uint16_t intermeasurement_period_ms) |
gallonm | 12:71d589e6fd2c | 290 | { |
gallonm | 12:71d589e6fd2c | 291 | return VL6180x_AlsSetInterMeasurementPeriod(Device, intermeasurement_period_ms); |
gallonm | 12:71d589e6fd2c | 292 | } |
gallonm | 12:71d589e6fd2c | 293 | |
gallonm | 12:71d589e6fd2c | 294 | int AlsSetAnalogueGain(uint8_t gain) |
gallonm | 12:71d589e6fd2c | 295 | { |
gallonm | 12:71d589e6fd2c | 296 | return VL6180x_AlsSetAnalogueGain(Device, gain); |
gallonm | 12:71d589e6fd2c | 297 | } |
gallonm | 12:71d589e6fd2c | 298 | |
gallonm | 12:71d589e6fd2c | 299 | int AlsSetThresholds(uint8_t low, uint8_t high) |
gallonm | 12:71d589e6fd2c | 300 | { |
gallonm | 12:71d589e6fd2c | 301 | return VL6180x_AlsSetThresholds(Device, low, high); |
gallonm | 12:71d589e6fd2c | 302 | } |
gallonm | 12:71d589e6fd2c | 303 | |
gallonm | 12:71d589e6fd2c | 304 | int AlsGetInterruptStatus(uint8_t *pIntStatus) |
gallonm | 12:71d589e6fd2c | 305 | { |
gallonm | 12:71d589e6fd2c | 306 | return VL6180x_AlsGetInterruptStatus(Device, pIntStatus); |
gallonm | 12:71d589e6fd2c | 307 | } |
gallonm | 12:71d589e6fd2c | 308 | |
gallonm | 12:71d589e6fd2c | 309 | int StaticInit() |
gallonm | 12:71d589e6fd2c | 310 | { |
gallonm | 12:71d589e6fd2c | 311 | return VL6180x_StaticInit(Device); |
gallonm | 12:71d589e6fd2c | 312 | } |
gallonm | 12:71d589e6fd2c | 313 | |
gallonm | 12:71d589e6fd2c | 314 | int RangeWaitDeviceReady(int MaxLoop ) |
gallonm | 12:71d589e6fd2c | 315 | { |
gallonm | 12:71d589e6fd2c | 316 | return VL6180x_RangeWaitDeviceReady(Device, MaxLoop); |
gallonm | 12:71d589e6fd2c | 317 | } |
gallonm | 12:71d589e6fd2c | 318 | |
gallonm | 12:71d589e6fd2c | 319 | int RangeSetInterMeasPeriod(uint32_t InterMeasTime_msec) |
gallonm | 12:71d589e6fd2c | 320 | { |
gallonm | 12:71d589e6fd2c | 321 | return VL6180x_RangeSetInterMeasPeriod(Device, InterMeasTime_msec); |
gallonm | 12:71d589e6fd2c | 322 | } |
gallonm | 12:71d589e6fd2c | 323 | |
gallonm | 12:71d589e6fd2c | 324 | int UpscaleSetScaling(uint8_t scaling) |
gallonm | 12:71d589e6fd2c | 325 | { |
gallonm | 12:71d589e6fd2c | 326 | return VL6180x_UpscaleSetScaling(Device, scaling); |
gallonm | 12:71d589e6fd2c | 327 | } |
gallonm | 12:71d589e6fd2c | 328 | |
gallonm | 12:71d589e6fd2c | 329 | int UpscaleGetScaling() |
gallonm | 12:71d589e6fd2c | 330 | { |
gallonm | 12:71d589e6fd2c | 331 | return VL6180x_UpscaleGetScaling(Device); |
gallonm | 12:71d589e6fd2c | 332 | } |
gallonm | 12:71d589e6fd2c | 333 | |
gallonm | 12:71d589e6fd2c | 334 | uint16_t GetUpperLimit() |
gallonm | 12:71d589e6fd2c | 335 | { |
gallonm | 12:71d589e6fd2c | 336 | return VL6180x_GetUpperLimit(Device); |
gallonm | 12:71d589e6fd2c | 337 | } |
gallonm | 12:71d589e6fd2c | 338 | |
gallonm | 12:71d589e6fd2c | 339 | int RangeSetThresholds(uint16_t low, uint16_t high, int SafeHold) |
gallonm | 12:71d589e6fd2c | 340 | { |
gallonm | 12:71d589e6fd2c | 341 | return VL6180x_RangeSetThresholds(Device, low, high, SafeHold); |
gallonm | 12:71d589e6fd2c | 342 | } |
gallonm | 12:71d589e6fd2c | 343 | |
gallonm | 12:71d589e6fd2c | 344 | int RangeGetThresholds(uint16_t *low, uint16_t *high) |
gallonm | 12:71d589e6fd2c | 345 | { |
gallonm | 12:71d589e6fd2c | 346 | return VL6180x_RangeGetThresholds(Device, low, high); |
gallonm | 12:71d589e6fd2c | 347 | } |
gallonm | 12:71d589e6fd2c | 348 | |
gallonm | 12:71d589e6fd2c | 349 | int RangeSetRawThresholds(uint8_t low, uint8_t high) |
gallonm | 12:71d589e6fd2c | 350 | { |
gallonm | 12:71d589e6fd2c | 351 | return VL6180x_RangeSetRawThresholds(Device, low, high); |
gallonm | 12:71d589e6fd2c | 352 | } |
gallonm | 12:71d589e6fd2c | 353 | |
gallonm | 12:71d589e6fd2c | 354 | int RangeSetEceFactor(uint16_t FactorM, uint16_t FactorD) |
gallonm | 12:71d589e6fd2c | 355 | { |
gallonm | 12:71d589e6fd2c | 356 | return VL6180x_RangeSetEceFactor(Device, FactorM, FactorD); |
gallonm | 12:71d589e6fd2c | 357 | } |
gallonm | 12:71d589e6fd2c | 358 | |
gallonm | 12:71d589e6fd2c | 359 | int RangeSetEceState(int enable) |
gallonm | 12:71d589e6fd2c | 360 | { |
gallonm | 12:71d589e6fd2c | 361 | return VL6180x_RangeSetEceState(Device, enable); |
gallonm | 12:71d589e6fd2c | 362 | } |
gallonm | 12:71d589e6fd2c | 363 | |
gallonm | 12:71d589e6fd2c | 364 | int FilterSetState(int state) |
gallonm | 12:71d589e6fd2c | 365 | { |
gallonm | 12:71d589e6fd2c | 366 | return VL6180x_FilterSetState(Device, state); |
gallonm | 12:71d589e6fd2c | 367 | } |
gallonm | 12:71d589e6fd2c | 368 | |
gallonm | 12:71d589e6fd2c | 369 | int FilterGetState() |
gallonm | 12:71d589e6fd2c | 370 | { |
gallonm | 12:71d589e6fd2c | 371 | return VL6180x_FilterGetState(Device); |
gallonm | 12:71d589e6fd2c | 372 | } |
gallonm | 12:71d589e6fd2c | 373 | |
gallonm | 12:71d589e6fd2c | 374 | int DMaxSetState(int state) |
gallonm | 12:71d589e6fd2c | 375 | { |
gallonm | 12:71d589e6fd2c | 376 | return VL6180x_DMaxSetState(Device, state); |
gallonm | 12:71d589e6fd2c | 377 | } |
gallonm | 12:71d589e6fd2c | 378 | |
gallonm | 12:71d589e6fd2c | 379 | int DMaxGetState() |
gallonm | 12:71d589e6fd2c | 380 | { |
gallonm | 12:71d589e6fd2c | 381 | return VL6180x_DMaxGetState(Device); |
gallonm | 12:71d589e6fd2c | 382 | } |
gallonm | 12:71d589e6fd2c | 383 | |
gallonm | 12:71d589e6fd2c | 384 | int RangeSetSystemMode(uint8_t mode) |
gallonm | 12:71d589e6fd2c | 385 | { |
gallonm | 12:71d589e6fd2c | 386 | return VL6180x_RangeSetSystemMode(Device, mode); |
gallonm | 12:71d589e6fd2c | 387 | } |
gallonm | 12:71d589e6fd2c | 388 | |
gallonm | 12:71d589e6fd2c | 389 | int8_t GetOffsetCalibrationData() |
gallonm | 12:71d589e6fd2c | 390 | { |
gallonm | 12:71d589e6fd2c | 391 | return VL6180x_GetOffsetCalibrationData(Device); |
gallonm | 12:71d589e6fd2c | 392 | } |
gallonm | 12:71d589e6fd2c | 393 | |
gallonm | 12:71d589e6fd2c | 394 | void SetOffsetCalibrationData(int8_t offset) |
gallonm | 12:71d589e6fd2c | 395 | { |
gallonm | 12:71d589e6fd2c | 396 | return VL6180x_SetOffsetCalibrationData(Device, offset); |
gallonm | 12:71d589e6fd2c | 397 | } |
gallonm | 12:71d589e6fd2c | 398 | |
gallonm | 12:71d589e6fd2c | 399 | int SetXTalkCompensationRate(FixPoint97_t Rate) |
gallonm | 12:71d589e6fd2c | 400 | { |
gallonm | 12:71d589e6fd2c | 401 | return VL6180x_SetXTalkCompensationRate(Device, Rate); |
gallonm | 12:71d589e6fd2c | 402 | } |
gallonm | 12:71d589e6fd2c | 403 | |
gallonm | 12:71d589e6fd2c | 404 | int AlsWaitDeviceReady(int MaxLoop) |
gallonm | 12:71d589e6fd2c | 405 | { |
gallonm | 12:71d589e6fd2c | 406 | return VL6180x_AlsWaitDeviceReady(Device, MaxLoop); |
gallonm | 12:71d589e6fd2c | 407 | } |
gallonm | 12:71d589e6fd2c | 408 | |
gallonm | 12:71d589e6fd2c | 409 | int AlsSetSystemMode(uint8_t mode) |
gallonm | 12:71d589e6fd2c | 410 | { |
gallonm | 12:71d589e6fd2c | 411 | return VL6180x_AlsSetSystemMode(Device, mode); |
gallonm | 12:71d589e6fd2c | 412 | } |
gallonm | 12:71d589e6fd2c | 413 | |
gallonm | 12:71d589e6fd2c | 414 | int SetGroupParamHold(int Hold) |
gallonm | 12:71d589e6fd2c | 415 | { |
gallonm | 12:71d589e6fd2c | 416 | return VL6180x_SetGroupParamHold(Device, Hold); |
gallonm | 12:71d589e6fd2c | 417 | } |
gallonm | 12:71d589e6fd2c | 418 | |
gallonm | 10:4954b09b72d8 | 419 | int SetI2CAddress(int NewAddr) |
gallonm | 10:4954b09b72d8 | 420 | { |
gallonm | 10:4954b09b72d8 | 421 | int status; |
gallonm | 10:4954b09b72d8 | 422 | |
gallonm | 10:4954b09b72d8 | 423 | status=VL6180x_SetI2CAddress(Device, NewAddr); |
gallonm | 10:4954b09b72d8 | 424 | if(!status) |
gallonm | 11:88541229403e | 425 | Device->I2cAddr=NewAddr; |
gallonm | 10:4954b09b72d8 | 426 | return status; |
gallonm | 10:4954b09b72d8 | 427 | } |
gallonm | 10:4954b09b72d8 | 428 | |
gallonm | 12:71d589e6fd2c | 429 | int SetupGPIOx(int pin, uint8_t IntFunction, int ActiveHigh) |
gallonm | 10:4954b09b72d8 | 430 | { |
gallonm | 12:71d589e6fd2c | 431 | return VL6180x_SetupGPIOx(Device, pin, IntFunction, ActiveHigh); |
gallonm | 10:4954b09b72d8 | 432 | } |
gallonm | 10:4954b09b72d8 | 433 | |
gallonm | 12:71d589e6fd2c | 434 | int SetGPIOxPolarity(int pin, int active_high) |
gallonm | 12:71d589e6fd2c | 435 | { |
gallonm | 12:71d589e6fd2c | 436 | return VL6180x_SetGPIOxPolarity(Device, pin, active_high); |
gallonm | 12:71d589e6fd2c | 437 | } |
gallonm | 12:71d589e6fd2c | 438 | |
gallonm | 12:71d589e6fd2c | 439 | int SetGPIOxFunctionality(int pin, uint8_t functionality) |
gallonm | 10:4954b09b72d8 | 440 | { |
gallonm | 12:71d589e6fd2c | 441 | return VL6180x_SetGPIOxFunctionality(Device, pin, functionality); |
gallonm | 12:71d589e6fd2c | 442 | } |
gallonm | 12:71d589e6fd2c | 443 | |
gallonm | 12:71d589e6fd2c | 444 | int DisableGPIOxOut(int pin) |
gallonm | 12:71d589e6fd2c | 445 | { |
gallonm | 12:71d589e6fd2c | 446 | return VL6180x_DisableGPIOxOut(Device, pin); |
gallonm | 10:4954b09b72d8 | 447 | } |
gallonm | 10:4954b09b72d8 | 448 | |
gallonm | 12:71d589e6fd2c | 449 | int GetInterruptStatus(uint8_t *status) |
gallonm | 12:71d589e6fd2c | 450 | { |
gallonm | 12:71d589e6fd2c | 451 | return VL6180x_GetInterruptStatus(Device, status); |
gallonm | 12:71d589e6fd2c | 452 | } |
gallonm | 12:71d589e6fd2c | 453 | |
gallonm | 12:71d589e6fd2c | 454 | int ClearInterrupt(uint8_t IntClear) |
gallonm | 12:71d589e6fd2c | 455 | { |
gallonm | 12:71d589e6fd2c | 456 | return VL6180x_ClearInterrupt(Device, IntClear ); |
gallonm | 12:71d589e6fd2c | 457 | } |
gallonm | 12:71d589e6fd2c | 458 | |
gallonm | 12:71d589e6fd2c | 459 | int GetLight(uint32_t *piData) |
gallonm | 12:71d589e6fd2c | 460 | { |
gallonm | 12:71d589e6fd2c | 461 | return VL6180x_AlsGetLux(Device, piData); |
gallonm | 12:71d589e6fd2c | 462 | } |
gallonm | 12:71d589e6fd2c | 463 | |
gallonm | 12:71d589e6fd2c | 464 | |
gallonm | 12:71d589e6fd2c | 465 | /* api.h functions */ |
gallonm | 7:2dc81120c917 | 466 | int VL6180x_WaitDeviceBooted(VL6180xDev_t dev); |
gallonm | 7:2dc81120c917 | 467 | int VL6180x_InitData(VL6180xDev_t dev ); |
gallonm | 7:2dc81120c917 | 468 | int VL6180x_SetupGPIO1(VL6180xDev_t dev, uint8_t IntFunction, int ActiveHigh); |
gallonm | 7:2dc81120c917 | 469 | int VL6180x_Prepare(VL6180xDev_t dev); |
gallonm | 7:2dc81120c917 | 470 | int VL6180x_RangeStartContinuousMode(VL6180xDev_t dev); |
gallonm | 7:2dc81120c917 | 471 | int VL6180x_RangeStartSingleShot(VL6180xDev_t dev); |
gallonm | 7:2dc81120c917 | 472 | int VL6180x_RangeSetMaxConvergenceTime(VL6180xDev_t dev, uint8_t MaxConTime_msec); |
gallonm | 7:2dc81120c917 | 473 | int VL6180x_RangePollMeasurement(VL6180xDev_t dev, VL6180x_RangeData_t *pRangeData); |
gallonm | 7:2dc81120c917 | 474 | int VL6180x_RangeGetMeasurementIfReady(VL6180xDev_t dev, VL6180x_RangeData_t *pRangeData); |
gallonm | 7:2dc81120c917 | 475 | int VL6180x_RangeGetMeasurement(VL6180xDev_t dev, VL6180x_RangeData_t *pRangeData); |
gallonm | 7:2dc81120c917 | 476 | int VL6180x_RangeGetResult(VL6180xDev_t dev, int32_t *pRange_mm); |
gallonm | 7:2dc81120c917 | 477 | int VL6180x_RangeConfigInterrupt(VL6180xDev_t dev, uint8_t ConfigGpioInt); |
gallonm | 7:2dc81120c917 | 478 | int VL6180x_RangeGetInterruptStatus(VL6180xDev_t dev, uint8_t *pIntStatus); |
gallonm | 7:2dc81120c917 | 479 | int VL6180x_AlsPollMeasurement(VL6180xDev_t dev, VL6180x_AlsData_t *pAlsData); |
gallonm | 7:2dc81120c917 | 480 | int VL6180x_AlsGetMeasurement(VL6180xDev_t dev, VL6180x_AlsData_t *pAlsData); |
gallonm | 7:2dc81120c917 | 481 | int VL6180x_AlsConfigInterrupt(VL6180xDev_t dev, uint8_t ConfigGpioInt); |
gallonm | 7:2dc81120c917 | 482 | int VL6180x_AlsSetIntegrationPeriod(VL6180xDev_t dev, uint16_t period_ms); |
gallonm | 7:2dc81120c917 | 483 | int VL6180x_AlsSetInterMeasurementPeriod(VL6180xDev_t dev, uint16_t intermeasurement_period_ms); |
gallonm | 7:2dc81120c917 | 484 | int VL6180x_AlsSetAnalogueGain(VL6180xDev_t dev, uint8_t gain); |
gallonm | 7:2dc81120c917 | 485 | int VL6180x_AlsSetThresholds(VL6180xDev_t dev, uint8_t low, uint8_t high); |
gallonm | 7:2dc81120c917 | 486 | int VL6180x_AlsGetInterruptStatus(VL6180xDev_t dev, uint8_t *pIntStatus); |
gallonm | 7:2dc81120c917 | 487 | int VL6180x_StaticInit(VL6180xDev_t dev); |
gallonm | 7:2dc81120c917 | 488 | int VL6180x_RangeWaitDeviceReady(VL6180xDev_t dev, int MaxLoop ); |
gallonm | 7:2dc81120c917 | 489 | int VL6180x_RangeSetInterMeasPeriod(VL6180xDev_t dev, uint32_t InterMeasTime_msec); |
gallonm | 7:2dc81120c917 | 490 | int VL6180x_UpscaleSetScaling(VL6180xDev_t dev, uint8_t scaling); |
gallonm | 7:2dc81120c917 | 491 | int VL6180x_UpscaleGetScaling(VL6180xDev_t dev); |
gallonm | 7:2dc81120c917 | 492 | uint16_t VL6180x_GetUpperLimit(VL6180xDev_t dev); |
gallonm | 7:2dc81120c917 | 493 | int VL6180x_RangeSetThresholds(VL6180xDev_t dev, uint16_t low, uint16_t high, int SafeHold); |
gallonm | 7:2dc81120c917 | 494 | int VL6180x_RangeGetThresholds(VL6180xDev_t dev, uint16_t *low, uint16_t *high); |
gallonm | 7:2dc81120c917 | 495 | int VL6180x_RangeSetRawThresholds(VL6180xDev_t dev, uint8_t low, uint8_t high); |
gallonm | 7:2dc81120c917 | 496 | int VL6180x_RangeSetEceFactor(VL6180xDev_t dev, uint16_t FactorM, uint16_t FactorD); |
gallonm | 7:2dc81120c917 | 497 | int VL6180x_RangeSetEceState(VL6180xDev_t dev, int enable ); |
gallonm | 7:2dc81120c917 | 498 | int VL6180x_FilterSetState(VL6180xDev_t dev, int state); |
gallonm | 7:2dc81120c917 | 499 | int VL6180x_FilterGetState(VL6180xDev_t dev); |
gallonm | 7:2dc81120c917 | 500 | int VL6180x_DMaxSetState(VL6180xDev_t dev, int state); |
gallonm | 7:2dc81120c917 | 501 | int VL6180x_DMaxGetState(VL6180xDev_t dev); |
gallonm | 7:2dc81120c917 | 502 | int VL6180x_RangeSetSystemMode(VL6180xDev_t dev, uint8_t mode); |
gallonm | 7:2dc81120c917 | 503 | int8_t VL6180x_GetOffsetCalibrationData(VL6180xDev_t dev); |
gallonm | 7:2dc81120c917 | 504 | void VL6180x_SetOffsetCalibrationData(VL6180xDev_t dev, int8_t offset); |
gallonm | 7:2dc81120c917 | 505 | int VL6180x_SetXTalkCompensationRate(VL6180xDev_t dev, FixPoint97_t Rate); |
gallonm | 7:2dc81120c917 | 506 | int VL6180x_AlsWaitDeviceReady(VL6180xDev_t dev, int MaxLoop ); |
gallonm | 7:2dc81120c917 | 507 | int VL6180x_AlsSetSystemMode(VL6180xDev_t dev, uint8_t mode); |
gallonm | 7:2dc81120c917 | 508 | int VL6180x_SetGroupParamHold(VL6180xDev_t dev, int Hold); |
gallonm | 7:2dc81120c917 | 509 | int VL6180x_SetI2CAddress(VL6180xDev_t dev, uint8_t NewAddr); |
gallonm | 7:2dc81120c917 | 510 | int VL6180x_SetupGPIOx(VL6180xDev_t dev, int pin, uint8_t IntFunction, int ActiveHigh); |
gallonm | 7:2dc81120c917 | 511 | int VL6180x_SetGPIOxPolarity(VL6180xDev_t dev, int pin, int active_high); |
gallonm | 7:2dc81120c917 | 512 | int VL6180x_SetGPIOxFunctionality(VL6180xDev_t dev, int pin, uint8_t functionality); |
gallonm | 7:2dc81120c917 | 513 | int VL6180x_DisableGPIOxOut(VL6180xDev_t dev, int pin); |
gallonm | 7:2dc81120c917 | 514 | int VL6180x_GetInterruptStatus(VL6180xDev_t dev, uint8_t *status); |
gallonm | 7:2dc81120c917 | 515 | int VL6180x_ClearInterrupt(VL6180xDev_t dev, uint8_t IntClear ); |
gallonm | 12:71d589e6fd2c | 516 | |
gallonm | 12:71d589e6fd2c | 517 | /* Other functions defined in api.c */ |
gallonm | 7:2dc81120c917 | 518 | int VL6180x_RangeStaticInit(VL6180xDev_t dev); |
gallonm | 7:2dc81120c917 | 519 | int VL6180x_UpscaleRegInit(VL6180xDev_t dev); |
gallonm | 7:2dc81120c917 | 520 | int VL6180x_UpscaleStaticInit(VL6180xDev_t dev); |
gallonm | 7:2dc81120c917 | 521 | int VL6180x_AlsGetLux(VL6180xDev_t dev, lux_t *pLux); |
gallonm | 7:2dc81120c917 | 522 | int _UpscaleInitPatch0(VL6180xDev_t dev); |
gallonm | 7:2dc81120c917 | 523 | int VL6180x_RangeGetDeviceReady(VL6180xDev_t dev, int * Ready); |
gallonm | 7:2dc81120c917 | 524 | int VL6180x_RangeSetEarlyConvergenceEestimateThreshold(VL6180xDev_t dev); |
gallonm | 7:2dc81120c917 | 525 | int32_t _GetAveTotalTime(VL6180xDev_t dev); |
gallonm | 7:2dc81120c917 | 526 | 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 | 7:2dc81120c917 | 527 | int _filter_GetResult(VL6180xDev_t dev, VL6180x_RangeData_t *pRangeData); |
gallonm | 7:2dc81120c917 | 528 | int _GetRateResult(VL6180xDev_t dev, VL6180x_RangeData_t *pRangeData); |
gallonm | 7:2dc81120c917 | 529 | int _DMax_InitData(VL6180xDev_t dev); |
gallonm | 7:2dc81120c917 | 530 | |
gallonm | 10:4954b09b72d8 | 531 | /* Read function of the ID device */ |
gallonm | 10:4954b09b72d8 | 532 | int ReadID(); |
gallonm | 4:a5abf7757947 | 533 | |
gallonm | 4:a5abf7757947 | 534 | /* Write and read functions from I2C */ |
gallonm | 4:a5abf7757947 | 535 | int VL6180x_WrByte(VL6180xDev_t dev, uint16_t index, uint8_t data); |
gallonm | 4:a5abf7757947 | 536 | int VL6180x_WrWord(VL6180xDev_t dev, uint16_t index, uint16_t data); |
gallonm | 4:a5abf7757947 | 537 | int VL6180x_WrDWord(VL6180xDev_t dev, uint16_t index, uint32_t data); |
gallonm | 4:a5abf7757947 | 538 | int VL6180x_RdByte(VL6180xDev_t dev, uint16_t index, uint8_t *data); |
gallonm | 4:a5abf7757947 | 539 | int VL6180x_RdWord(VL6180xDev_t dev, uint16_t index, uint16_t *data); |
gallonm | 4:a5abf7757947 | 540 | int VL6180x_RdDWord(VL6180xDev_t dev, uint16_t index, uint32_t *data); |
gallonm | 7:2dc81120c917 | 541 | int VL6180x_UpdateByte(VL6180xDev_t dev, uint16_t index, uint8_t AndData, uint8_t OrData); |
gallonm | 4:a5abf7757947 | 542 | int VL6180x_I2CWrite(uint8_t DeviceAddr, uint16_t RegisterAddr, uint8_t *pBuffer, uint16_t NumByteToWrite); |
gallonm | 4:a5abf7757947 | 543 | int VL6180x_I2CRead(uint8_t DeviceAddr, uint16_t RegisterAddr, uint8_t *pBuffer, uint16_t NumByteToRead); |
licio.mapelli@st.com | 9:9cbc1736f148 | 544 | |
gallonm | 10:4954b09b72d8 | 545 | |
gallonm | 4:a5abf7757947 | 546 | |
gallonm | 3:454541a079f4 | 547 | private: |
gallonm | 1:1de1ea2994d9 | 548 | /* IO Device */ |
gallonm | 7:2dc81120c917 | 549 | DevI2C &dev_i2c; |
gallonm | 10:4954b09b72d8 | 550 | /* Digital out pin */ |
gallonm | 7:2dc81120c917 | 551 | DigitalOut *gpio0; |
gallonm | 10:4954b09b72d8 | 552 | /* GPIO expander */ |
gallonm | 10:4954b09b72d8 | 553 | STMPE1600DigiOut *expgpio0; |
gallonm | 12:71d589e6fd2c | 554 | /* Measure detection IRQ */ |
gallonm | 12:71d589e6fd2c | 555 | InterruptIn interrupt_measure; |
gallonm | 10:4954b09b72d8 | 556 | /* Device data */ |
gallonm | 10:4954b09b72d8 | 557 | MyVL6180Dev_t MyDevice; |
gallonm | 10:4954b09b72d8 | 558 | VL6180xDev_t Device; |
gallonm | 1:1de1ea2994d9 | 559 | }; |
gallonm | 1:1de1ea2994d9 | 560 | |
gallonm | 4:a5abf7757947 | 561 | #endif // __VL6180X_CLASS_H |