Subversion Repositories FlightCtrl

Rev

Rev 716 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 716 Rev 728
Line 85... Line 85...
85
 
85
 
Line 86... Line 86...
86
// -----------------------------------------------------------------------
86
// -----------------------------------------------------------------------
87
 
87
 
88
unsigned int SetDelay (unsigned int t)
88
unsigned int SetDelay (unsigned int t)
89
{
89
{
-
 
90
   uint8_t tmp_sreg;
-
 
91
   uint16_t CountMilliseconds_local;
-
 
92
   
-
 
93
   tmp_sreg = SREG;
90
//  TIMSK0 &= ~_BV(TOIE0);
94
   cli();
-
 
95
   CountMilliseconds_local = CountMilliseconds;
91
  return(CountMilliseconds + t + 1);                                            
96
   SREG = tmp_sreg;
Line 92... Line 97...
92
//  TIMSK0 |= _BV(TOIE0);
97
   return(CountMilliseconds_local + t + 1);
93
}
98
}
94
 
99
 
95
// -----------------------------------------------------------------------
100
// -----------------------------------------------------------------------
96
char CheckDelay(unsigned int t)
101
char CheckDelay(unsigned int t)
-
 
102
{
-
 
103
   uint8_t tmp_sreg;
-
 
104
   uint16_t CountMilliseconds_local;
-
 
105
   
97
{
106
   tmp_sreg = SREG;
-
 
107
   cli();
98
//  TIMSK0 &= ~_BV(TOIE0);
108
   CountMilliseconds_local = CountMilliseconds;
Line 99... Line 109...
99
  return(((t - CountMilliseconds) & 0x8000) >> 9);
109
   SREG = tmp_sreg;
100
//  TIMSK0 |= _BV(TOIE0);
110
   return (((t - CountMilliseconds_local) & 0x8000) >> 9);
101
}
111
}