Rev 198 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 198 | Rev 215 | ||
|---|---|---|---|
| Line 6... | Line 6... | ||
| 6 | 6 | ||
| 7 | #include <avr/interrupt.h> |
7 | #include <avr/interrupt.h> |
| 8 | #include <avr/pgmspace.h> |
8 | #include <avr/pgmspace.h> |
| 9 | #include <avr/io.h> |
9 | #include <avr/io.h> |
| 10 | #include "avr_compat.h" |
10 | #include "avr_compat.h" |
| 11 | #include <avr/wdt.h> |
- | |
| - | 11 | ||
| 12 | #ifndef ALIBC_OLD |
12 | #ifndef ALIBC_OLD |
| 13 | #include <util/delay.h> |
13 | #include <util/delay.h> |
| 14 | #else |
14 | #else |
| 15 | #include <avr/delay.h> |
15 | #include <avr/delay.h> |
| 16 | #endif |
16 | #endif |
| 17 | 17 | ||
| 18 | void delay_ms(unsigned int ms) |
18 | void delay_ms(unsigned int ms) |
| 19 | /* delay for a minimum of <ms> */ |
19 | /* delay for a minimum of <ms> */ |
| 20 | { |
20 | { |
| 21 | // we use a calibrated macro. This is more |
21 | // we use a calibrated macro. This is more |
| 22 | // accurate and not so much compiler dependent |
22 | // accurate and not so much compiler dependent |
| 23 | // as self made code. |
23 | // as self made code. |
| 24 | while(ms){ |
24 | while(ms){ |
| 25 | _delay_ms(0.96); |
25 | _delay_ms(0.96); |
| 26 | ms--; |
26 | ms--; |
| 27 | } |
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 | } |
28 | } |
| 40 | 29 | ||
| 41 | 30 | ||