diff options
author | Torsten Wagner <torsten.wagner@fh-aachen.de> | 2016-06-30 11:11:56 +0200 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-09-06 11:51:35 +1000 |
commit | 69768c97c060d1b6160e2abcd2fda9c63ce65a2d (patch) | |
tree | f5be78982bb25799232dc9a7a78d16f36816241b | |
parent | e4d6a10dc91f8af8b4ba3647c94e6ce730671864 (diff) | |
download | micropython-69768c97c060d1b6160e2abcd2fda9c63ce65a2d.tar.gz micropython-69768c97c060d1b6160e2abcd2fda9c63ce65a2d.zip |
esp8266/espneopixel: Disable IRQs during eps.neopixel_write.
Interrupts during neopixel_write causes timing problems and therefore
wrong light patterns. Switching off IRQs should help to keep the strict
timing schedule.
-rw-r--r-- | esp8266/espneopixel.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/esp8266/espneopixel.c b/esp8266/espneopixel.c index 0f12f4c820..e16c874f23 100644 --- a/esp8266/espneopixel.c +++ b/esp8266/espneopixel.c @@ -41,6 +41,7 @@ void /*ICACHE_RAM_ATTR*/ esp_neopixel_write(uint8_t pin, uint8_t *pixels, uint32 } #endif + uint32_t irq_state = mp_hal_quiet_timing_enter(); for(t = time0;; t = time0) { if(pix & mask) t = time1; // Bit high duration while(((c = mp_hal_ticks_cpu()) - startTime) < period); // Wait for bit start @@ -55,4 +56,5 @@ void /*ICACHE_RAM_ATTR*/ esp_neopixel_write(uint8_t pin, uint8_t *pixels, uint32 } } while((mp_hal_ticks_cpu() - startTime) < period); // Wait for last bit + mp_hal_quiet_timing_exit(irq_state); } |