Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 727 → Rev 728

/branches/MicroMag3_Nick666/trunc/timer0.c
87,17 → 87,27
 
unsigned int SetDelay (unsigned int t)
{
// TIMSK0 &= ~_BV(TOIE0);
return(CountMilliseconds + t + 1);
// TIMSK0 |= _BV(TOIE0);
uint8_t tmp_sreg;
uint16_t CountMilliseconds_local;
tmp_sreg = SREG;
cli();
CountMilliseconds_local = CountMilliseconds;
SREG = tmp_sreg;
return(CountMilliseconds_local + t + 1);
}
 
// -----------------------------------------------------------------------
char CheckDelay(unsigned int t)
{
// TIMSK0 &= ~_BV(TOIE0);
return(((t - CountMilliseconds) & 0x8000) >> 9);
// TIMSK0 |= _BV(TOIE0);
uint8_t tmp_sreg;
uint16_t CountMilliseconds_local;
tmp_sreg = SREG;
cli();
CountMilliseconds_local = CountMilliseconds;
SREG = tmp_sreg;
return (((t - CountMilliseconds_local) & 0x8000) >> 9);
}
 
// -----------------------------------------------------------------------