moved the variables in the ISR, thats the most normal use case of static.

This commit is contained in:
Bernhard Kubicek 2011-11-05 16:53:37 +01:00
parent b9ea0651ec
commit ea86a5e10f

View file

@ -322,15 +322,18 @@ void tp_init()
TIMSK0 |= (1<<OCIE0B); TIMSK0 |= (1<<OCIE0B);
} }
// Timer 0 is shared with millies
ISR(TIMER0_COMPB_vect)
{
//these variables are only accesible from the ISR, but static, so they don't loose their value
static unsigned char temp_count = 0; static unsigned char temp_count = 0;
static unsigned long raw_temp_0_value = 0; static unsigned long raw_temp_0_value = 0;
static unsigned long raw_temp_1_value = 0; static unsigned long raw_temp_1_value = 0;
static unsigned long raw_temp_2_value = 0; static unsigned long raw_temp_2_value = 0;
static unsigned char temp_state = 0; static unsigned char temp_state = 0;
// Timer 0 is shared with millies
ISR(TIMER0_COMPB_vect)
{
switch(temp_state) { switch(temp_state) {
case 0: // Prepare TEMP_0 case 0: // Prepare TEMP_0
#if (TEMP_0_PIN > -1) #if (TEMP_0_PIN > -1)