From 7fe5913b904880137f80ba4a4260039ba610776b Mon Sep 17 00:00:00 2001 From: Johannes Kroll Date: Tue, 6 Mar 2012 20:46:41 +0100 Subject: begin coding shiftbrite support --- command.c | 16 +++++++++++++--- moodlamp.c | 2 ++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/command.c b/command.c index 91489e6..0212ce9 100644 --- a/command.c +++ b/command.c @@ -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) diff --git a/moodlamp.c b/moodlamp.c index 2cdd5b5..6392a4e 100644 --- a/moodlamp.c +++ b/moodlamp.c @@ -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(); -- cgit v1.2.1