Mercurial > ~darius > hgwebdir.cgi > tempctrl
changeset 11:ccc39c9f320b
Enable pretty LED command.
author | darius |
---|---|
date | Fri, 16 Jul 2004 23:39:58 +0930 |
parents | eb1faf51968e |
children | 4b141cc7cbd4 |
files | testavr.c |
diffstat | 1 files changed, 35 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/testavr.c Mon Jul 12 23:59:00 2004 +0930 +++ b/testavr.c Fri Jul 16 23:39:58 2004 +0930 @@ -47,7 +47,6 @@ int uart_getc(void); int beginswith_P(const char *s1, const char *s2); -#if 0 uint8_t PROGMEM ledvals[] = {0x01, 0x03, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0, 0xc0, 0x80}; static uint8_t dir = 0; static volatile uint8_t leds = 0; @@ -81,7 +80,6 @@ PORTA = pgm_read_byte(&ledvals[ledpos]); } -#endif void usleep(uint16_t usec) { @@ -103,21 +101,48 @@ int i; cli(); -#if 0 outp(0xff, DDRA); /* Timer Clock divisor - CK/1024 */ outp(BV(CS00) | BV(CS02), TCCR0); -#endif - outp(0xfe, DDRC); + + outp(0xfc, DDRC); outp(0x00, PORTC); - + /* Init UART */ outp(UART_BAUD_SELECT(UART_BAUD_RATE,XTAL_CPU), UBRR); /* Enable receiver and transmitter. Turn on transmit interrupts */ outp(BV(RXEN) | BV(TXEN), UCR); +#if 0 + int was; + uint32_t count; + + was = inp(PINC) & 0x02; + + count = 0; + while (1) { + if (was) { + if (!(inp(PINC) & 0x02)) { + sprintf_P(cmdbuf, PSTR("high -> low, i = %d\n\r"), count); + uart_puts(cmdbuf); + count = 0; + was = 0x00; + } + } else { + if ((inp(PINC) & 0x02)) { + sprintf_P(cmdbuf, PSTR("low -> high, i = %d\n\r"), count); + uart_puts(cmdbuf); + count = 0; + was = 0x02; + } + } + + count++; + } +#endif + uart_putsP(PSTR("\n\r\n\r===============\n\r" "Inited!\n\r\n\r")); @@ -163,7 +188,9 @@ "wr bit Write a bit\n\r" "wb byte Write a byte (hex)\n\r" "wc cmd [ROMID] Write command\n\r" - "te ROMID Read the temperature from a DS1820\n\r")); + "te ROMID Read the temperature from a DS1820\n\r" + "le Turn pretty LED cycling on\n\r")); + continue; } @@ -332,10 +359,7 @@ i = OWNext(ROM, 1, 0); } while (1); - -#if 0 - - } else if (cmdbuf[0] == 'l' && cmdbuf[1] == 'e' && cmdbuf[2] == 'd') { + } else if (cmdbuf[0] == 'l' && cmdbuf[1] == 'e') { if (leds == 0) { leds = 1; ledpos = 0; @@ -351,7 +375,6 @@ cli(); uart_putsP(PSTR("Stopping\n\r")); } -#endif } else { badcmd: uart_putsP(PSTR("Unknown command, ? for a list\n\r"));