disable watchdog after reset
This commit is contained in:
parent
639c0e9bb9
commit
77fa66a6d9
12
main.c
12
main.c
@ -126,6 +126,18 @@ ISR(TIMER1_OVF_vect)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For newer devices (mega88) the watchdog timer remains active even after a
|
||||||
|
* system reset. So disable it as soon as possible.
|
||||||
|
* automagically called on startup
|
||||||
|
*/
|
||||||
|
void get_mcusr(void) __attribute__((naked, section(".init3")));
|
||||||
|
void get_mcusr(void)
|
||||||
|
{
|
||||||
|
MCUSR = 0;
|
||||||
|
WDTCSR = (1<<WDCE) | (0<<WDE);
|
||||||
|
}
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
DDRB = PHASE_A_EN | PHASE_A_PWM | LED_RT | LED_GN;
|
DDRB = PHASE_A_EN | PHASE_A_PWM | LED_RT | LED_GN;
|
||||||
|
Loading…
Reference in New Issue
Block a user