Details | Last modification | View Log | SVN | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 198 | arune | 1 | /* vim: set sw=8 ts=8 si et: */ |
| 2 | /********************************************* |
||
| 3 | * Author: Guido Socher |
||
| 4 | * Copyright: GPL V2 |
||
| 5 | **********************************************/ |
||
| 6 | |||
| 7 | #include <avr/interrupt.h> |
||
| 8 | #include <avr/pgmspace.h> |
||
| 9 | #include <avr/io.h> |
||
| 10 | #include "avr_compat.h" |
||
| 11 | #include <avr/wdt.h> |
||
| 12 | #ifndef ALIBC_OLD |
||
| 13 | #include <util/delay.h> |
||
| 14 | #else |
||
| 15 | #include <avr/delay.h> |
||
| 16 | #endif |
||
| 17 | |||
| 18 | void delay_ms(unsigned int ms) |
||
| 19 | /* delay for a minimum of <ms> */ |
||
| 20 | { |
||
| 21 | // we use a calibrated macro. This is more |
||
| 22 | // accurate and not so much compiler dependent |
||
| 23 | // as self made code. |
||
| 24 | while(ms){ |
||
| 25 | _delay_ms(0.96); |
||
| 26 | ms--; |
||
| 27 | } |
||
| 28 | } |
||
| 29 | |||
| 30 | void wd_init(void) |
||
| 31 | { |
||
| 32 | // timeout the watchdog after 2 sec: |
||
| 33 | wdt_enable(WDTO_2S); |
||
| 34 | } |
||
| 35 | |||
| 36 | void wd_kick(void) |
||
| 37 | { |
||
| 38 | wdt_reset(); |
||
| 39 | } |
||
| 40 | |||
| 41 |