summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--command.c16
-rw-r--r--moodlamp.c2
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();