Commit 6fec4e00 authored by Rahix's avatar Rahix
Browse files

fix(ws2812): Fix first write making the first pixel green

The first epic_ws2812_write() call will set the first pixel to 0x008000
(bright green).  This is caused by the GPIO line being pulled down on
mode-setting (epic_gpio_set_pin_mode).  Wait before writing the values
to reset the bus and thus properly set the pixels to the correct colors
on first write.
Signed-off-by: Rahix's avatarRahix <>
parent c779e543
......@@ -63,14 +63,22 @@ void epic_ws2812_write(uint8_t pin, uint8_t *pixels, uint32_t n_bytes)
* If the pin was not previously configured as an output, the
* `epic_gpio_set_pin_mode()` call will pull it down which the first
* neopixel interprets as the color `0x008000`. To fix this, wait a bit
* after mode-setting and then write the new values.
if ((epic_gpio_get_pin_mode(pin) & EPIC_GPIO_MODE_OUT) == 0) {
epic_gpio_set_pin_mode(pin, EPIC_GPIO_MODE_OUT);
do {
epic_ws2812_transmit_byte(pin_cfg, *pixels);
} while (++pixels != pixels_end);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment