Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
François Revol
firmware
Commits
ead70852
Commit
ead70852
authored
Dec 29, 2019
by
Rahix
Browse files
Merge 'ws2812: Fix first write making the first pixel green'
Closes #181 See merge request
card10/firmware!366
parents
c779e543
6fec4e00
Changes
1
Show whitespace changes
Inline
Side-by-side
epicardium/modules/ws2812.c
View file @
ead70852
...
...
@@ -63,14 +63,22 @@ void epic_ws2812_write(uint8_t pin, uint8_t *pixels, uint32_t n_bytes)
taskENTER_CRITICAL
();
/*
* 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
);
}
GPIO_OutClr
(
pin_cfg
);
epic_ws2812_delay_ticks
(
EPIC_WS2812_RESET_TCKS
);
do
{
epic_ws2812_transmit_byte
(
pin_cfg
,
*
pixels
);
}
while
(
++
pixels
!=
pixels_end
);
GPIO_OutClr
(
pin_cfg
);
epic_ws2812_delay_ticks
(
EPIC_WS2812_RESET_TCKS
);
taskEXIT_CRITICAL
();
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment