62,11 → 62,11 |
#include "mk3mag.h" |
#endif |
|
volatile uint16_t CountMilliseconds = 0; |
volatile uint8_t runFlightControl = 0; |
volatile uint16_t millisecondsCount = 0; |
volatile uint8_t runFlightControl = 0; |
volatile uint16_t cntKompass = 0; |
volatile uint16_t BeepTime = 0; |
volatile uint16_t BeepModulation = 0xFFFF; |
volatile uint16_t beepTime = 0; |
volatile uint16_t beepModulation = 0xFFFF; |
|
#ifdef USE_NAVICTRL |
volatile uint8_t SendSPI = 0; |
136,7 → 136,7 |
ISR(TIMER0_OVF_vect) |
{ // 9765.625 Hz |
static uint8_t cnt_1ms = 1, cnt = 0; |
uint8_t Beeper_On = 0; |
uint8_t beeper_On = 0; |
|
#ifdef USE_NAVICTRL |
if(SendSPI) SendSPI--; // if SendSPI is 0, the transmit of a byte via SPI bus to and from The Navicontrol is done |
152,23 → 152,23 |
DebugOut.Digital[1] &= ~DEBUG_MAINLOOP_TIMER; |
runFlightControl = 1; // every 2nd run (976.5625 Hz/2 = 488.28125 Hz) |
} |
CountMilliseconds++; // increment millisecond counter |
millisecondsCount++; // increment millisecond counter |
} |
|
// beeper on if duration is not over |
if (BeepTime) { |
BeepTime--; // decrement BeepTime |
if (BeepTime & BeepModulation) |
Beeper_On = 1; |
if (beepTime) { |
beepTime--; // decrement BeepTime |
if (beepTime & beepModulation) |
beeper_On = 1; |
else |
Beeper_On = 0; |
beeper_On = 0; |
} else { // beeper off if duration is over |
Beeper_On = 0; |
BeepModulation = 0xFFFF; |
beeper_On = 0; |
beepModulation = 0xFFFF; |
} |
|
// if beeper is on |
if (Beeper_On) { |
if (beeper_On) { |
// set speaker port to high. |
if (BoardRelease == 10) |
PORTD |= (1 << PORTD2); // Speaker at PD2 |
193,27 → 193,27 |
} |
|
// ----------------------------------------------------------------------- |
uint16_t SetDelay(uint16_t t) { |
return (CountMilliseconds + t - 1); |
uint16_t setDelay(uint16_t t) { |
return (millisecondsCount + t - 1); |
} |
|
// ----------------------------------------------------------------------- |
int8_t CheckDelay(uint16_t t) { |
return (((t - CountMilliseconds) & 0x8000) >> 8); // check sign bit |
int8_t checkDelay(uint16_t t) { |
return (((t - millisecondsCount) & 0x8000) >> 8); // check sign bit |
} |
|
// ----------------------------------------------------------------------- |
void Delay_ms(uint16_t w) { |
uint16_t t_stop = SetDelay(w); |
while (!CheckDelay(t_stop)) |
void delay_ms(uint16_t w) { |
uint16_t t_stop = setDelay(w); |
while (!checkDelay(t_stop)) |
; |
} |
|
// ----------------------------------------------------------------------- |
void Delay_ms_Mess(uint16_t w) { |
void delay_ms_Mess(uint16_t w) { |
uint16_t t_stop; |
t_stop = SetDelay(w); |
while (!CheckDelay(t_stop)) { |
t_stop = setDelay(w); |
while (!checkDelay(t_stop)) { |
if (analogDataReady) { |
analogDataReady = 0; |
analog_start(); |