diff options
author | Florian Jung <flo@windfisch.org> | 2015-11-29 18:15:21 +0100 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2015-11-29 18:15:21 +0100 |
commit | fe742e35d3fa6d69125e9f463cbbe1c6032969ca (patch) | |
tree | c51a579de6498295cdb2e80edcdb9a162305e81a /avr/main.c | |
parent | 84b980994934d54b3dad6dd2184830f4464b9933 (diff) |
meeh
Diffstat (limited to 'avr/main.c')
-rw-r--r-- | avr/main.c | 24 |
1 files changed, 22 insertions, 2 deletions
@@ -30,7 +30,7 @@ #include <string.h> #include "usbdrv/usbdrv.h" - +#include "1wire.h" #define LED_BLUE (1<<5) #define LED_RED (1<<4) @@ -125,6 +125,8 @@ int main(void) PORTB &= ~0x0C; PORTB |= 0x30; // enable pullups for PB4 and 5 + replyBuffer[129] = 0; + cli(); wdt_enable(WDTO_1S); // enable 1s watchdog timer @@ -146,7 +148,25 @@ int main(void) wdt_reset(); // keep the watchdog happy usbPoll(); - if (++c % 3000 == 0) PORTC^=LED_BLUE; + if (++c % 3000 == 0) + { + PORTC^=LED_BLUE; + PORTC |= LED_RED | LED_GREEN; + } + if (c % 12000 == 0) + { + uint8_t result = w1_reset(); + if (result == 0) + { + PORTC &= ~LED_GREEN; + ds1992_read(0x00, replyBuffer, 128); + } + else if (result == 1) + PORTC &= ~LED_RED; + else + PORTC &= ~(LED_RED | LED_GREEN); + + } /*if ( (c / 3000) % 40 == 0) { PORTC &= ~LED_RED; |