Skip to content

Commit 34b8cd2

Browse files
committed
Update platform and README.md
1 parent 39c1b43 commit 34b8cd2

File tree

5 files changed

+117
-182
lines changed

5 files changed

+117
-182
lines changed

LICENCE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License
22

3-
Copyright (c) 2022, RJRP
3+
Copyright (c) 2023, RJRP
44
All rights reserved.
55

66
Redistribution and use in source and binary forms, with or without

README.md

Lines changed: 38 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
<h1 align="center"> Vl53l5cx library for ESP32 </h1>
2-
<p align="center">
3-
<img align="center" src="https://seeklogo.com/images/E/espressif-systems-logo-1350B9E771-seeklogo.com.png" alt="espressif logo" width="40">
4-
</p>
1+
# VL53L5CX library for ESP32
52

63
A vl53l5cx library for esp32 using the **esp-idf framework**. This library is based
74
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)
@@ -10,108 +7,64 @@ on [ST's Ultra Lite Driver (ULD) for VL53L5CX](https://www.st.com/content/st_co
107
> **Warning**
118
> This Library is **not** compatible with Arduino framework
129
13-
## 📌 Contents
10+
## Contents 📌
1411

15-
* [Installation](#installation)
16-
* [Examples](#examples)
17-
* [Structure](#component-structure)
12+
* [Getting started](#Getting-started)
13+
* [Wiring for the VL53L5CX-SATEL](#wiring-for-the-vl53l5cx-satel- )
14+
* [Library Installation](#library-installation-)
15+
* [Examples](#examples-)
16+
* [Usual Errors](#usual-errors-)
17+
* [Stack overflow error](#stack-overflow-error-)
1818

1919
---
2020

21-
## Installation
21+
## Getting started
22+
### Wiring for the VL53L5CX-SATEL 🔌
2223

23-
### IDF Component Manager
24+
For the examples this is the used wiring, but feel free to modify it and adapt it for your needs.
2425

25-
You can now use the [IDF Component Manager](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-component-manager.html) to easily import this library into your project ! If you have not already done so, create a file named `idf_component.yml` in your `📁 ./main` folder. Now just add the library to it :
26-
```yaml
27-
dependencies:
28-
29-
#V53L5CX-Library
30-
vl53l5cx:
31-
git: https://github.com/RJRP44/VL53L5CX-Library.git
26+
| VL53L5CX-SATEL Pins | ESP32S3 Pins |
27+
|---------------------|-----------------------------------------------|
28+
| INT | NC |
29+
| I2C_RST | NC |
30+
| SDA | GPIO1, 2.2 kΩ pullup resistor required to 3v3 |
31+
| SCL | GPIO2, 2.2 kΩ pullup resistor required to 3v3 |
32+
| PWREN | 3V3 |
33+
| AVDD | 3V3 |
34+
| IOVDD | 3V3 |
35+
| GND | GND |
3236

33-
```
34-
35-
You can now reload your cmake project, and you should see it in the cmake log :
36-
37-
```log
38-
Processing 2 dependencies:
39-
[1/2] idf (5.0.0)
40-
[2/2] vl53l5cx
41-
```
42-
43-
and in the `📁 ./managed_components` folder.
4437

38+
### Library Installation 📥
4539

46-
### Manually
40+
The library is available at https://components.espressif.com/components/rjrp44/vl53l5cx.
4741

48-
* Download this project.
49-
* Create a `📁 /vl53lcx` folder into the `📁 ./components` folder.
50-
* Add it the content of this project
51-
* Reload Cmake
42+
So, you can use the [IDF Component Manager](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-component-manager.html) to easily import this library into your project.
43+
To add this component to your project, run:
5244

53-
54-
55-
You can now import the library, and use the full power of the sensor 🎉.
56-
``` c
57-
#include "vl53l5cx_api.h"
45+
```log
46+
idf.py add-dependency "rjrp44/vl53l5cx^2.0.1"
5847
```
5948

60-
---
61-
62-
### Examples
6349

64-
ST provide some examples in `/examples`.
50+
## Examples 📄
6551

66-
This example function is used to initialize the [I2C bus](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/i2c.html) for the sensor :
52+
You can find in `📁 ./examples` ST's examples adapted for ESP32 with I²C. For more information about the available features read [UM2884](https://www.st.com/resource/en/user_manual/um2884-a-guide-to-using-the-vl53l5cx-multizone-timeofflight-ranging-sensor-with-wide-field-of-view-ultra-lite-driver-uld-stmicroelectronics.pdf).
6753

68-
```c
69-
#define I2C_SDA_NUM 21
70-
#define I2C_SCL_NUM 22
71-
#define I2C_CLK_SPEED 1000000
72-
#define I2C_TIMEOUT 400000
73-
#define I2C_TX_BUF 0
74-
#define I2C_RX_BUF 0
54+
## Usual errors 🐛
55+
### Stack overflow error 💽
7556

76-
static esp_err_t i2c_master_init(void) {
77-
78-
i2c_config_t conf = {
79-
.mode = I2C_MODE_MASTER,
80-
.sda_io_num = I2C_SDA_NUM,
81-
.scl_io_num = I2C_SCL_NUM,
82-
.sda_pullup_en = GPIO_PULLUP_ENABLE,
83-
.scl_pullup_en = GPIO_PULLUP_ENABLE,
84-
.master.clk_speed = I2C_CLK_SPEED,
85-
};
86-
87-
i2c_param_config(I2C_NUM_1, &conf);
88-
i2c_set_timeout(I2C_NUM_1, I2C_TIMEOUT);
89-
90-
return i2c_driver_install(I2C_NUM_1, conf.mode, I2C_RX_BUF, I2C_TX_BUF, 0);
91-
}
92-
```
93-
---
94-
95-
### Component Structure
96-
97-
```
98-
├── 📁 include /
99-
│ ├── platform.h
100-
│ ├── vl53v5cx_api.h
101-
│ └── vl53v5cx_buffer.h
102-
├── CMakeLists.txt
103-
├── idf_component.yml
104-
├── LICENCE
105-
├── platform.c
106-
├── README.md
107-
└── vl53l5cx_api.c
57+
If by running an example you get a stack overflow error, this means that your main stack size is too small.
58+
```log
59+
***ERROR*** A stack overflow in task main has been detected.
10860
```
61+
**Increase the main stack size :**
10962

110-
---
63+
Run `idf.py menuconfig`. Go to Component Config -> ESP System settings and increase the Main task stack size to at least `7168`.
11164

11265
## 📝 License
11366

114-
Copyright © 2023 [RJRP44](https://www.github.com/RJRP44).
67+
Copyright © 2023 [RJRP](https://www.github.com/RJRP44).
11568

11669
This project is [BSD 3-Clause](https://opensource.org/licenses/BSD-3-Clause/) licensed.
11770

@@ -121,5 +74,4 @@ Give a ⭐️ if this project helped you!
12174

12275
## 👤 Authors
12376

124-
- [@RJRP44](https://www.github.com/RJRP44)
125-
77+
- [@RJRP](https://www.github.com/RJRP44)

idf_component.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
version: "1.1.0"
2-
description: A vl53l5cx library for esp32 using the esp-idf framework .
3-
url: https://github.com/RJRP44/V53L5CX-Library
1+
version: "2.0.1"
2+
description: "A vl53l5cx library for esp32 using the esp-idf framework."
3+
url: "https://github.com/RJRP44/VL53L5CX-Library"
4+
repository: "https://github.com/RJRP44/VL53L5CX-Library"
5+
license: "BSD-3-Clause"
46
dependencies:
5-
idf: ">=4.1"
7+
idf: ">=5.0"

include/platform.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ typedef struct
4141

4242
} VL53L5CX_Platform;
4343

44+
#define VL53L5CX_MAX_CLK_SPEED 1000000
45+
4446
/*
4547
* @brief The macro below is used to define the number of target per zone sent
4648
* through I2C. This value can be changed by user, in order to tune I2C

0 commit comments

Comments
 (0)