diff options
-rw-r--r-- | command.c | 16 | ||||
-rw-r--r-- | moodlamp.c | 2 |
2 files changed, 15 insertions, 3 deletions
@@ -23,6 +23,7 @@ #include "pwm.h" #include "serial.h" #include "util.h" +#include "shiftbrite.h" static void command_error(void) { @@ -49,9 +50,18 @@ static void handle_immediate(char *buffer, uint16_t len) command_error(); return; } - - pwm_set_rgb(new_red, new_green, new_blue); - command_success(); + + uint8_t sb_no; + if ((len > sizeof("irrggbb\r") - 1) + && parse_hex_number(&buffer[7], &sb_no)==0 + && sb_no) { + sb_setcolor(sb_no-1, new_red, new_green, new_blue); + command_success(); + } + else { + pwm_set_rgb(new_red, new_green, new_blue); + command_success(); + } } uint16_t serial_rx_cb(char *buffer, uint16_t len) @@ -21,11 +21,13 @@ #include "serial.h" #include "pwm.h" +#include "shiftbrite.h" int main(void) { serial_init(); pwm_init(); + sb_init(); sei(); pwm_worker_loop(); |