File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
src/rp2_common/pico_status_led Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ static bool colored_status_led_on;
4343
4444static PIO pio ;
4545static uint sm ;
46- static int offset = -1 ;
46+ static uint offset ;
4747
4848// Extract from 0xWWRRGGBB
4949#define RED (c ) (((c) >> 16) & 0xff)
@@ -52,7 +52,7 @@ static int offset = -1;
5252#define WHITE (c ) (((c) >> 24) && 0xff)
5353
5454bool set_ws2812 (uint32_t value ) {
55- if (offset > -1 ) {
55+ if (pio ) {
5656#if PICO_COLORED_STATUS_LED_USES_WRGB
5757 // Convert to 0xWWGGRRBB
5858 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) {
164164 status_led_context = NULL ;
165165#endif
166166#if COLORED_STATUS_LED_USING_WS2812_PIO
167- if (offset >= 0 ) {
167+ if (pio ) {
168168 pio_remove_program_and_unclaim_sm (& ws2812_program , pio , sm , offset );
169- offset = -1 ;
169+ pio = NULL ;
170170 }
171171#ifdef PICO_DEFAULT_WS2812_POWER_PIN
172172 gpio_put (PICO_DEFAULT_WS2812_POWER_PIN , false);
You can’t perform that action at this time.
0 commit comments