The VL53L1CB proximity sensor, based on ST’s FlightSense™, Time-of-Flight technology.
Dependencies: X_NUCLEO_COMMON ST_INTERFACES
Dependents: VL53L1CB_noshield_1sensor_polls_auton VL53L1CB_noshield_1sensor_interrupt_auton X_NUCLEO_53L1A2
Based on VL53L1 library, this is a library for the VL53L1CB ToF chip.
inc/vl53l1_platform.h@18:0696efe39d08, 2021-07-21 (annotated)
- Committer:
- lugandc
- Date:
- Wed Jul 21 17:06:38 2021 +0200
- Revision:
- 18:0696efe39d08
- Parent:
- 0:3ac96e360672
Cleanup i2c functions, removed all bad references to L1X
Cleanup VL53L1CB class:
- i2c device object is passed in a consistent way in MyDevice structure
- removed useless functions
Updated VL53L1CB component driver with bare driver release 6.6.7 content
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lugandc | 18:0696efe39d08 | 1 | |
lugandc | 18:0696efe39d08 | 2 | /* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */ |
lugandc | 18:0696efe39d08 | 3 | /****************************************************************************** |
lugandc | 18:0696efe39d08 | 4 | * Copyright (c) 2020, STMicroelectronics - All Rights Reserved |
charlesmn | 0:3ac96e360672 | 5 | |
lugandc | 18:0696efe39d08 | 6 | This file is part of VL53L1 and is dual licensed, |
lugandc | 18:0696efe39d08 | 7 | either GPL-2.0+ |
lugandc | 18:0696efe39d08 | 8 | or 'BSD 3-clause "New" or "Revised" License' , at your option. |
lugandc | 18:0696efe39d08 | 9 | ****************************************************************************** |
lugandc | 18:0696efe39d08 | 10 | */ |
charlesmn | 0:3ac96e360672 | 11 | |
charlesmn | 0:3ac96e360672 | 12 | |
charlesmn | 0:3ac96e360672 | 13 | #ifndef _VL53L1_PLATFORM_H_ |
charlesmn | 0:3ac96e360672 | 14 | #define _VL53L1_PLATFORM_H_ |
charlesmn | 0:3ac96e360672 | 15 | |
charlesmn | 0:3ac96e360672 | 16 | #include "vl53l1_ll_def.h" |
charlesmn | 0:3ac96e360672 | 17 | #include "vl53l1_platform_log.h" |
charlesmn | 0:3ac96e360672 | 18 | |
charlesmn | 0:3ac96e360672 | 19 | #define VL53L1_IPP_API |
charlesmn | 0:3ac96e360672 | 20 | #include "vl53l1_platform_ipp_imports.h" |
charlesmn | 0:3ac96e360672 | 21 | #include "vl53l1_platform_user_data.h" |
charlesmn | 0:3ac96e360672 | 22 | |
charlesmn | 0:3ac96e360672 | 23 | #ifdef __cplusplus |
charlesmn | 0:3ac96e360672 | 24 | extern "C" |
charlesmn | 0:3ac96e360672 | 25 | { |
charlesmn | 0:3ac96e360672 | 26 | #endif |
charlesmn | 0:3ac96e360672 | 27 | |
charlesmn | 0:3ac96e360672 | 28 | /** |
charlesmn | 0:3ac96e360672 | 29 | * @file vl53l1_platform.h |
charlesmn | 0:3ac96e360672 | 30 | * |
charlesmn | 0:3ac96e360672 | 31 | * @brief All end user OS/platform/application porting |
charlesmn | 0:3ac96e360672 | 32 | */ |
charlesmn | 0:3ac96e360672 | 33 | |
charlesmn | 0:3ac96e360672 | 34 | |
charlesmn | 0:3ac96e360672 | 35 | |
charlesmn | 0:3ac96e360672 | 36 | /** |
charlesmn | 0:3ac96e360672 | 37 | * @brief Initialise platform comms. |
charlesmn | 0:3ac96e360672 | 38 | * |
charlesmn | 0:3ac96e360672 | 39 | * @param[in] pdev : pointer to device structure (device handle) |
charlesmn | 0:3ac96e360672 | 40 | * @param[in] comms_type : selects between I2C and SPI |
charlesmn | 0:3ac96e360672 | 41 | * @param[in] comms_speed_khz : unsigned short containing the I2C speed in kHz |
charlesmn | 0:3ac96e360672 | 42 | * |
charlesmn | 0:3ac96e360672 | 43 | * @return VL53L1_ERROR_NONE Success |
charlesmn | 0:3ac96e360672 | 44 | * @return "Other error code" See ::VL53L1_Error |
charlesmn | 0:3ac96e360672 | 45 | */ |
charlesmn | 0:3ac96e360672 | 46 | |
charlesmn | 0:3ac96e360672 | 47 | VL53L1_Error VL53L1_CommsInitialise( |
charlesmn | 0:3ac96e360672 | 48 | VL53L1_Dev_t *pdev, |
charlesmn | 0:3ac96e360672 | 49 | uint8_t comms_type, |
charlesmn | 0:3ac96e360672 | 50 | uint16_t comms_speed_khz); |
charlesmn | 0:3ac96e360672 | 51 | |
charlesmn | 0:3ac96e360672 | 52 | |
charlesmn | 0:3ac96e360672 | 53 | /** |
charlesmn | 0:3ac96e360672 | 54 | * @brief Close platform comms. |
charlesmn | 0:3ac96e360672 | 55 | * |
charlesmn | 0:3ac96e360672 | 56 | * @param[in] pdev : pointer to device structure (device handle) |
charlesmn | 0:3ac96e360672 | 57 | * |
charlesmn | 0:3ac96e360672 | 58 | * @return VL53L1_ERROR_NONE Success |
charlesmn | 0:3ac96e360672 | 59 | * @return "Other error code" See ::VL53L1_Error |
charlesmn | 0:3ac96e360672 | 60 | */ |
charlesmn | 0:3ac96e360672 | 61 | |
charlesmn | 0:3ac96e360672 | 62 | VL53L1_Error VL53L1_CommsClose( |
charlesmn | 0:3ac96e360672 | 63 | VL53L1_Dev_t *pdev); |
charlesmn | 0:3ac96e360672 | 64 | |
charlesmn | 0:3ac96e360672 | 65 | |
charlesmn | 0:3ac96e360672 | 66 | /** |
charlesmn | 0:3ac96e360672 | 67 | * @brief Writes the supplied byte buffer to the device |
charlesmn | 0:3ac96e360672 | 68 | * |
charlesmn | 0:3ac96e360672 | 69 | * @param[in] pdev : pointer to device structure (device handle) |
charlesmn | 0:3ac96e360672 | 70 | * @param[in] index : uint16_t register index value |
charlesmn | 0:3ac96e360672 | 71 | * @param[in] pdata : pointer to uint8_t (byte) buffer containing the data to be written |
charlesmn | 0:3ac96e360672 | 72 | * @param[in] count : number of bytes in the supplied byte buffer |
charlesmn | 0:3ac96e360672 | 73 | * |
charlesmn | 0:3ac96e360672 | 74 | * @return VL53L1_ERROR_NONE Success |
charlesmn | 0:3ac96e360672 | 75 | * @return "Other error code" See ::VL53L1_Error |
charlesmn | 0:3ac96e360672 | 76 | */ |
charlesmn | 0:3ac96e360672 | 77 | |
charlesmn | 0:3ac96e360672 | 78 | VL53L1_Error VL53L1_WriteMulti( |
charlesmn | 0:3ac96e360672 | 79 | VL53L1_Dev_t *pdev, |
charlesmn | 0:3ac96e360672 | 80 | uint16_t index, |
charlesmn | 0:3ac96e360672 | 81 | uint8_t *pdata, |
charlesmn | 0:3ac96e360672 | 82 | uint32_t count); |
charlesmn | 0:3ac96e360672 | 83 | |
charlesmn | 0:3ac96e360672 | 84 | |
charlesmn | 0:3ac96e360672 | 85 | /** |
charlesmn | 0:3ac96e360672 | 86 | * @brief Reads the requested number of bytes from the device |
charlesmn | 0:3ac96e360672 | 87 | * |
charlesmn | 0:3ac96e360672 | 88 | * @param[in] pdev : pointer to device structure (device handle) |
charlesmn | 0:3ac96e360672 | 89 | * @param[in] index : uint16_t register index value |
charlesmn | 0:3ac96e360672 | 90 | * @param[out] pdata : pointer to the uint8_t (byte) buffer to store read data |
charlesmn | 0:3ac96e360672 | 91 | * @param[in] count : number of bytes to read |
charlesmn | 0:3ac96e360672 | 92 | * |
charlesmn | 0:3ac96e360672 | 93 | * @return VL53L1_ERROR_NONE Success |
charlesmn | 0:3ac96e360672 | 94 | * @return "Other error code" See ::VL53L1_Error |
charlesmn | 0:3ac96e360672 | 95 | */ |
charlesmn | 0:3ac96e360672 | 96 | |
charlesmn | 0:3ac96e360672 | 97 | VL53L1_Error VL53L1_ReadMulti( |
charlesmn | 0:3ac96e360672 | 98 | VL53L1_Dev_t *pdev, |
charlesmn | 0:3ac96e360672 | 99 | uint16_t index, |
charlesmn | 0:3ac96e360672 | 100 | uint8_t *pdata, |
charlesmn | 0:3ac96e360672 | 101 | uint32_t count); |
charlesmn | 0:3ac96e360672 | 102 | |
charlesmn | 0:3ac96e360672 | 103 | |
charlesmn | 0:3ac96e360672 | 104 | /** |
charlesmn | 0:3ac96e360672 | 105 | * @brief Writes a single byte to the device |
charlesmn | 0:3ac96e360672 | 106 | * |
charlesmn | 0:3ac96e360672 | 107 | * @param[in] pdev : pointer to device structure (device handle) |
charlesmn | 0:3ac96e360672 | 108 | * @param[in] index : uint16_t register index value |
charlesmn | 0:3ac96e360672 | 109 | * @param[in] data : uint8_t data value to write |
charlesmn | 0:3ac96e360672 | 110 | * |
charlesmn | 0:3ac96e360672 | 111 | * @return VL53L1_ERROR_NONE Success |
charlesmn | 0:3ac96e360672 | 112 | * @return "Other error code" See ::VL53L1_Error |
charlesmn | 0:3ac96e360672 | 113 | */ |
charlesmn | 0:3ac96e360672 | 114 | |
charlesmn | 0:3ac96e360672 | 115 | VL53L1_Error VL53L1_WrByte( |
charlesmn | 0:3ac96e360672 | 116 | VL53L1_Dev_t *pdev, |
charlesmn | 0:3ac96e360672 | 117 | uint16_t index, |
charlesmn | 0:3ac96e360672 | 118 | uint8_t data); |
charlesmn | 0:3ac96e360672 | 119 | |
charlesmn | 0:3ac96e360672 | 120 | |
charlesmn | 0:3ac96e360672 | 121 | /** |
charlesmn | 0:3ac96e360672 | 122 | * @brief Writes a single word (16-bit unsigned) to the device |
charlesmn | 0:3ac96e360672 | 123 | * |
charlesmn | 0:3ac96e360672 | 124 | * Manages the big-endian nature of the device register map |
charlesmn | 0:3ac96e360672 | 125 | * (first byte written is the MS byte). |
charlesmn | 0:3ac96e360672 | 126 | * |
charlesmn | 0:3ac96e360672 | 127 | * @param[in] pdev : pointer to device structure (device handle) |
charlesmn | 0:3ac96e360672 | 128 | * @param[in] index : uint16_t register index value |
charlesmn | 0:3ac96e360672 | 129 | * @param[in] data : uin16_t data value write |
charlesmn | 0:3ac96e360672 | 130 | * |
charlesmn | 0:3ac96e360672 | 131 | * @return VL53L1_ERROR_NONE Success |
charlesmn | 0:3ac96e360672 | 132 | * @return "Other error code" See ::VL53L1_Error |
charlesmn | 0:3ac96e360672 | 133 | */ |
charlesmn | 0:3ac96e360672 | 134 | |
charlesmn | 0:3ac96e360672 | 135 | VL53L1_Error VL53L1_WrWord( |
charlesmn | 0:3ac96e360672 | 136 | VL53L1_Dev_t *pdev, |
charlesmn | 0:3ac96e360672 | 137 | uint16_t index, |
charlesmn | 0:3ac96e360672 | 138 | uint16_t data); |
charlesmn | 0:3ac96e360672 | 139 | |
charlesmn | 0:3ac96e360672 | 140 | |
charlesmn | 0:3ac96e360672 | 141 | /** |
charlesmn | 0:3ac96e360672 | 142 | * @brief Writes a single dword (32-bit unsigned) to the device |
charlesmn | 0:3ac96e360672 | 143 | * |
charlesmn | 0:3ac96e360672 | 144 | * Manages the big-endian nature of the device register map |
charlesmn | 0:3ac96e360672 | 145 | * (first byte written is the MS byte). |
charlesmn | 0:3ac96e360672 | 146 | * |
charlesmn | 0:3ac96e360672 | 147 | * @param[in] pdev : pointer to device structure (device handle) |
charlesmn | 0:3ac96e360672 | 148 | * @param[in] index : uint16_t register index value |
charlesmn | 0:3ac96e360672 | 149 | * @param[in] data : uint32_t data value to write |
charlesmn | 0:3ac96e360672 | 150 | * |
charlesmn | 0:3ac96e360672 | 151 | * @return VL53L1_ERROR_NONE Success |
charlesmn | 0:3ac96e360672 | 152 | * @return "Other error code" See ::VL53L1_Error |
charlesmn | 0:3ac96e360672 | 153 | */ |
charlesmn | 0:3ac96e360672 | 154 | |
charlesmn | 0:3ac96e360672 | 155 | VL53L1_Error VL53L1_WrDWord( |
charlesmn | 0:3ac96e360672 | 156 | VL53L1_Dev_t *pdev, |
charlesmn | 0:3ac96e360672 | 157 | uint16_t index, |
charlesmn | 0:3ac96e360672 | 158 | uint32_t data); |
charlesmn | 0:3ac96e360672 | 159 | |
charlesmn | 0:3ac96e360672 | 160 | |
charlesmn | 0:3ac96e360672 | 161 | |
charlesmn | 0:3ac96e360672 | 162 | /** |
charlesmn | 0:3ac96e360672 | 163 | * @brief Reads a single byte from the device |
charlesmn | 0:3ac96e360672 | 164 | * |
charlesmn | 0:3ac96e360672 | 165 | * @param[in] pdev : pointer to device structure (device handle) |
charlesmn | 0:3ac96e360672 | 166 | * @param[in] index : uint16_t register index |
charlesmn | 0:3ac96e360672 | 167 | * @param[out] pdata : pointer to uint8_t data value |
charlesmn | 0:3ac96e360672 | 168 | * |
charlesmn | 0:3ac96e360672 | 169 | * @return VL53L1_ERROR_NONE Success |
charlesmn | 0:3ac96e360672 | 170 | * @return "Other error code" See ::VL53L1_Error |
charlesmn | 0:3ac96e360672 | 171 | * |
charlesmn | 0:3ac96e360672 | 172 | */ |
charlesmn | 0:3ac96e360672 | 173 | |
charlesmn | 0:3ac96e360672 | 174 | VL53L1_Error VL53L1_RdByte( |
charlesmn | 0:3ac96e360672 | 175 | VL53L1_Dev_t *pdev, |
charlesmn | 0:3ac96e360672 | 176 | uint16_t index, |
charlesmn | 0:3ac96e360672 | 177 | uint8_t *pdata); |
charlesmn | 0:3ac96e360672 | 178 | |
charlesmn | 0:3ac96e360672 | 179 | |
charlesmn | 0:3ac96e360672 | 180 | /** |
charlesmn | 0:3ac96e360672 | 181 | * @brief Reads a single word (16-bit unsigned) from the device |
charlesmn | 0:3ac96e360672 | 182 | * |
charlesmn | 0:3ac96e360672 | 183 | * Manages the big-endian nature of the device (first byte read is the MS byte). |
charlesmn | 0:3ac96e360672 | 184 | * |
charlesmn | 0:3ac96e360672 | 185 | * @param[in] pdev : pointer to device structure (device handle) |
charlesmn | 0:3ac96e360672 | 186 | * @param[in] index : uint16_t register index value |
charlesmn | 0:3ac96e360672 | 187 | * @param[out] pdata : pointer to uint16_t data value |
charlesmn | 0:3ac96e360672 | 188 | * |
charlesmn | 0:3ac96e360672 | 189 | * @return VL53L1_ERROR_NONE Success |
charlesmn | 0:3ac96e360672 | 190 | * @return "Other error code" See ::VL53L1_Error |
charlesmn | 0:3ac96e360672 | 191 | */ |
charlesmn | 0:3ac96e360672 | 192 | |
charlesmn | 0:3ac96e360672 | 193 | VL53L1_Error VL53L1_RdWord( |
charlesmn | 0:3ac96e360672 | 194 | VL53L1_Dev_t *pdev, |
charlesmn | 0:3ac96e360672 | 195 | uint16_t index, |
charlesmn | 0:3ac96e360672 | 196 | uint16_t *pdata); |
charlesmn | 0:3ac96e360672 | 197 | |
charlesmn | 0:3ac96e360672 | 198 | |
charlesmn | 0:3ac96e360672 | 199 | /** |
charlesmn | 0:3ac96e360672 | 200 | * @brief Reads a single dword (32-bit unsigned) from the device |
charlesmn | 0:3ac96e360672 | 201 | * |
charlesmn | 0:3ac96e360672 | 202 | * Manages the big-endian nature of the device (first byte read is the MS byte). |
charlesmn | 0:3ac96e360672 | 203 | * |
charlesmn | 0:3ac96e360672 | 204 | * @param[in] pdev : pointer to device structure (device handle) |
charlesmn | 0:3ac96e360672 | 205 | * @param[in] index : uint16_t register index value |
charlesmn | 0:3ac96e360672 | 206 | * @param[out] pdata : pointer to uint32_t data value |
charlesmn | 0:3ac96e360672 | 207 | * |
charlesmn | 0:3ac96e360672 | 208 | * @return VL53L1_ERROR_NONE Success |
charlesmn | 0:3ac96e360672 | 209 | * @return "Other error code" See ::VL53L1_Error |
charlesmn | 0:3ac96e360672 | 210 | */ |
charlesmn | 0:3ac96e360672 | 211 | |
charlesmn | 0:3ac96e360672 | 212 | VL53L1_Error VL53L1_RdDWord( |
charlesmn | 0:3ac96e360672 | 213 | VL53L1_Dev_t *pdev, |
charlesmn | 0:3ac96e360672 | 214 | uint16_t index, |
charlesmn | 0:3ac96e360672 | 215 | uint32_t *pdata); |
charlesmn | 0:3ac96e360672 | 216 | |
charlesmn | 0:3ac96e360672 | 217 | |
charlesmn | 0:3ac96e360672 | 218 | |
charlesmn | 0:3ac96e360672 | 219 | /** |
charlesmn | 0:3ac96e360672 | 220 | * @brief Implements a programmable wait in us |
charlesmn | 0:3ac96e360672 | 221 | * |
charlesmn | 0:3ac96e360672 | 222 | * @param[in] pdev : pointer to device structure (device handle) |
charlesmn | 0:3ac96e360672 | 223 | * @param[in] wait_us : integer wait in micro seconds |
charlesmn | 0:3ac96e360672 | 224 | * |
charlesmn | 0:3ac96e360672 | 225 | * @return VL53L1_ERROR_NONE Success |
charlesmn | 0:3ac96e360672 | 226 | * @return "Other error code" See ::VL53L1_Error |
charlesmn | 0:3ac96e360672 | 227 | */ |
charlesmn | 0:3ac96e360672 | 228 | |
charlesmn | 0:3ac96e360672 | 229 | VL53L1_Error VL53L1_WaitUs( |
charlesmn | 0:3ac96e360672 | 230 | VL53L1_Dev_t *pdev, |
charlesmn | 0:3ac96e360672 | 231 | int32_t wait_us); |
charlesmn | 0:3ac96e360672 | 232 | |
charlesmn | 0:3ac96e360672 | 233 | |
charlesmn | 0:3ac96e360672 | 234 | /** |
charlesmn | 0:3ac96e360672 | 235 | * @brief Implements a programmable wait in ms |
charlesmn | 0:3ac96e360672 | 236 | * |
charlesmn | 0:3ac96e360672 | 237 | * @param[in] pdev : pointer to device structure (device handle) |
charlesmn | 0:3ac96e360672 | 238 | * @param[in] wait_ms : integer wait in milliseconds |
charlesmn | 0:3ac96e360672 | 239 | * |
charlesmn | 0:3ac96e360672 | 240 | * @return VL53L1_ERROR_NONE Success |
charlesmn | 0:3ac96e360672 | 241 | * @return "Other error code" See ::VL53L1_Error |
charlesmn | 0:3ac96e360672 | 242 | */ |
charlesmn | 0:3ac96e360672 | 243 | |
charlesmn | 0:3ac96e360672 | 244 | VL53L1_Error VL53L1_WaitMs( |
charlesmn | 0:3ac96e360672 | 245 | VL53L1_Dev_t *pdev, |
charlesmn | 0:3ac96e360672 | 246 | int32_t wait_ms); |
charlesmn | 0:3ac96e360672 | 247 | |
charlesmn | 0:3ac96e360672 | 248 | |
charlesmn | 0:3ac96e360672 | 249 | /** |
charlesmn | 0:3ac96e360672 | 250 | * @brief Get the frequency of the timer used for ranging results time stamps |
charlesmn | 0:3ac96e360672 | 251 | * |
charlesmn | 0:3ac96e360672 | 252 | * @param[out] ptimer_freq_hz : pointer for timer frequency |
charlesmn | 0:3ac96e360672 | 253 | * |
charlesmn | 0:3ac96e360672 | 254 | * @return VL53L1_ERROR_NONE Success |
charlesmn | 0:3ac96e360672 | 255 | * @return "Other error code" See ::VL53L1_Error |
charlesmn | 0:3ac96e360672 | 256 | */ |
charlesmn | 0:3ac96e360672 | 257 | |
charlesmn | 0:3ac96e360672 | 258 | VL53L1_Error VL53L1_GetTimerFrequency(int32_t *ptimer_freq_hz); |
charlesmn | 0:3ac96e360672 | 259 | |
charlesmn | 0:3ac96e360672 | 260 | /** |
charlesmn | 0:3ac96e360672 | 261 | * @brief Get the timer value in units of timer_freq_hz (see VL53L1_get_timestamp_frequency()) |
charlesmn | 0:3ac96e360672 | 262 | * |
charlesmn | 0:3ac96e360672 | 263 | * @param[out] ptimer_count : pointer for timer count value |
charlesmn | 0:3ac96e360672 | 264 | * |
charlesmn | 0:3ac96e360672 | 265 | * @return VL53L1_ERROR_NONE Success |
charlesmn | 0:3ac96e360672 | 266 | * @return "Other error code" See ::VL53L1_Error |
charlesmn | 0:3ac96e360672 | 267 | */ |
charlesmn | 0:3ac96e360672 | 268 | |
charlesmn | 0:3ac96e360672 | 269 | VL53L1_Error VL53L1_GetTimerValue(int32_t *ptimer_count); |
charlesmn | 0:3ac96e360672 | 270 | |
charlesmn | 0:3ac96e360672 | 271 | |
charlesmn | 0:3ac96e360672 | 272 | /** |
charlesmn | 0:3ac96e360672 | 273 | * @brief Set the mode of a specified GPIO pin |
charlesmn | 0:3ac96e360672 | 274 | * |
charlesmn | 0:3ac96e360672 | 275 | * @param pin - an identifier specifying the pin being modified - defined per platform |
charlesmn | 0:3ac96e360672 | 276 | * |
charlesmn | 0:3ac96e360672 | 277 | * @param mode - an identifier specifying the requested mode - defined per platform |
charlesmn | 0:3ac96e360672 | 278 | * |
charlesmn | 0:3ac96e360672 | 279 | * @return VL53L1_ERROR_NONE Success |
charlesmn | 0:3ac96e360672 | 280 | * @return "Other error code" See ::VL53L1_Error |
charlesmn | 0:3ac96e360672 | 281 | */ |
charlesmn | 0:3ac96e360672 | 282 | |
charlesmn | 0:3ac96e360672 | 283 | VL53L1_Error VL53L1_GpioSetMode(uint8_t pin, uint8_t mode); |
charlesmn | 0:3ac96e360672 | 284 | |
charlesmn | 0:3ac96e360672 | 285 | |
charlesmn | 0:3ac96e360672 | 286 | /** |
charlesmn | 0:3ac96e360672 | 287 | * @brief Set the value of a specified GPIO pin |
charlesmn | 0:3ac96e360672 | 288 | * |
charlesmn | 0:3ac96e360672 | 289 | * @param pin - an identifier specifying the pin being modified - defined per platform |
charlesmn | 0:3ac96e360672 | 290 | * |
charlesmn | 0:3ac96e360672 | 291 | * @param value - a value to set on the GPIO pin - typically 0 or 1 |
charlesmn | 0:3ac96e360672 | 292 | * |
charlesmn | 0:3ac96e360672 | 293 | * @return VL53L1_ERROR_NONE Success |
charlesmn | 0:3ac96e360672 | 294 | * @return "Other error code" See ::VL53L1_Error |
charlesmn | 0:3ac96e360672 | 295 | */ |
charlesmn | 0:3ac96e360672 | 296 | |
charlesmn | 0:3ac96e360672 | 297 | VL53L1_Error VL53L1_GpioSetValue(uint8_t pin, uint8_t value); |
charlesmn | 0:3ac96e360672 | 298 | |
charlesmn | 0:3ac96e360672 | 299 | |
charlesmn | 0:3ac96e360672 | 300 | /** |
charlesmn | 0:3ac96e360672 | 301 | * @brief Get the value of a specified GPIO pin |
charlesmn | 0:3ac96e360672 | 302 | * |
charlesmn | 0:3ac96e360672 | 303 | * @param pin - an identifier specifying the pin being modified - defined per platform |
charlesmn | 0:3ac96e360672 | 304 | * |
charlesmn | 0:3ac96e360672 | 305 | * @param pvalue - a value retrieved from the GPIO pin - typically 0 or 1 |
charlesmn | 0:3ac96e360672 | 306 | * |
charlesmn | 0:3ac96e360672 | 307 | * @return VL53L1_ERROR_NONE Success |
charlesmn | 0:3ac96e360672 | 308 | * @return "Other error code" See ::VL53L1_Error |
charlesmn | 0:3ac96e360672 | 309 | */ |
charlesmn | 0:3ac96e360672 | 310 | |
charlesmn | 0:3ac96e360672 | 311 | VL53L1_Error VL53L1_GpioGetValue(uint8_t pin, uint8_t *pvalue); |
charlesmn | 0:3ac96e360672 | 312 | |
charlesmn | 0:3ac96e360672 | 313 | |
charlesmn | 0:3ac96e360672 | 314 | /** |
charlesmn | 0:3ac96e360672 | 315 | * @brief Sets and clears the XShutdown pin on the Ewok |
charlesmn | 0:3ac96e360672 | 316 | * |
charlesmn | 0:3ac96e360672 | 317 | * @param value - the value for xshutdown - 0 = in reset, 1 = operational |
charlesmn | 0:3ac96e360672 | 318 | * |
charlesmn | 0:3ac96e360672 | 319 | * @return VL53L1_ERROR_NONE Success |
charlesmn | 0:3ac96e360672 | 320 | * @return "Other error code" See ::VL53L1_Error |
charlesmn | 0:3ac96e360672 | 321 | */ |
charlesmn | 0:3ac96e360672 | 322 | |
charlesmn | 0:3ac96e360672 | 323 | VL53L1_Error VL53L1_GpioXshutdown(uint8_t value); |
charlesmn | 0:3ac96e360672 | 324 | |
charlesmn | 0:3ac96e360672 | 325 | |
charlesmn | 0:3ac96e360672 | 326 | /** |
charlesmn | 0:3ac96e360672 | 327 | * @brief Sets and clears the Comms Mode pin (NCS) on the Ewok |
charlesmn | 0:3ac96e360672 | 328 | * |
charlesmn | 0:3ac96e360672 | 329 | * @param value - the value for comms select - 0 = I2C, 1 = SPI |
charlesmn | 0:3ac96e360672 | 330 | * |
charlesmn | 0:3ac96e360672 | 331 | * @return VL53L1_ERROR_NONE Success |
charlesmn | 0:3ac96e360672 | 332 | * @return "Other error code" See ::VL53L1_Error |
charlesmn | 0:3ac96e360672 | 333 | */ |
charlesmn | 0:3ac96e360672 | 334 | |
charlesmn | 0:3ac96e360672 | 335 | VL53L1_Error VL53L1_GpioCommsSelect(uint8_t value); |
charlesmn | 0:3ac96e360672 | 336 | |
charlesmn | 0:3ac96e360672 | 337 | |
charlesmn | 0:3ac96e360672 | 338 | /** |
charlesmn | 0:3ac96e360672 | 339 | * @brief Enables and disables the power to the Ewok module |
charlesmn | 0:3ac96e360672 | 340 | * |
charlesmn | 0:3ac96e360672 | 341 | * @param value - the state of the power supply - 0 = power off, 1 = power on |
charlesmn | 0:3ac96e360672 | 342 | * |
charlesmn | 0:3ac96e360672 | 343 | * @return VL53L1_ERROR_NONE Success |
charlesmn | 0:3ac96e360672 | 344 | * @return "Other error code" See ::VL53L1_Error |
charlesmn | 0:3ac96e360672 | 345 | */ |
charlesmn | 0:3ac96e360672 | 346 | |
charlesmn | 0:3ac96e360672 | 347 | VL53L1_Error VL53L1_GpioPowerEnable(uint8_t value); |
charlesmn | 0:3ac96e360672 | 348 | |
charlesmn | 0:3ac96e360672 | 349 | /** |
charlesmn | 0:3ac96e360672 | 350 | * @brief Enables callbacks to the supplied funtion pointer when Ewok interrupts ocurr |
charlesmn | 0:3ac96e360672 | 351 | * |
charlesmn | 0:3ac96e360672 | 352 | * @param function - a function callback supplies by the caller, for interrupt notification |
charlesmn | 0:3ac96e360672 | 353 | * @param edge_type - falling edge or rising edge interrupt detection |
charlesmn | 0:3ac96e360672 | 354 | * |
charlesmn | 0:3ac96e360672 | 355 | * @return VL53L1_ERROR_NONE Success |
charlesmn | 0:3ac96e360672 | 356 | * @return "Other error code" See ::VL53L1_Error |
charlesmn | 0:3ac96e360672 | 357 | */ |
charlesmn | 0:3ac96e360672 | 358 | |
charlesmn | 0:3ac96e360672 | 359 | VL53L1_Error VL53L1_GpioInterruptEnable(void (*function)(void), uint8_t edge_type); |
charlesmn | 0:3ac96e360672 | 360 | |
charlesmn | 0:3ac96e360672 | 361 | |
charlesmn | 0:3ac96e360672 | 362 | /** |
charlesmn | 0:3ac96e360672 | 363 | * @brief Disables the callback on Ewok interrupts |
charlesmn | 0:3ac96e360672 | 364 | * |
charlesmn | 0:3ac96e360672 | 365 | * @return VL53L1_ERROR_NONE Success |
charlesmn | 0:3ac96e360672 | 366 | * @return "Other error code" See ::VL53L1_Error |
charlesmn | 0:3ac96e360672 | 367 | */ |
charlesmn | 0:3ac96e360672 | 368 | |
charlesmn | 0:3ac96e360672 | 369 | VL53L1_Error VL53L1_GpioInterruptDisable(void); |
charlesmn | 0:3ac96e360672 | 370 | |
charlesmn | 0:3ac96e360672 | 371 | |
charlesmn | 0:3ac96e360672 | 372 | /* |
charlesmn | 0:3ac96e360672 | 373 | * @brief Gets current system tick count in [ms] |
charlesmn | 0:3ac96e360672 | 374 | * |
lugandc | 18:0696efe39d08 | 375 | * @param[in] pdev : pointer to device structure (device handle) |
charlesmn | 0:3ac96e360672 | 376 | * @return time_ms : current time in [ms] |
charlesmn | 0:3ac96e360672 | 377 | * |
charlesmn | 0:3ac96e360672 | 378 | * @return VL53L1_ERROR_NONE Success |
charlesmn | 0:3ac96e360672 | 379 | * @return "Other error code" See ::VL53L1_Error |
charlesmn | 0:3ac96e360672 | 380 | */ |
charlesmn | 0:3ac96e360672 | 381 | |
charlesmn | 0:3ac96e360672 | 382 | VL53L1_Error VL53L1_GetTickCount( |
lugandc | 18:0696efe39d08 | 383 | VL53L1_Dev_t *pdev, |
charlesmn | 0:3ac96e360672 | 384 | uint32_t *ptime_ms); |
charlesmn | 0:3ac96e360672 | 385 | |
charlesmn | 0:3ac96e360672 | 386 | |
charlesmn | 0:3ac96e360672 | 387 | /** |
charlesmn | 0:3ac96e360672 | 388 | * @brief Register "wait for value" polling routine |
charlesmn | 0:3ac96e360672 | 389 | * |
charlesmn | 0:3ac96e360672 | 390 | * Port of the V2WReg Script function WaitValueMaskEx() |
charlesmn | 0:3ac96e360672 | 391 | * |
charlesmn | 0:3ac96e360672 | 392 | * @param[in] pdev : pointer to device structure (device handle) |
charlesmn | 0:3ac96e360672 | 393 | * @param[in] timeout_ms : timeout in [ms] |
charlesmn | 0:3ac96e360672 | 394 | * @param[in] index : uint16_t register index value |
charlesmn | 0:3ac96e360672 | 395 | * @param[in] value : value to wait for |
charlesmn | 0:3ac96e360672 | 396 | * @param[in] mask : mask to be applied before comparison with value |
charlesmn | 0:3ac96e360672 | 397 | * @param[in] poll_delay_ms : polling delay been each read transaction in [ms] |
charlesmn | 0:3ac96e360672 | 398 | * |
charlesmn | 0:3ac96e360672 | 399 | * @return VL53L1_ERROR_NONE Success |
charlesmn | 0:3ac96e360672 | 400 | * @return "Other error code" See ::VL53L1_Error |
charlesmn | 0:3ac96e360672 | 401 | */ |
charlesmn | 0:3ac96e360672 | 402 | |
charlesmn | 0:3ac96e360672 | 403 | VL53L1_Error VL53L1_WaitValueMaskEx( |
charlesmn | 0:3ac96e360672 | 404 | VL53L1_Dev_t *pdev, |
charlesmn | 0:3ac96e360672 | 405 | uint32_t timeout_ms, |
charlesmn | 0:3ac96e360672 | 406 | uint16_t index, |
charlesmn | 0:3ac96e360672 | 407 | uint8_t value, |
charlesmn | 0:3ac96e360672 | 408 | uint8_t mask, |
charlesmn | 0:3ac96e360672 | 409 | uint32_t poll_delay_ms); |
charlesmn | 0:3ac96e360672 | 410 | |
charlesmn | 0:3ac96e360672 | 411 | #ifdef __cplusplus |
charlesmn | 0:3ac96e360672 | 412 | } |
charlesmn | 0:3ac96e360672 | 413 | #endif |
charlesmn | 0:3ac96e360672 | 414 | |
charlesmn | 0:3ac96e360672 | 415 | #endif |
charlesmn | 0:3ac96e360672 | 416 |