mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-27 16:54:15 +01:00
AHRS: Changing AHRS to use a DMA double buffering scheme with continuous samping for the analog data, then a simple fixed point FIR/decimate function. Currently all the oversampling parameters are hard coded as definitions, but will be updated to be configurable via settings.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1297 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
cc2441d41b
commit
3f408ad655
@ -222,6 +222,12 @@ int main()
|
||||
|
||||
lfsm_init();
|
||||
|
||||
ahrs_state = AHRS_IDLE;;
|
||||
/* Use simple averaging filter for now */
|
||||
for (int i = 0; i < ADC_OVERSAMPLE; i++)
|
||||
fir_coeffs[i] = 1;
|
||||
fir_coeffs[ADC_OVERSAMPLE] = ADC_OVERSAMPLE;
|
||||
|
||||
// Main loop
|
||||
while (1) {
|
||||
uint8_t loop_ctr;
|
||||
@ -258,6 +264,8 @@ int main()
|
||||
gyro_data.temp.xy = valid_data_buffer[6];
|
||||
gyro_data.temp.z = valid_data_buffer[7];
|
||||
|
||||
ahrs_state = AHRS_IDLE;
|
||||
|
||||
/* Simulate a rotating airframe */
|
||||
attitude_data.quaternion.q1 += .001;
|
||||
attitude_data.quaternion.q2 += .002;
|
||||
|
@ -152,11 +152,7 @@ TIM8 | | | |
|
||||
#define PIOS_ADC_PIN3_ADC ADC1
|
||||
#define PIOS_ADC_PIN3_ADC_NUMBER 3
|
||||
|
||||
<<<<<<< HEAD
|
||||
#define PIOS_ADC_PIN4_GPIO_PORT GPIOA // PA6 (XY Temp)
|
||||
=======
|
||||
#define PIOS_ADC_PIN4_GPIO_PORT GPIOA // PA6 (Temp_XY)
|
||||
>>>>>>> Adding ADC downsampling code
|
||||
#define PIOS_ADC_PIN4_GPIO_PIN GPIO_Pin_6 // ADC12_IN6
|
||||
#define PIOS_ADC_PIN4_GPIO_CHANNEL ADC_Channel_6
|
||||
#define PIOS_ADC_PIN4_ADC ADC1
|
||||
@ -180,24 +176,15 @@ TIM8 | | | |
|
||||
#define PIOS_ADC_PIN7_ADC ADC2
|
||||
#define PIOS_ADC_PIN7_ADC_NUMBER 3
|
||||
|
||||
<<<<<<< HEAD
|
||||
#define PIOS_ADC_PIN8_GPIO_PORT GPIOB // PA7 (Gyro Z)
|
||||
#define PIOS_ADC_PIN8_GPIO_PIN GPIO_Pin_1 // ADC12_IN7
|
||||
=======
|
||||
#define PIOS_ADC_PIN8_GPIO_PORT GPIOB // PB1 (Z Temp)
|
||||
#define PIOS_ADC_PIN8_GPIO_PIN GPIO_Pin_1 // ADC12_IN9
|
||||
>>>>>>> Adding ADC downsampling code
|
||||
#define PIOS_ADC_PIN8_GPIO_CHANNEL ADC_Channel_9
|
||||
#define PIOS_ADC_PIN8_ADC ADC2
|
||||
#define PIOS_ADC_PIN8_ADC_NUMBER 4
|
||||
|
||||
#define PIOS_ADC_NUM_PINS 8
|
||||
|
||||
<<<<<<< HEAD
|
||||
#define PIOS_ADC_PORTS { PIOS_ADC_PIN1_GPIO_PORT, PIOS_ADC_PIN2_GPIO_PORT, PIOS_ADC_PIN3_GPIO_PORT, PIOS_ADC_PIN4_GPIO_PORT, PIOS_ADC_PIN5_GPIO_PORT, PIOS_ADC_PIN6_GPIO_PORT, PIOS_ADC_PIN7_GPIO_PORT, PIOS_ADC_PIN7_GPIO_PORT }
|
||||
=======
|
||||
#define PIOS_ADC_PORTS { PIOS_ADC_PIN1_GPIO_PORT, PIOS_ADC_PIN2_GPIO_PORT, PIOS_ADC_PIN3_GPIO_PORT, PIOS_ADC_PIN4_GPIO_PORT, PIOS_ADC_PIN5_GPIO_PORT, PIOS_ADC_PIN6_GPIO_PORT, PIOS_ADC_PIN7_GPIO_PORT, PIOS_ADC_PIN8_GPIO_PORT }
|
||||
>>>>>>> Adding ADC downsampling code
|
||||
#define PIOS_ADC_PINS { PIOS_ADC_PIN1_GPIO_PIN, PIOS_ADC_PIN2_GPIO_PIN, PIOS_ADC_PIN3_GPIO_PIN, PIOS_ADC_PIN4_GPIO_PIN, PIOS_ADC_PIN5_GPIO_PIN, PIOS_ADC_PIN6_GPIO_PIN, PIOS_ADC_PIN7_GPIO_PIN, PIOS_ADC_PIN8_GPIO_PIN }
|
||||
#define PIOS_ADC_CHANNELS { PIOS_ADC_PIN1_GPIO_CHANNEL, PIOS_ADC_PIN2_GPIO_CHANNEL, PIOS_ADC_PIN3_GPIO_CHANNEL, PIOS_ADC_PIN4_GPIO_CHANNEL, PIOS_ADC_PIN5_GPIO_CHANNEL, PIOS_ADC_PIN6_GPIO_CHANNEL, PIOS_ADC_PIN7_GPIO_CHANNEL, PIOS_ADC_PIN8_GPIO_CHANNEL }
|
||||
#define PIOS_ADC_MAPPING { PIOS_ADC_PIN1_ADC, PIOS_ADC_PIN2_ADC, PIOS_ADC_PIN3_ADC, PIOS_ADC_PIN4_ADC, PIOS_ADC_PIN5_ADC, PIOS_ADC_PIN6_ADC, PIOS_ADC_PIN7_ADC, PIOS_ADC_PIN8_ADC }
|
||||
|
Loading…
x
Reference in New Issue
Block a user