Fix build issue with status led (#2600)

This commit is contained in:
Peter Harper 2025-07-28 21:28:48 +01:00 committed by GitHub
parent 9b1e125a3e
commit ef5bc2c044
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);