mirror of
https://github.com/raspberrypi/pico-sdk.git
synced 2026-01-27 17:37:20 +01:00
Fix build issue with status led (#2600)
This commit is contained in:
parent
9b1e125a3e
commit
ef5bc2c044
1 changed files with 4 additions and 4 deletions
|
|
@ -43,7 +43,7 @@ static bool colored_status_led_on;
|
||||||
|
|
||||||
static PIO pio;
|
static PIO pio;
|
||||||
static uint sm;
|
static uint sm;
|
||||||
static int offset = -1;
|
static uint offset;
|
||||||
|
|
||||||
// Extract from 0xWWRRGGBB
|
// Extract from 0xWWRRGGBB
|
||||||
#define RED(c) (((c) >> 16) & 0xff)
|
#define RED(c) (((c) >> 16) & 0xff)
|
||||||
|
|
@ -52,7 +52,7 @@ static int offset = -1;
|
||||||
#define WHITE(c) (((c) >> 24) && 0xff)
|
#define WHITE(c) (((c) >> 24) && 0xff)
|
||||||
|
|
||||||
bool set_ws2812(uint32_t value) {
|
bool set_ws2812(uint32_t value) {
|
||||||
if (offset > -1) {
|
if (pio) {
|
||||||
#if PICO_COLORED_STATUS_LED_USES_WRGB
|
#if PICO_COLORED_STATUS_LED_USES_WRGB
|
||||||
// Convert to 0xWWGGRRBB
|
// Convert to 0xWWGGRRBB
|
||||||
pio_sm_put_blocking(pio, sm, WHITE(value) << 24 | GREEN(value) << 16 | RED(value) << 8 | BLUE(value));
|
pio_sm_put_blocking(pio, sm, WHITE(value) << 24 | GREEN(value) << 16 | RED(value) << 8 | BLUE(value));
|
||||||
|
|
@ -164,9 +164,9 @@ void status_led_deinit(void) {
|
||||||
status_led_context = NULL;
|
status_led_context = NULL;
|
||||||
#endif
|
#endif
|
||||||
#if COLORED_STATUS_LED_USING_WS2812_PIO
|
#if COLORED_STATUS_LED_USING_WS2812_PIO
|
||||||
if (offset >= 0) {
|
if (pio) {
|
||||||
pio_remove_program_and_unclaim_sm(&ws2812_program, pio, sm, offset);
|
pio_remove_program_and_unclaim_sm(&ws2812_program, pio, sm, offset);
|
||||||
offset = -1;
|
pio = NULL;
|
||||||
}
|
}
|
||||||
#ifdef PICO_DEFAULT_WS2812_POWER_PIN
|
#ifdef PICO_DEFAULT_WS2812_POWER_PIN
|
||||||
gpio_put(PICO_DEFAULT_WS2812_POWER_PIN, false);
|
gpio_put(PICO_DEFAULT_WS2812_POWER_PIN, false);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue