Rev 1646 | Rev 1796 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1646 | Rev 1775 | ||
---|---|---|---|
Line 2... | Line 2... | ||
2 | #define _ANALOG_H |
2 | #define _ANALOG_H |
3 | #include <inttypes.h> |
3 | #include <inttypes.h> |
Line 4... | Line 4... | ||
4 | 4 | ||
5 | //#include "invenSense.h" |
5 | //#include "invenSense.h" |
6 | //#include "ENC-03_FC1.3.h" |
6 | //#include "ENC-03_FC1.3.h" |
Line 7... | Line 7... | ||
7 | #include "ADXRS610_FC2.0.h" |
7 | //#include "ADXRS610_FC2.0.h" |
8 | 8 | ||
9 | /* |
9 | /* |
10 | * How much low pass filtering to apply for gyro_PID. |
10 | * How much low pass filtering to apply for gyro_PID. |
Line 179... | Line 179... | ||
179 | * Maybe this distinction is not really necessary. |
179 | * Maybe this distinction is not really necessary. |
180 | */ |
180 | */ |
181 | extern volatile int16_t gyro_PID[2]; |
181 | extern volatile int16_t gyro_PID[2]; |
182 | extern volatile int16_t gyro_ATT[2]; |
182 | extern volatile int16_t gyro_ATT[2]; |
183 | extern volatile int16_t gyroD[2]; |
183 | extern volatile int16_t gyroD[2]; |
- | 184 | extern volatile int16_t yawGyro; |
|
Line 184... | Line 185... | ||
184 | 185 | ||
185 | extern volatile uint16_t ADCycleCount; |
186 | extern volatile uint16_t ADCycleCount; |
- | 187 | extern volatile int16_t UBat; |
|
186 | extern volatile int16_t UBat; |
188 | |
- | 189 | // 1:11 voltage divider, 1024 counts per 3V, and result is divided by 3. |
|
Line 187... | Line 190... | ||
187 | extern volatile int16_t yawGyro; |
190 | #define UBAT_AT_5V (int16_t)((5.0 / 3.0) * (1.0/11.0) / (3.0 * 1024)) |
188 | 191 | ||
189 | /* |
192 | /* |
190 | * This is not really for external use - but the ENC-03 gyro modules needs it. |
193 | * This is not really for external use - but the ENC-03 gyro modules needs it. |
Line 196... | Line 199... | ||
196 | */ |
199 | */ |
197 | extern volatile int16_t acc[3]; |
200 | extern volatile int16_t acc[3]; |
198 | extern volatile int16_t filteredAcc[2]; |
201 | extern volatile int16_t filteredAcc[2]; |
Line 199... | Line 202... | ||
199 | 202 | ||
- | 203 | /* |
|
200 | /* |
204 | * Diagnostics: Gyro noise level because of motor vibrations. The variables |
- | 205 | * only really reflect the noise level when the copter stands still but with |
|
201 | * Flag: Interrupt handler has done all A/D conversion and processing. |
206 | * its motors running. |
202 | */ |
- | |
203 | extern volatile uint8_t analogDataReady; |
- | |
204 | - | ||
205 | // Diagnostics: Gyro noise level because of motor vibrations. The variables |
- | |
206 | // only really reflect the noise level when the copter stands still but with |
- | |
207 | // its motors running. |
207 | */ |
208 | extern volatile uint16_t gyroNoisePeak[2]; |
208 | extern volatile uint16_t gyroNoisePeak[2]; |
Line -... | Line 209... | ||
- | 209 | extern volatile uint16_t accNoisePeak[2]; |
|
- | 210 | ||
- | 211 | /* |
|
- | 212 | * Air pressure. |
|
- | 213 | * The sensor has a sensitivity of 46 mV/kPa. |
|
- | 214 | * An approximate p(h) formula is = p(h[m])[Pa] = p_0 - 1195 * 10^-6 * h |
|
- | 215 | * |
|
- | 216 | */ |
|
- | 217 | #define AIRPRESSURE_SUMMATION_FACTOR 14 |
|
- | 218 | #define AIRPRESSURE_FILTER 8 |
|
- | 219 | // Minimum A/D value before a range change is performed. |
|
- | 220 | #define MIN_RAWPRESSURE (200 * 2) |
|
- | 221 | // Maximum A/D value before a range change is performed. |
|
- | 222 | #define MAX_RAWPRESSURE (1023 * 2 - MIN_RAWPRESSURE) |
|
- | 223 | ||
- | 224 | #define MIN_RANGES_EXTRAPOLATION 10 |
|
- | 225 | #define MAX_RANGES_EXTRAPOLATION 250 |
|
- | 226 | ||
- | 227 | #define PRESSURE_EXTRAPOLATION_COEFF 25L |
|
- | 228 | #define AUTORANGE_WAIT_FACTOR 1 |
|
- | 229 | ||
- | 230 | extern volatile uint16_t simpleAirPressure; |
|
- | 231 | extern volatile int32_t filteredAirPressure; |
|
- | 232 | /* |
|
- | 233 | * At saturation, the filteredAirPressure may actually be (simulated) negative. |
|
- | 234 | */ |
|
- | 235 | extern volatile int32_t filteredAirPressure; |
|
- | 236 | ||
- | 237 | /* |
|
209 | extern volatile uint16_t accNoisePeak[2]; |
238 | * Flag: Interrupt handler has done all A/D conversion and processing. |
- | 239 | */ |
|
Line 210... | Line 240... | ||
210 | 240 | extern volatile uint8_t analogDataReady; |
|
Line 211... | Line 241... | ||
211 | // void SearchAirPressureOffset(void); |
241 | |
212 | 242 |