1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-24 00:35:34 +03:00

Migrate ACC/GYRO to fastram

This commit is contained in:
Konstantin Sharlaimov (DigitalEntity) 2017-09-10 00:04:53 +10:00
parent 49f10730a0
commit bbabf5589e
2 changed files with 19 additions and 19 deletions

View file

@ -64,15 +64,15 @@
#endif #endif
acc_t acc; // acc access functions FASTRAM acc_t acc; // acc access functions
static uint16_t calibratingA = 0; // the calibration is done is the main loop. Calibrating decreases at each cycle down to 0, then we enter in a normal mode. static uint16_t calibratingA = 0; // the calibration is done is the main loop. Calibrating decreases at each cycle down to 0, then we enter in a normal mode.
static biquadFilter_t accFilter[XYZ_AXIS_COUNT]; STATIC_FASTRAM biquadFilter_t accFilter[XYZ_AXIS_COUNT];
#ifdef USE_ACC_NOTCH #ifdef USE_ACC_NOTCH
static filterApplyFnPtr accNotchFilterApplyFn; STATIC_FASTRAM filterApplyFnPtr accNotchFilterApplyFn;
static void *accNotchFilter[XYZ_AXIS_COUNT]; STATIC_FASTRAM void *accNotchFilter[XYZ_AXIS_COUNT];
#endif #endif
PG_REGISTER_WITH_RESET_FN(accelerometerConfig_t, accelerometerConfig, PG_ACCELEROMETER_CONFIG, 1); PG_REGISTER_WITH_RESET_FN(accelerometerConfig_t, accelerometerConfig, PG_ACCELEROMETER_CONFIG, 1);
@ -500,7 +500,7 @@ void accInitFilters(void)
} }
#ifdef USE_ACC_NOTCH #ifdef USE_ACC_NOTCH
static biquadFilter_t accFilterNotch[XYZ_AXIS_COUNT]; STATIC_FASTRAM biquadFilter_t accFilterNotch[XYZ_AXIS_COUNT];
accNotchFilterApplyFn = nullFilterApply; accNotchFilterApplyFn = nullFilterApply;
if (acc.accTargetLooptime && accelerometerConfig()->acc_notch_hz) { if (acc.accTargetLooptime && accelerometerConfig()->acc_notch_hz) {

View file

@ -67,10 +67,10 @@
#include "hardware_revision.h" #include "hardware_revision.h"
#endif #endif
gyro_t gyro; // gyro sensor object FASTRAM gyro_t gyro; // gyro sensor object
STATIC_UNIT_TESTED gyroDev_t gyroDev0; STATIC_UNIT_TESTED gyroDev_t gyroDev0; // Not in FASTRAM since it may hold DMA buffers
static int16_t gyroTemperature0; STATIC_FASTRAM int16_t gyroTemperature0;
typedef struct gyroCalibration_s { typedef struct gyroCalibration_s {
int32_t g[XYZ_AXIS_COUNT]; int32_t g[XYZ_AXIS_COUNT];
@ -78,19 +78,19 @@ typedef struct gyroCalibration_s {
uint16_t calibratingG; uint16_t calibratingG;
} gyroCalibration_t; } gyroCalibration_t;
STATIC_UNIT_TESTED gyroCalibration_t gyroCalibration; STATIC_FASTRAM_UNIT_TESTED gyroCalibration_t gyroCalibration;
static int32_t gyroADC[XYZ_AXIS_COUNT]; STATIC_FASTRAM int32_t gyroADC[XYZ_AXIS_COUNT];
static filterApplyFnPtr softLpfFilterApplyFn; STATIC_FASTRAM filterApplyFnPtr softLpfFilterApplyFn;
static void *softLpfFilter[XYZ_AXIS_COUNT]; STATIC_FASTRAM void *softLpfFilter[XYZ_AXIS_COUNT];
#ifdef USE_GYRO_NOTCH_1 #ifdef USE_GYRO_NOTCH_1
static filterApplyFnPtr notchFilter1ApplyFn; STATIC_FASTRAM filterApplyFnPtr notchFilter1ApplyFn;
static void *notchFilter1[XYZ_AXIS_COUNT]; STATIC_FASTRAM void *notchFilter1[XYZ_AXIS_COUNT];
#endif #endif
#ifdef USE_GYRO_NOTCH_2 #ifdef USE_GYRO_NOTCH_2
static filterApplyFnPtr notchFilter2ApplyFn; STATIC_FASTRAM filterApplyFnPtr notchFilter2ApplyFn;
static void *notchFilter2[XYZ_AXIS_COUNT]; STATIC_FASTRAM void *notchFilter2[XYZ_AXIS_COUNT];
#endif #endif
PG_REGISTER_WITH_RESET_TEMPLATE(gyroConfig_t, gyroConfig, PG_GYRO_CONFIG, 1); PG_REGISTER_WITH_RESET_TEMPLATE(gyroConfig_t, gyroConfig, PG_GYRO_CONFIG, 1);
@ -303,14 +303,14 @@ bool gyroInit(void)
void gyroInitFilters(void) void gyroInitFilters(void)
{ {
static biquadFilter_t gyroFilterLPF[XYZ_AXIS_COUNT]; STATIC_FASTRAM biquadFilter_t gyroFilterLPF[XYZ_AXIS_COUNT];
softLpfFilterApplyFn = nullFilterApply; softLpfFilterApplyFn = nullFilterApply;
#ifdef USE_GYRO_NOTCH_1 #ifdef USE_GYRO_NOTCH_1
static biquadFilter_t gyroFilterNotch_1[XYZ_AXIS_COUNT]; STATIC_FASTRAM biquadFilter_t gyroFilterNotch_1[XYZ_AXIS_COUNT];
notchFilter1ApplyFn = nullFilterApply; notchFilter1ApplyFn = nullFilterApply;
#endif #endif
#ifdef USE_GYRO_NOTCH_2 #ifdef USE_GYRO_NOTCH_2
static biquadFilter_t gyroFilterNotch_2[XYZ_AXIS_COUNT]; STATIC_FASTRAM biquadFilter_t gyroFilterNotch_2[XYZ_AXIS_COUNT];
notchFilter2ApplyFn = nullFilterApply; notchFilter2ApplyFn = nullFilterApply;
#endif #endif