Rev 752 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 752 | Rev 754 | ||
---|---|---|---|
Line 64... | Line 64... | ||
64 | #include "fc.h" |
64 | #include "fc.h" |
65 | #include "rc.h" |
65 | #include "rc.h" |
66 | #include "analog.h" |
66 | #include "analog.h" |
67 | #include "printf_P.h" |
67 | #include "printf_P.h" |
68 | //#include "spi.h" |
68 | //#include "spi.h" |
- | 69 | #ifdef USE_MM3 |
|
69 | #include "mm3.h" |
70 | #include "mm3.h" |
- | 71 | #endif |
|
- | 72 | #ifdef USE_CMPS03 |
|
- | 73 | #include "cmps03.h" |
|
- | 74 | #endif |
|
70 | #include "twimaster.h" |
75 | #include "twimaster.h" |
71 | #include "eeprom.h" |
76 | #include "eeprom.h" |
72 | #include "_Settings.h" |
77 | #include "_Settings.h" |
Line 88... | Line 93... | ||
88 | 93 | ||
89 | // get board release |
94 | // get board release |
90 | DDRB = 0x00; |
95 | DDRB = 0x00; |
91 | PORTB = 0x00; |
96 | PORTB = 0x00; |
92 | for(timer = 0; timer < 1000; timer++); // make some delay |
97 | for(timer = 0; timer < 1000; timer++); // make some delay |
93 | if(PINB & 0x01) BoardRelease = 11; |
98 | if(PINB & (1<<PINB1)) BoardRelease = 11; |
Line 94... | Line 99... | ||
94 | else BoardRelease = 10; |
99 | else BoardRelease = 10; |
95 | 100 | ||
96 | // set LED ports as output |
101 | // set LED ports as output |
Line 119... | Line 124... | ||
119 | 124 | ||
120 | // initalize modules |
125 | // initalize modules |
121 | TIMER0_Init(); |
126 | TIMER0_Init(); |
122 | TIMER2_Init(); |
127 | TIMER2_Init(); |
- | 128 | USART0_Init(); |
|
123 | USART0_Init(); |
129 | |
124 | #if defined (__AVR_ATmega644p__) |
130 | #if defined (__AVR_ATmega644p__) |
125 | if (BoardRelease != 10) USART1_Init(); |
131 | if (BoardRelease == 11) USART1_Init(); |
- | 132 | #endif |
|
126 | #endif |
133 | |
127 | RC_Init(); |
134 | RC_Init(); |
128 | ADC_Init(); |
135 | ADC_Init(); |
- | 136 | I2C_Init(); |
|
- | 137 | ||
129 | I2C_Init(); |
138 | #ifdef USE_MM3 |
- | 139 | MM3_Init(); |
|
- | 140 | #endif |
|
- | 141 | #ifdef USE_CMPS03 |
|
- | 142 | CMPS03_Init(); |
|
130 | MM3_Init(); |
143 | #endif |
Line 131... | Line 144... | ||
131 | //SPI_MasterInit(); |
144 | //SPI_MasterInit(); |
132 | 145 | ||
Line 151... | Line 164... | ||
151 | 164 | ||
152 | //wait for a short time (otherwise the RC channel check won't work below) |
165 | //wait for a short time (otherwise the RC channel check won't work below) |
153 | timer = SetDelay(500); |
166 | timer = SetDelay(500); |
Line -... | Line 167... | ||
- | 167 | while(!CheckDelay(timer)); |
|
- | 168 | ||
- | 169 | ||
154 | while(!CheckDelay(timer)); |
170 | #ifdef USE_MM3 |
155 | 171 | printf("\n\rSupport for Compass Module MM3"); |
|
156 | //Compass calibration? |
172 | //Compass calibration? |
157 | if(PPM_in[ParamSet.ChannelAssignment[CH_THRUST]] > 100 && PPM_in[ParamSet.ChannelAssignment[CH_YAW]] > 100) |
173 | if(PPM_in[ParamSet.ChannelAssignment[CH_THRUST]] > 100 && PPM_in[ParamSet.ChannelAssignment[CH_YAW]] > 100) |
158 | { |
174 | { |
159 | printf("\n\rCalibrating Compass"); |
175 | printf("\n\rCalibrating Compass"); |
- | 176 | MM3_Calibrate(); |
|
- | 177 | } |
|
- | 178 | #endif |
|
- | 179 | #ifdef USE_CMPS03 |
|
Line 160... | Line 180... | ||
160 | MM3_Calibrate(); |
180 | printf("\n\rSupport for Compass Module CMPS03"); |
161 | } |
181 | #endif |
162 | 182 |