root / trunk / bootloader / reset.c @ 209
History | View | Annotate | Download (583 Bytes)
1 |
#include <avr/wdt.h> |
---|---|
2 |
|
3 |
/**
|
4 |
* This function resets the board, resetting the hardware back to almost the
|
5 |
* same state as a power on reset. Note that you must do the following in
|
6 |
* this order upon reset or the process will fail:
|
7 |
*
|
8 |
* 1. Reset WDRF in MCUSR to 0
|
9 |
* 2. call wdt_diable() to disable the watchdog in the right order
|
10 |
* 3. Set WDTCSR to clear out all traces of the watchdog timer
|
11 |
**/
|
12 |
void reset(void) { |
13 |
//uint8_t count;
|
14 |
wdt_enable(WDTO_15MS); |
15 |
/*
|
16 |
while(1) {
|
17 |
if (count == 255) {
|
18 |
PORTB ^= 0x7;
|
19 |
}
|
20 |
count++;
|
21 |
}
|
22 |
*/
|
23 |
|
24 |
} |