summaryrefslogtreecommitdiff
path: root/avr/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'avr/main.c')
-rw-r--r--avr/main.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/avr/main.c b/avr/main.c
index d350637..5c9742f 100644
--- a/avr/main.c
+++ b/avr/main.c
@@ -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;