diff options
Diffstat (limited to 'usb-fastled')
-rw-r--r-- | usb-fastled/usb-fastled.cpp | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/usb-fastled/usb-fastled.cpp b/usb-fastled/usb-fastled.cpp index 06e1cfc..4e5e2cf 100644 --- a/usb-fastled/usb-fastled.cpp +++ b/usb-fastled/usb-fastled.cpp @@ -82,23 +82,14 @@ void fastled_init() } -void leds_set(CRGB color) -{ - uint8_t i; - for(i = 0; i < NUM_LEDS; ++i) { - leds[i] = color; - } - FastLED.show(); -} - void handle_cmd(uint8_t cmd) { switch(cmd) { - case '0': leds_set(CRGB::Black); led_off(); break; - case '1': leds_set(CRGB::White); led_on(); break; - case 'r': leds_set(CRGB::Red); led_on(); break; - case 'g': leds_set(CRGB::Green); led_on(); break; - case 'b': leds_set(CRGB::Blue); led_on(); break; + case '0': fill_solid(leds, NUM_LEDS, CRGB::Black); FastLED.show(); led_off(); break; + case '1': fill_solid(leds, NUM_LEDS, CRGB::White); FastLED.show(); led_on(); break; + case 'r': fill_solid(leds, NUM_LEDS, CRGB::Red); FastLED.show(); led_on(); break; + case 'g': fill_solid(leds, NUM_LEDS, CRGB::Green); FastLED.show(); led_on(); break; + case 'b': fill_solid(leds, NUM_LEDS, CRGB::Blue); FastLED.show(); led_on(); break; case '!': reset2bootloader(); break; default: printf("error\r\n"); return; } |