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;
43
43
44
44
static PIO pio ;
45
45
static uint sm ;
46
- static int offset = -1 ;
46
+ static uint offset ;
47
47
48
48
// Extract from 0xWWRRGGBB
49
49
#define RED (c ) (((c) >> 16) & 0xff)
@@ -52,7 +52,7 @@ static int offset = -1;
52
52
#define WHITE (c ) (((c) >> 24) && 0xff)
53
53
54
54
bool set_ws2812 (uint32_t value ) {
55
- if (offset > -1 ) {
55
+ if (pio ) {
56
56
#if PICO_COLORED_STATUS_LED_USES_WRGB
57
57
// Convert to 0xWWGGRRBB
58
58
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) {
164
164
status_led_context = NULL ;
165
165
#endif
166
166
#if COLORED_STATUS_LED_USING_WS2812_PIO
167
- if (offset >= 0 ) {
167
+ if (pio ) {
168
168
pio_remove_program_and_unclaim_sm (& ws2812_program , pio , sm , offset );
169
- offset = -1 ;
169
+ pio = NULL ;
170
170
}
171
171
#ifdef PICO_DEFAULT_WS2812_POWER_PIN
172
172
gpio_put (PICO_DEFAULT_WS2812_POWER_PIN , false);
You can’t perform that action at this time.
0 commit comments