Skip to content

Commit d9b31d9

Browse files
authored
Merge pull request #342 from Kainarx/fix/led_strip_spi_bug_on_c6
fix(led_strip): fix the reset time and resolution bugs (SPI backend)
2 parents 64ba4fe + 5903717 commit d9b31d9

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

led_strip/idf_component.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "2.5.3"
1+
version: "2.5.4"
22
description: Driver for Addressable LED Strip (WS2812, etc)
33
url: https://github.com/espressif/idf-extra-components/tree/master/led_strip
44
dependencies:

led_strip/src/led_strip_spi_dev.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,14 @@ esp_err_t led_strip_new_spi_device(const led_strip_config_t *led_config, const l
177177
};
178178

179179
ESP_GOTO_ON_ERROR(spi_bus_add_device(spi_strip->spi_host, &spi_dev_cfg, &spi_strip->spi_device), err, TAG, "Failed to add spi device");
180-
180+
//ensure the reset time is enough
181+
esp_rom_delay_us(10);
181182
int clock_resolution_khz = 0;
182183
spi_device_get_actual_freq(spi_strip->spi_device, &clock_resolution_khz);
183184
// TODO: ideally we should decide the SPI_BYTES_PER_COLOR_BYTE by the real clock resolution
184185
// 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
185-
ESP_GOTO_ON_FALSE(clock_resolution_khz == LED_STRIP_SPI_DEFAULT_RESOLUTION / 1000, ESP_ERR_NOT_SUPPORTED, err,
186+
// clock_resolution between 2.2MHz to 2.8MHz is supported
187+
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,
186188
TAG, "unsupported clock resolution:%dKHz", clock_resolution_khz);
187189

188190
spi_strip->bytes_per_pixel = bytes_per_pixel;

0 commit comments

Comments
 (0)