X-Git-Url: http://git.rrze.uni-erlangen.de/gitweb/?p=moodlight.git;a=blobdiff_plain;f=console.c;h=140765cff33886754ed24d3397cdce2bc00159b4;hp=a8445cbbe4f83729becced0d131841f19d4ba057;hb=17aea8ef6cd47a0469e248a4e7325bcde394ea51;hpb=e369b7e475378c59c2ab25c3b6073a1c0bbb3162 diff --git a/console.c b/console.c index a8445cb..140765c 100644 --- a/console.c +++ b/console.c @@ -1,4 +1,4 @@ -/* $Id: console.c,v 1.1 2010/06/26 12:28:08 simimeie Exp $ +/* $Id: console.c,v 1.2 2010/06/26 19:08:18 simimeie Exp $ * Functions for a serial console. */ @@ -8,7 +8,9 @@ #include #include #include +#include #include "console.h" +#include "ledpwm.h" /* PD0 is RXD, PD1 is TXD, but we don't need to address them manually */ @@ -27,14 +29,14 @@ static uint8_t escstatus = 0; static prog_uint8_t CRLF[] = "\r\n"; static prog_uint8_t WELCOMEMSG[] = "\r\n"\ "\r\n ******************************************"\ - "\r\n * universal mainboard v1 *"\ - "\r\n * (C) Michael 'PoempelFox' Meier 05/2010 *"\ + "\r\n * HaWo Moodlight v0 (prototype) *"\ + "\r\n * (C) Michael 'PoempelFox' Meier 06/2010 *"\ "\r\n ******************************************"\ "\r\n"\ "\r\nProcessor: atmega328"\ "\r\nAVR-libc: " __AVR_LIBC_VERSION_STRING__ " (" __AVR_LIBC_DATE_STRING__ ")"\ "\r\nSoftware Version 0.1, Compiled " __DATE__ " " __TIME__; -static prog_uint8_t PROMPT[] = "\r\nroot@mbv1# "; +static prog_uint8_t PROMPT[] = "\r\nroot@moodlight# "; /* Handler for TXC (TX Complete) IRQ */ ISR(USART_TX_vect) { @@ -260,6 +262,7 @@ ISR(USART_RX_vect) { console_printpgm_noirq_P(PSTR("\r\n motd repeat welcome message")); console_printpgm_noirq_P(PSTR("\r\n showpins [x] shows the avrs inputpins")); console_printpgm_noirq_P(PSTR("\r\n status show status / counters")); + console_printpgm_noirq_P(PSTR("\r\n [rgb] n sets the brightness of the red / green / blue LED to n")); /* console_printpgm_noirq_P(PSTR("\r\n save saves settings to EEPROM")); */ } else if (strcmp_P(inputbuf, PSTR("motd")) == 0) { console_printpgm_noirq_P(WELCOMEMSG); @@ -319,6 +322,24 @@ ISR(USART_RX_vect) { } else if (strcmp_P(inputbuf, PSTR("status")) == 0) { console_printpgm_noirq_P(PSTR("Current status:\r\n")); console_printpgm_noirq_P(PSTR("none. nothing implemented yet.")); + } else if (strncmp_P(inputbuf, PSTR("r "), 2) == 0) { + uint8_t v; + v = strtoul(&inputbuf[2], NULL, 0); + ledpwm_setled(LEDPWM_REDLED, v); + console_printpgm_P(PSTR("brightness of RED LED set to 0x")); + console_printhex8(v); + } else if (strncmp_P(inputbuf, PSTR("g "), 2) == 0) { + uint8_t v; + v = strtoul(&inputbuf[2], NULL, 0); + ledpwm_setled(LEDPWM_GREENLED, v); + console_printpgm_P(PSTR("brightness of GREEN LED set to 0x")); + console_printhex8(v); + } else if (strncmp_P(inputbuf, PSTR("b "), 2) == 0) { + uint8_t v; + v = strtoul(&inputbuf[2], NULL, 0); + ledpwm_setled(LEDPWM_BLUELED, v); + console_printpgm_P(PSTR("brightness of BLUE LED set to 0x")); + console_printhex8(v); #ifdef JOKECMDS } else if (strncmp_P(inputbuf, PSTR("ls"), 2) == 0) { console_printpgm_noirq_P(PSTR("Total 4711\r\n"));