better visibility of public/private/imported variables

This commit is contained in:
Bernhard Kubicek
2011-11-06 23:34:40 +01:00
parent 977fd2b2c7
commit 72ace55e6a
5 changed files with 132 additions and 57 deletions

View File

@@ -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 */