Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: X_NUCLEO_COMMON ST_INTERFACES
vl53l1_platform.h File Reference
All end user OS/platform/application porting. More...
Go to the source code of this file.
Functions | |
| VL53L1_Error | VL53L1_CommsInitialise (VL53L1_Dev_t *pdev, uint8_t comms_type, uint16_t comms_speed_khz) |
| Initialise platform comms. | |
| VL53L1_Error | VL53L1_CommsClose (VL53L1_Dev_t *pdev) |
| Close platform comms. | |
| VL53L1_Error | VL53L1_WriteMulti (VL53L1_Dev_t *pdev, uint16_t index, uint8_t *pdata, uint32_t count) |
| Writes the supplied byte buffer to the device. | |
| VL53L1_Error | VL53L1_ReadMulti (VL53L1_Dev_t *pdev, uint16_t index, uint8_t *pdata, uint32_t count) |
| Reads the requested number of bytes from the device. | |
| VL53L1_Error | VL53L1_WrByte (VL53L1_Dev_t *pdev, uint16_t index, uint8_t data) |
| Writes a single byte to the device. | |
| VL53L1_Error | VL53L1_WrWord (VL53L1_Dev_t *pdev, uint16_t index, uint16_t data) |
| Writes a single word (16-bit unsigned) to the device. | |
| VL53L1_Error | VL53L1_WrDWord (VL53L1_Dev_t *pdev, uint16_t index, uint32_t data) |
| Writes a single dword (32-bit unsigned) to the device. | |
| VL53L1_Error | VL53L1_RdByte (VL53L1_Dev_t *pdev, uint16_t index, uint8_t *pdata) |
| Reads a single byte from the device. | |
| VL53L1_Error | VL53L1_RdWord (VL53L1_Dev_t *pdev, uint16_t index, uint16_t *pdata) |
| Reads a single word (16-bit unsigned) from the device. | |
| VL53L1_Error | VL53L1_RdDWord (VL53L1_Dev_t *pdev, uint16_t index, uint32_t *pdata) |
| Reads a single dword (32-bit unsigned) from the device. | |
| VL53L1_Error | VL53L1_WaitUs (VL53L1_Dev_t *pdev, int32_t wait_us) |
| Implements a programmable wait in us. | |
| VL53L1_Error | VL53L1_WaitMs (VL53L1_Dev_t *pdev, int32_t wait_ms) |
| Implements a programmable wait in ms. | |
| VL53L1_Error | VL53L1_GetTimerFrequency (int32_t *ptimer_freq_hz) |
| Get the frequency of the timer used for ranging results time stamps. | |
| VL53L1_Error | VL53L1_GetTimerValue (int32_t *ptimer_count) |
| Get the timer value in units of timer_freq_hz (see VL53L1_get_timestamp_frequency()) | |
| VL53L1_Error | VL53L1_GpioSetMode (uint8_t pin, uint8_t mode) |
| Set the mode of a specified GPIO pin. | |
| VL53L1_Error | VL53L1_GpioSetValue (uint8_t pin, uint8_t value) |
| Set the value of a specified GPIO pin. | |
| VL53L1_Error | VL53L1_GpioGetValue (uint8_t pin, uint8_t *pvalue) |
| Get the value of a specified GPIO pin. | |
| VL53L1_Error | VL53L1_GpioXshutdown (uint8_t value) |
| Sets and clears the XShutdown pin on the Ewok. | |
| VL53L1_Error | VL53L1_GpioCommsSelect (uint8_t value) |
| Sets and clears the Comms Mode pin (NCS) on the Ewok. | |
| VL53L1_Error | VL53L1_GpioPowerEnable (uint8_t value) |
| Enables and disables the power to the Ewok module. | |
| VL53L1_Error | VL53L1_GpioInterruptEnable (void(*function)(void), uint8_t edge_type) |
| Enables callbacks to the supplied funtion pointer when Ewok interrupts ocurr. | |
| VL53L1_Error | VL53L1_GpioInterruptDisable (void) |
| Disables the callback on Ewok interrupts. | |
| VL53L1_Error | VL53L1_WaitValueMaskEx (VL53L1_Dev_t *pdev, uint32_t timeout_ms, uint16_t index, uint8_t value, uint8_t mask, uint32_t poll_delay_ms) |
| Register "wait for value" polling routine. | |
Detailed Description
All end user OS/platform/application porting.
Definition in file vl53l1_platform.h.
Function Documentation
| VL53L1_Error VL53L1_CommsClose | ( | VL53L1_Dev_t * | pdev ) |
Close platform comms.
- Parameters:
-
[in] pdev : pointer to device structure (device handle)
- Returns:
- VL53L1_ERROR_NONE Success
- "Other error code" See VL53L1_Error
| VL53L1_Error VL53L1_CommsInitialise | ( | VL53L1_Dev_t * | pdev, |
| uint8_t | comms_type, | ||
| uint16_t | comms_speed_khz | ||
| ) |
Initialise platform comms.
- Parameters:
-
[in] pdev : pointer to device structure (device handle) [in] comms_type : selects between I2C and SPI [in] comms_speed_khz : unsigned short containing the I2C speed in kHz
- Returns:
- VL53L1_ERROR_NONE Success
- "Other error code" See VL53L1_Error
| VL53L1_Error VL53L1_GetTimerFrequency | ( | int32_t * | ptimer_freq_hz ) |
Get the frequency of the timer used for ranging results time stamps.
- Parameters:
-
[out] ptimer_freq_hz : pointer for timer frequency
- Returns:
- VL53L1_ERROR_NONE Success
- "Other error code" See VL53L1_Error
Definition at line 220 of file vl53l1_platform.c.
| VL53L1_Error VL53L1_GetTimerValue | ( | int32_t * | ptimer_count ) |
Get the timer value in units of timer_freq_hz (see VL53L1_get_timestamp_frequency())
- Parameters:
-
[out] ptimer_count : pointer for timer count value
- Returns:
- VL53L1_ERROR_NONE Success
- "Other error code" See VL53L1_Error
| VL53L1_Error VL53L1_GpioCommsSelect | ( | uint8_t | value ) |
Sets and clears the Comms Mode pin (NCS) on the Ewok.
- Parameters:
-
value - the value for comms select - 0 = I2C, 1 = SPI
- Returns:
- VL53L1_ERROR_NONE Success
- "Other error code" See VL53L1_Error
| VL53L1_Error VL53L1_GpioGetValue | ( | uint8_t | pin, |
| uint8_t * | pvalue | ||
| ) |
Get the value of a specified GPIO pin.
- Parameters:
-
pin - an identifier specifying the pin being modified - defined per platform pvalue - a value retrieved from the GPIO pin - typically 0 or 1
- Returns:
- VL53L1_ERROR_NONE Success
- "Other error code" See VL53L1_Error
| VL53L1_Error VL53L1_GpioInterruptDisable | ( | void | ) |
Disables the callback on Ewok interrupts.
- Returns:
- VL53L1_ERROR_NONE Success
- "Other error code" See VL53L1_Error
| VL53L1_Error VL53L1_GpioInterruptEnable | ( | void(*)(void) | function, |
| uint8_t | edge_type | ||
| ) |
Enables callbacks to the supplied funtion pointer when Ewok interrupts ocurr.
- Parameters:
-
function - a function callback supplies by the caller, for interrupt notification edge_type - falling edge or rising edge interrupt detection
- Returns:
- VL53L1_ERROR_NONE Success
- "Other error code" See VL53L1_Error
| VL53L1_Error VL53L1_GpioPowerEnable | ( | uint8_t | value ) |
Enables and disables the power to the Ewok module.
- Parameters:
-
value - the state of the power supply - 0 = power off, 1 = power on
- Returns:
- VL53L1_ERROR_NONE Success
- "Other error code" See VL53L1_Error
| VL53L1_Error VL53L1_GpioSetMode | ( | uint8_t | pin, |
| uint8_t | mode | ||
| ) |
Set the mode of a specified GPIO pin.
- Parameters:
-
pin - an identifier specifying the pin being modified - defined per platform mode - an identifier specifying the requested mode - defined per platform
- Returns:
- VL53L1_ERROR_NONE Success
- "Other error code" See VL53L1_Error
| VL53L1_Error VL53L1_GpioSetValue | ( | uint8_t | pin, |
| uint8_t | value | ||
| ) |
Set the value of a specified GPIO pin.
- Parameters:
-
pin - an identifier specifying the pin being modified - defined per platform value - a value to set on the GPIO pin - typically 0 or 1
- Returns:
- VL53L1_ERROR_NONE Success
- "Other error code" See VL53L1_Error
| VL53L1_Error VL53L1_GpioXshutdown | ( | uint8_t | value ) |
Sets and clears the XShutdown pin on the Ewok.
- Parameters:
-
value - the value for xshutdown - 0 = in reset, 1 = operational
- Returns:
- VL53L1_ERROR_NONE Success
- "Other error code" See VL53L1_Error
| VL53L1_Error VL53L1_RdByte | ( | VL53L1_Dev_t * | pdev, |
| uint16_t | index, | ||
| uint8_t * | pdata | ||
| ) |
Reads a single byte from the device.
- Parameters:
-
[in] pdev : pointer to device structure (device handle) [in] index : uint16_t register index [out] pdata : pointer to uint8_t data value
- Returns:
- VL53L1_ERROR_NONE Success
- "Other error code" See VL53L1_Error
| VL53L1_Error VL53L1_RdDWord | ( | VL53L1_Dev_t * | pdev, |
| uint16_t | index, | ||
| uint32_t * | pdata | ||
| ) |
Reads a single dword (32-bit unsigned) from the device.
Manages the big-endian nature of the device (first byte read is the MS byte).
- Parameters:
-
[in] pdev : pointer to device structure (device handle) [in] index : uint16_t register index value [out] pdata : pointer to uint32_t data value
- Returns:
- VL53L1_ERROR_NONE Success
- "Other error code" See VL53L1_Error
| VL53L1_Error VL53L1_RdWord | ( | VL53L1_Dev_t * | pdev, |
| uint16_t | index, | ||
| uint16_t * | pdata | ||
| ) |
Reads a single word (16-bit unsigned) from the device.
Manages the big-endian nature of the device (first byte read is the MS byte).
- Parameters:
-
[in] pdev : pointer to device structure (device handle) [in] index : uint16_t register index value [out] pdata : pointer to uint16_t data value
- Returns:
- VL53L1_ERROR_NONE Success
- "Other error code" See VL53L1_Error
| VL53L1_Error VL53L1_ReadMulti | ( | VL53L1_Dev_t * | pdev, |
| uint16_t | index, | ||
| uint8_t * | pdata, | ||
| uint32_t | count | ||
| ) |
Reads the requested number of bytes from the device.
- Parameters:
-
[in] pdev : pointer to device structure (device handle) [in] index : uint16_t register index value [out] pdata : pointer to the uint8_t (byte) buffer to store read data [in] count : number of bytes to read
- Returns:
- VL53L1_ERROR_NONE Success
- "Other error code" See VL53L1_Error
| VL53L1_Error VL53L1_WaitMs | ( | VL53L1_Dev_t * | pdev, |
| int32_t | wait_ms | ||
| ) |
Implements a programmable wait in ms.
- Parameters:
-
[in] pdev : pointer to device structure (device handle) [in] wait_ms : integer wait in milliseconds
- Returns:
- VL53L1_ERROR_NONE Success
- "Other error code" See VL53L1_Error
Definition at line 229 of file vl53l1_platform.c.
| VL53L1_Error VL53L1_WaitUs | ( | VL53L1_Dev_t * | pdev, |
| int32_t | wait_us | ||
| ) |
Implements a programmable wait in us.
- Parameters:
-
[in] pdev : pointer to device structure (device handle) [in] wait_us : integer wait in micro seconds
- Returns:
- VL53L1_ERROR_NONE Success
- "Other error code" See VL53L1_Error
Definition at line 236 of file vl53l1_platform.c.
| VL53L1_Error VL53L1_WaitValueMaskEx | ( | VL53L1_Dev_t * | pdev, |
| uint32_t | timeout_ms, | ||
| uint16_t | index, | ||
| uint8_t | value, | ||
| uint8_t | mask, | ||
| uint32_t | poll_delay_ms | ||
| ) |
Register "wait for value" polling routine.
Port of the V2WReg Script function WaitValueMaskEx()
- Parameters:
-
[in] pdev : pointer to device structure (device handle) [in] timeout_ms : timeout in [ms] [in] index : uint16_t register index value [in] value : value to wait for [in] mask : mask to be applied before comparison with value [in] poll_delay_ms : polling delay been each read transaction in [ms]
- Returns:
- VL53L1_ERROR_NONE Success
- "Other error code" See VL53L1_Error
Definition at line 242 of file vl53l1_platform.c.
| VL53L1_Error VL53L1_WrByte | ( | VL53L1_Dev_t * | pdev, |
| uint16_t | index, | ||
| uint8_t | data | ||
| ) |
Writes a single byte to the device.
- Parameters:
-
[in] pdev : pointer to device structure (device handle) [in] index : uint16_t register index value [in] data : uint8_t data value to write
- Returns:
- VL53L1_ERROR_NONE Success
- "Other error code" See VL53L1_Error
| VL53L1_Error VL53L1_WrDWord | ( | VL53L1_Dev_t * | pdev, |
| uint16_t | index, | ||
| uint32_t | data | ||
| ) |
Writes a single dword (32-bit unsigned) to the device.
Manages the big-endian nature of the device register map (first byte written is the MS byte).
- Parameters:
-
[in] pdev : pointer to device structure (device handle) [in] index : uint16_t register index value [in] data : uint32_t data value to write
- Returns:
- VL53L1_ERROR_NONE Success
- "Other error code" See VL53L1_Error
| VL53L1_Error VL53L1_WriteMulti | ( | VL53L1_Dev_t * | pdev, |
| uint16_t | index, | ||
| uint8_t * | pdata, | ||
| uint32_t | count | ||
| ) |
Writes the supplied byte buffer to the device.
- Parameters:
-
[in] pdev : pointer to device structure (device handle) [in] index : uint16_t register index value [in] pdata : pointer to uint8_t (byte) buffer containing the data to be written [in] count : number of bytes in the supplied byte buffer
- Returns:
- VL53L1_ERROR_NONE Success
- "Other error code" See VL53L1_Error
| VL53L1_Error VL53L1_WrWord | ( | VL53L1_Dev_t * | pdev, |
| uint16_t | index, | ||
| uint16_t | data | ||
| ) |
Writes a single word (16-bit unsigned) to the device.
Manages the big-endian nature of the device register map (first byte written is the MS byte).
- Parameters:
-
[in] pdev : pointer to device structure (device handle) [in] index : uint16_t register index value [in] data : uin16_t data value write
- Returns:
- VL53L1_ERROR_NONE Success
- "Other error code" See VL53L1_Error
Generated on Thu Jul 14 2022 10:20:22 by
1.7.2