Skip to content

Commit 4ea58b1

Browse files
Kainarxsuda-morris
authored andcommitted
feat(led_strip): update the version to 3.0.4
1 parent 3f244fc commit 4ea58b1

3 files changed

Lines changed: 16 additions & 8 deletions

File tree

led_strip/CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1+
## 3.0.4
2+
3+
- Add async refresh API, the next frame is free to be computed while the current frame is being transmitted.
4+
- Support to use custom timing config in RMT backend
5+
- Support to switch GPIO at runtime in RMT backend
6+
17
## 3.0.3
28

39
- Support WS2816 with 16-bit color
410

511
## 3.0.1
612

713
- Support WS2811 bit timing
8-
14+
915
## 3.0.0
1016

1117
- Discontinued support for ESP-IDF v4.x

led_strip/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "3.0.3"
1+
version: "3.0.4"
22
description: Driver for Addressable LED Strip (WS2812, etc)
33
url: https://github.com/espressif/idf-extra-components/tree/master/led_strip
44
repository: https://github.com/espressif/idf-extra-components.git

led_strip/src/led_strip_spi_dev.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "esp_heap_caps.h"
1717

1818
#define LED_STRIP_SPI_DEFAULT_RESOLUTION (2.5 * 1000 * 1000) // 2.5MHz resolution
19+
#define LED_STRIP_SPI_WS2816_RESOLUTION (2.7 * 1000 * 1000) // 2.7MHz resolution
1920
#define LED_STRIP_SPI_DEFAULT_TRANS_QUEUE_SIZE 4
2021

2122
#define SPI_BYTES_PER_COLOR_BYTE 3
@@ -154,12 +155,14 @@ esp_err_t led_strip_new_spi_device(const led_strip_config_t *led_config, const l
154155
esp_err_t ret = ESP_OK;
155156
ESP_GOTO_ON_FALSE(led_config && spi_config && ret_strip, ESP_ERR_INVALID_ARG, err, TAG, "invalid argument");
156157
led_color_component_format_t component_fmt = led_config->color_component_format;
158+
uint32_t clock_speed_hz = LED_STRIP_SPI_DEFAULT_RESOLUTION;
157159
// If R/G/B order is not specified, set default GRB order as fallback
158160
if (component_fmt.format_id == 0) {
159161
component_fmt = LED_STRIP_COLOR_COMPONENT_FMT_GRB;
160162
}
161163
if (led_config->led_model == LED_MODEL_WS2816) {
162164
component_fmt.format.bytes_per_color = 2;
165+
clock_speed_hz = LED_STRIP_SPI_WS2816_RESOLUTION;
163166
}
164167
if (component_fmt.format.bytes_per_color == 0) {
165168
component_fmt.format.bytes_per_color = 1;
@@ -216,7 +219,7 @@ esp_err_t led_strip_new_spi_device(const led_strip_config_t *led_config, const l
216219
.command_bits = 0,
217220
.address_bits = 0,
218221
.dummy_bits = 0,
219-
.clock_speed_hz = LED_STRIP_SPI_DEFAULT_RESOLUTION,
222+
.clock_speed_hz = clock_speed_hz,
220223
.mode = 0,
221224
//set -1 when CS is not used
222225
.spics_io_num = -1,
@@ -229,13 +232,12 @@ esp_err_t led_strip_new_spi_device(const led_strip_config_t *led_config, const l
229232
int clock_resolution_khz = 0;
230233
spi_device_get_actual_freq(spi_strip->spi_device, &clock_resolution_khz);
231234
// TODO: ideally we should decide the SPI_BYTES_PER_COLOR_BYTE by the real clock resolution
232-
// But now, let's fixed the resolution, the downside is, we don't support a clock source whose frequency is not multiple of LED_STRIP_SPI_DEFAULT_RESOLUTION
233-
// clock_resolution between 2.2MHz to 2.8MHz is supported
234-
ESP_GOTO_ON_FALSE((clock_resolution_khz < LED_STRIP_SPI_DEFAULT_RESOLUTION / 1000 + 300) && (clock_resolution_khz > LED_STRIP_SPI_DEFAULT_RESOLUTION / 1000 - 300), ESP_ERR_NOT_SUPPORTED, err,
235+
// But now, let's fixed the resolution
236+
ESP_GOTO_ON_FALSE((clock_resolution_khz < clock_speed_hz / 1000 + 300) && (clock_resolution_khz > clock_speed_hz / 1000 - 300), ESP_ERR_NOT_SUPPORTED, err,
235237
TAG, "unsupported clock resolution:%dKHz", clock_resolution_khz);
236238

237-
if (led_config->led_model != LED_MODEL_WS2812) {
238-
ESP_LOGW(TAG, "Only support WS2812. The timing requirements for other models may not be met");
239+
if (led_config->led_model != LED_MODEL_WS2812 && led_config->led_model != LED_MODEL_WS2816) {
240+
ESP_LOGW(TAG, "Only support WS2812 and WS2816. The timing requirements for other models may not be met");
239241
}
240242

241243
spi_strip->component_fmt = component_fmt;

0 commit comments

Comments
 (0)