From c2f12a3b05affb6900cd937eb9d218e04d5fe16e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20So=C3=ABte?= Date: Sun, 8 Nov 2015 22:45:12 +0100 Subject: [PATCH 1/2] Better timings for WS2812 (measured 345ns/695ns, instead of 340ns/600ns) --- app/modules/ws2812.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/modules/ws2812.c b/app/modules/ws2812.c index 8e68b100..24a6471d 100644 --- a/app/modules/ws2812.c +++ b/app/modules/ws2812.c @@ -31,8 +31,8 @@ static void ICACHE_RAM_ATTR ws2812_write(uint8_t pin, uint8_t *pixels, uint32_t pixel = *p++; mask = 0x80; start_time = 0; - t0h = (1000 * system_get_cpu_freq()) / 3333; // 0.30us (spec=0.35 +- 0.15) - t1h = (1000 * system_get_cpu_freq()) / 1666; // 0.60us (spec=0.70 +- 0.15) + t0h = (1000 * system_get_cpu_freq()) / 3526; // 0.35us (spec=0.35 +- 0.15) + t1h = (1000 * system_get_cpu_freq()) / 1591; // 0.70us (spec=0.70 +- 0.15) ttot = (1000 * system_get_cpu_freq()) / 800; // 1.25us (MUST be >= 1.25) while (true) { From 4fd552fcaf21a3b459ef1f26406a4e53018d7e7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20So=C3=ABte?= Date: Tue, 10 Nov 2015 22:34:44 +0100 Subject: [PATCH 2/2] Better timings for 160MHz too. Values measured: @80MHz: T0H: 337ns, Period: 1.274us T1H: 687ns, Period: 1.25us @160MHz: T0H: 349ns, Period: 1.262us T1H: 700ns, Period: 1.276us --- app/modules/ws2812.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/modules/ws2812.c b/app/modules/ws2812.c index 24a6471d..6875416d 100644 --- a/app/modules/ws2812.c +++ b/app/modules/ws2812.c @@ -31,8 +31,8 @@ static void ICACHE_RAM_ATTR ws2812_write(uint8_t pin, uint8_t *pixels, uint32_t pixel = *p++; mask = 0x80; start_time = 0; - t0h = (1000 * system_get_cpu_freq()) / 3526; // 0.35us (spec=0.35 +- 0.15) - t1h = (1000 * system_get_cpu_freq()) / 1591; // 0.70us (spec=0.70 +- 0.15) + t0h = (1000 * system_get_cpu_freq()) / 3022; // 0.35us (spec=0.35 +- 0.15) + t1h = (1000 * system_get_cpu_freq()) / 1477; // 0.70us (spec=0.70 +- 0.15) ttot = (1000 * system_get_cpu_freq()) / 800; // 1.25us (MUST be >= 1.25) while (true) {