better visibility of public/private/imported variables
This commit is contained in:
@@ -3,10 +3,37 @@
|
||||
#include <avr/wdt.h>
|
||||
#include <avr/interrupt.h>
|
||||
|
||||
//===========================================================================
|
||||
//=============================private variables ============================
|
||||
//===========================================================================
|
||||
|
||||
static volatile uint8_t timeout_seconds=0;
|
||||
|
||||
void(* ctrlaltdelete) (void) = 0; //does not work on my atmega2560
|
||||
|
||||
//===========================================================================
|
||||
//=============================functinos ============================
|
||||
//===========================================================================
|
||||
|
||||
|
||||
/// intialise watch dog with a 1 sec interrupt time
|
||||
void wd_init()
|
||||
{
|
||||
WDTCSR = (1<<WDCE )|(1<<WDE ); //allow changes
|
||||
WDTCSR = (1<<WDIF)|(1<<WDIE)| (1<<WDCE )|(1<<WDE )| (1<<WDP2 )|(1<<WDP1)|(0<<WDP0);
|
||||
}
|
||||
|
||||
/// reset watchdog. MUST be called every 1s after init or avr will reset.
|
||||
void wd_reset()
|
||||
{
|
||||
wdt_reset();
|
||||
timeout_seconds=0; //reset counter for resets
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//=============================ISR ============================
|
||||
//===========================================================================
|
||||
|
||||
//Watchdog timer interrupt, called if main program blocks >1sec
|
||||
ISR(WDT_vect)
|
||||
{
|
||||
@@ -31,18 +58,4 @@ ISR(WDT_vect)
|
||||
}
|
||||
}
|
||||
|
||||
/// intialise watch dog with a 1 sec interrupt time
|
||||
void wd_init()
|
||||
{
|
||||
WDTCSR = (1<<WDCE )|(1<<WDE ); //allow changes
|
||||
WDTCSR = (1<<WDIF)|(1<<WDIE)| (1<<WDCE )|(1<<WDE )| (1<<WDP2 )|(1<<WDP1)|(0<<WDP0);
|
||||
}
|
||||
|
||||
/// reset watchdog. MUST be called every 1s after init or avr will reset.
|
||||
void wd_reset()
|
||||
{
|
||||
wdt_reset();
|
||||
timeout_seconds=0; //reset counter for resets
|
||||
}
|
||||
|
||||
#endif /* USE_WATCHDOG */
|
||||
|
Reference in New Issue
Block a user