66,7 → 66,12 |
#include "analog.h" |
#include "printf_P.h" |
//#include "spi.h" |
#ifdef USE_MM3 |
#include "mm3.h" |
#endif |
#ifdef USE_CMPS03 |
#include "cmps03.h" |
#endif |
#include "twimaster.h" |
#include "eeprom.h" |
#include "_Settings.h" |
90,7 → 95,7 |
DDRB = 0x00; |
PORTB = 0x00; |
for(timer = 0; timer < 1000; timer++); // make some delay |
if(PINB & 0x01) BoardRelease = 11; |
if(PINB & (1<<PINB1)) BoardRelease = 11; |
else BoardRelease = 10; |
|
// set LED ports as output |
121,13 → 126,21 |
TIMER0_Init(); |
TIMER2_Init(); |
USART0_Init(); |
|
#if defined (__AVR_ATmega644p__) |
if (BoardRelease != 10) USART1_Init(); |
if (BoardRelease == 11) USART1_Init(); |
#endif |
|
RC_Init(); |
ADC_Init(); |
I2C_Init(); |
|
#ifdef USE_MM3 |
MM3_Init(); |
#endif |
#ifdef USE_CMPS03 |
CMPS03_Init(); |
#endif |
//SPI_MasterInit(); |
|
// enable interrupts global |
153,6 → 166,9 |
timer = SetDelay(500); |
while(!CheckDelay(timer)); |
|
|
#ifdef USE_MM3 |
printf("\n\rSupport for Compass Module MM3"); |
//Compass calibration? |
if(PPM_in[ParamSet.ChannelAssignment[CH_THRUST]] > 100 && PPM_in[ParamSet.ChannelAssignment[CH_YAW]] > 100) |
{ |
159,6 → 175,10 |
printf("\n\rCalibrating Compass"); |
MM3_Calibrate(); |
} |
#endif |
#ifdef USE_CMPS03 |
printf("\n\rSupport for Compass Module CMPS03"); |
#endif |
|
|
if(ParamSet.GlobalConfig & CFG_HEIGHT_CONTROL) |