5,6 → 5,7 |
#include "analog.h" |
#include "main.h" |
#include "fc.h" |
#include "mm3.h" |
|
volatile uint16_t CountMilliseconds = 0; |
volatile uint8_t UpdateMotor = 0; |
30,6 → 31,18 |
DDRB |= (1<<DDB4)|(1<<DDB3); |
PORTB &= ~((1<<PORTB4)|(1<<PORTB3)); |
|
if(BoardRelease == 10) |
{ |
DDRD |= (1<<DDD2); |
PORTD &= ~(1<<PORTD2); |
|
} |
else |
{ |
DDRC |= (1<<DDC7); |
PORTC &= ~(1<<PORTC7); |
} |
|
// Timer/Counter 0 Control Register A |
|
// Waveform Generation Mode is Fast PWM (Bits WGM02 = 0, WGM01 = 1, WGM00 = 1) |
106,28 → 119,16 |
else // beeper is off |
{ |
// set speaker port to low |
if(BoardRelease == 10) PORTD &= ~(1<<2);// Speaker at PD2 |
else PORTC &= ~(1<<7);// Speaker at PC7 |
if(BoardRelease == 10) PORTD &= ~(1<<PORTD2);// Speaker at PD2 |
else PORTC &= ~(1<<PORTC7);// Speaker at PC7 |
} |
|
// update compass value if this option is enabled in the settings |
if(ParamSet.GlobalConfig & CFG_COMPASS_ACTIVE) |
{ |
if(PINC & 0x10) |
{ |
cntKompass++; |
MM3_timer0(); |
} |
else |
{ |
if((cntKompass) && (cntKompass < 4000)) |
{ |
KompassValue = cntKompass; |
} |
KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360) - 180; |
cntKompass = 0; |
} |
} |
} |
|
|
|
134,17 → 135,13 |
// ----------------------------------------------------------------------- |
uint16_t SetDelay (uint16_t t) |
{ |
// TIMSK0 &= ~(1<<TOIE0); |
return(CountMilliseconds + t + 1); |
// TIMSK0 |= (1<<TOIE0); |
} |
|
// ----------------------------------------------------------------------- |
int8_t CheckDelay(uint16_t t) |
{ |
// TIMSK0 &= ~(1<<TOIE0); |
return(((t - CountMilliseconds) & 0x8000) >> 9); |
// TIMSK0 |= (1<<TOIE0); |
return(((t - CountMilliseconds) & 0x8000) >> 9); // check sign bit |
} |
|
// ----------------------------------------------------------------------- |