Skip to content

Commit

Permalink
Update ULD to 1.3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
RJRP44 committed Mar 7, 2024
1 parent baf7a58 commit bcd440b
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# VL53L5CX library for ESP32

A vl53l5cx library for esp32 using the **esp-idf framework**. This library is based
on [ST's Ultra Lite Driver (ULD) for VL53L5CX](https://www.st.com/content/st_com/en/products/embedded-software/imaging-software/stsw-img023.html) v1.3.10
on [ST's Ultra Lite Driver (ULD) for VL53L5CX](https://www.st.com/content/st_com/en/products/embedded-software/imaging-software/stsw-img023.html) v1.3.11
. This library is just an adaptation of the ST's library for esp-32.

> **Warning**
Expand Down Expand Up @@ -44,7 +44,7 @@ So, you can use the [IDF Component Manager](https://docs.espressif.com/projects/
To add this component to your project, run:

```log
idf.py add-dependency "rjrp44/vl53l5cx^2.0.3"
idf.py add-dependency "rjrp44/vl53l5cx^2.0.4"
```


Expand Down
2 changes: 1 addition & 1 deletion idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "2.0.3"
version: "2.0.4"
description: "A vl53l5cx library for esp32 using the esp-idf framework."
url: "https://github.com/RJRP44/VL53L5CX-Library"
repository: "https://github.com/RJRP44/VL53L5CX-Library"
Expand Down
27 changes: 26 additions & 1 deletion include/vl53l5cx_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* @brief Current driver version.
*/

#define VL53L5CX_API_REVISION "VL53L5CX_1.3.10"
#define VL53L5CX_API_REVISION "VL53L5CX_1.3.11"

/**
* @brief Default I2C address of VL53L5CX sensor. Can be changed using function
Expand Down Expand Up @@ -159,6 +159,7 @@
#define VL53L5CX_DCI_FW_NB_TARGET ((uint16_t)0x5478)
#define VL53L5CX_DCI_RANGING_MODE ((uint16_t)0xAD30U)
#define VL53L5CX_DCI_DSS_CONFIG ((uint16_t)0xAD38U)
#define VL53L5CX_DCI_VHV_CONFIG ((uint16_t)0xAD60U)
#define VL53L5CX_DCI_TARGET_ORDER ((uint16_t)0xAE64U)
#define VL53L5CX_DCI_SHARPENER ((uint16_t)0xAED8U)
#define VL53L5CX_DCI_INTERNAL_CP ((uint16_t)0xB39CU)
Expand Down Expand Up @@ -652,6 +653,30 @@ uint8_t vl53l5cx_enable_internal_cp(
uint8_t vl53l5cx_disable_internal_cp(
VL53L5CX_Configuration *p_dev);

/**
* @brief This function is used to get the number of frames between 2 temperature
* compensation.
* @param (VL53L5CX_Configuration) *p_dev : VL53L5CX configuration structure.
* @param (uint32_t) *p_repeat_count : Number of frames before next temperature
* compensation. Set to 0 to disable the feature (default configuration).
*/
uint8_t vl53l5cx_get_VHV_repeat_count(
VL53L5CX_Configuration *p_dev,
uint32_t *p_repeat_count);

/**
* @brief This function is used to set a periodic temperature compensation. By
* setting a repeat count different to 0 the firmware automatically runs a
* temperature calibration every N frames.
* default the repeat count is set to 0
* @param (VL53L5CX_Configuration) *p_dev : VL53L5CX configuration structure.
* @param (uint32_t) repeat_count : Number of frames between temperature
* compensation. Set to 0 to disable the feature (default configuration).
*/
uint8_t vl53l5cx_set_VHV_repeat_count(
VL53L5CX_Configuration *p_dev,
uint32_t repeat_count);

/**
* @brief This function can be used to read 'extra data' from DCI. Using a known
* index, the function fills the casted structure passed in argument.
Expand Down
26 changes: 26 additions & 0 deletions vl53l5cx_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,32 @@ uint8_t vl53l5cx_disable_internal_cp(
return status;
}

uint8_t vl53l5cx_get_VHV_repeat_count(
VL53L5CX_Configuration *p_dev,
uint32_t *p_repeat_count)
{
uint8_t status = VL53L5CX_STATUS_OK;
status |= vl53l5cx_dci_read_data(p_dev, (uint8_t*)p_dev->temp_buffer,
VL53L5CX_DCI_VHV_CONFIG, 16);

*p_repeat_count = ((uint32_t)p_dev->temp_buffer[7] << 24)
| ((uint32_t)p_dev->temp_buffer[6] << 16)
| ((uint32_t)p_dev->temp_buffer[5] << 8)
| (uint32_t)p_dev->temp_buffer[4];

return status;
}

uint8_t vl53l5cx_set_VHV_repeat_count(
VL53L5CX_Configuration *p_dev,
uint32_t repeat_count)
{
uint8_t status = VL53L5CX_STATUS_OK;
status |= vl53l5cx_dci_replace_data(p_dev, p_dev->temp_buffer,
VL53L5CX_DCI_VHV_CONFIG, 16, (uint8_t*)&repeat_count, 4, 0x4);
return status;
}

uint8_t vl53l5cx_dci_read_data(
VL53L5CX_Configuration *p_dev,
uint8_t *data,
Expand Down

0 comments on commit bcd440b

Please sign in to comment.