Subversion Repositories FlightCtrl

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1538 killagreg 1
#ifndef _ANALOG_H
2
#define _ANALOG_H
3
 
4
#include <inttypes.h>
5
 
6
extern volatile uint16_t MeasurementCounter;
7
extern volatile int16_t UBat;
8
extern volatile int16_t AdValueGyroNick, AdValueGyroRoll, AdValueGyroYaw;
9
#define HIRES_GYRO_AMPLIFY 8 // the offset corrected HiResGyro values are a factor of 8 scaled to the AdValues
10
extern volatile int16_t HiResGyroNick, HiResGyroRoll;
11
extern volatile int16_t FilterHiResGyroNick, FilterHiResGyroRoll;
12
extern volatile int16_t AdValueAccRoll, AdValueAccNick, AdValueAccTop, AdValueAccZ;
13
#define AIR_PRESSURE_SCALE 18 // 1 ADC counts corresponds approx. to 18 cm
14
#define SM_FILTER 16
15
extern volatile int32_t SumHeight;                      // filter for variometer
16
extern volatile int32_t AirPressure;            // gets less with growing height
17
extern volatile int32_t StartAirPressure;       // air pressure at ground
18
extern volatile int32_t ReadingHeight;          // height according to air pressure (altimeter in steps of 1cm)
19
extern volatile int16_t ReadingVario;
20
extern volatile int16_t AdAirPressure;  // ADC value of air pressure measurement
21
#define EXPANDBARO_OPA_OFFSET_STEP 10
22
#define EXPANDBARO_ADC_SHIFT (-523)                     // adc shift per EXPANDBARO_OPA_OFFSET_STEP
23
extern uint8_t PressureSensorOffset;
24
extern int8_t ExpandBaro;
25
 
26
extern volatile uint8_t ADReady;
27
 
28
extern uint8_t DacOffsetGyroNick, DacOffsetGyroRoll, DacOffsetGyroYaw;
29
 
30
#define AIR_PRESSURE_SEARCH 800
31
#define AIR_PRESSURE_SEARCH_MIN 750
32
#define AIR_PRESSURE_SEARCH_MAX 950
33
 
34
void SearchAirPressureOffset(void);
35
void SearchDacGyroOffset(void);
36
void ADC_Init(void);
37
 
38
 
39
// clear ADC enable & ADC Start Conversion & ADC Interrupt Enable bit
40
#define ADC_Disable() (ADCSRA &= ~((1<<ADEN)|(1<<ADSC)|(1<<ADIE)))
41
// set ADC enable & ADC Start Conversion & ADC Interrupt Enable bit
42
#define ADC_Enable() (ADCSRA |= (1<<ADEN)|(1<<ADSC)|(1<<ADIE))
43
 
44
 
45
#endif //_ANALOG_H
46
 
47