summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2013-03-10 04:41:28 +0100
committerDavid Lamparter <equinox@diac24.net>2013-03-10 04:41:28 +0100
commit4ab934ab72af3f16993caf0eab62f68a08ded13a (patch)
treefd637977100f816fca4c354944b5f711507b48f0
parentba9ebfeaa0db26df45399a9b87fc46c2eaedcc63 (diff)
dali/wdt: check bus on boot, clear wdt
-rw-r--r--dali2.c9
-rw-r--r--lightctrl.c3
-rw-r--r--wdt.c2
3 files changed, 13 insertions, 1 deletions
diff --git a/dali2.c b/dali2.c
index 5b5c8d7..ee00c1b 100644
--- a/dali2.c
+++ b/dali2.c
@@ -280,3 +280,12 @@ static void dali_init(void)
asm volatile ("" ::: "memory");
TCCR0B = (0 << CS02) | (1 << CS01) | (0 << CS00); // 8 MHz / 8 = 1MHz
}
+
+static void dali_buscheck(void)
+{
+ while ((PIND >> D_DALII) & 1) {
+ uart_puttick();
+ uart_puts("DALI bus stuck/not powered/active\n");
+ _delay_ms(20);
+ }
+}
diff --git a/lightctrl.c b/lightctrl.c
index e901714..bc5e67e 100644
--- a/lightctrl.c
+++ b/lightctrl.c
@@ -216,9 +216,12 @@ int main(void)
wdt_reset();
uart_puts("\ninit done\n");
+ dali_buscheck();
+
can_init();
can_CANSTAT();
+ wdt_reset();
dali_search();
while (1) {
diff --git a/wdt.c b/wdt.c
index f815b71..0336b90 100644
--- a/wdt.c
+++ b/wdt.c
@@ -15,7 +15,7 @@ WDE = 3\n\
ldi %[temp], (1 << WDCE) | (1 << WDE) \n\
sts WDTCSR, %[temp] \n\
\n\
- ldi %[temp], (1 << WDE) | 0x07 \n\
+ ldi %[temp], (1 << WDE) | 0x20 \n\
sts WDTCSR, %[temp] \n\
" : [temp] "=r" (temp) : : "memory");