1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 04:45:24 +03:00

Set FAST_RAM to go into .fastram_data by default. Added FAST_RAM_NOINIT

This commit is contained in:
Andrey Mironov 2018-05-22 09:30:33 +03:00
parent 35d6067a64
commit d8dd6f29f8
13 changed files with 93 additions and 92 deletions

View file

@ -57,27 +57,27 @@
#define BIQUAD_Q 1.0f / sqrtf(2.0f) // quality factor - butterworth
static FAST_RAM uint16_t fftSamplingScale;
static FAST_RAM_ZERO_INIT uint16_t fftSamplingScale;
// gyro data used for frequency analysis
static float FAST_RAM gyroData[XYZ_AXIS_COUNT][FFT_WINDOW_SIZE];
static float FAST_RAM_ZERO_INIT gyroData[XYZ_AXIS_COUNT][FFT_WINDOW_SIZE];
static FAST_RAM arm_rfft_fast_instance_f32 fftInstance;
static FAST_RAM float fftData[FFT_WINDOW_SIZE];
static FAST_RAM float rfftData[FFT_WINDOW_SIZE];
static FAST_RAM gyroFftData_t fftResult[XYZ_AXIS_COUNT];
static FAST_RAM_ZERO_INIT arm_rfft_fast_instance_f32 fftInstance;
static FAST_RAM_ZERO_INIT float fftData[FFT_WINDOW_SIZE];
static FAST_RAM_ZERO_INIT float rfftData[FFT_WINDOW_SIZE];
static FAST_RAM_ZERO_INIT gyroFftData_t fftResult[XYZ_AXIS_COUNT];
// use a circular buffer for the last FFT_WINDOW_SIZE samples
static FAST_RAM uint16_t fftIdx;
static FAST_RAM_ZERO_INIT uint16_t fftIdx;
// bandpass filter gyro data
static FAST_RAM biquadFilter_t fftGyroFilter[XYZ_AXIS_COUNT];
static FAST_RAM_ZERO_INIT biquadFilter_t fftGyroFilter[XYZ_AXIS_COUNT];
// filter for smoothing frequency estimation
static FAST_RAM biquadFilter_t fftFreqFilter[XYZ_AXIS_COUNT];
static FAST_RAM_ZERO_INIT biquadFilter_t fftFreqFilter[XYZ_AXIS_COUNT];
// Hanning window, see https://en.wikipedia.org/wiki/Window_function#Hann_.28Hanning.29_window
static FAST_RAM float hanningWindow[FFT_WINDOW_SIZE];
static FAST_RAM_ZERO_INIT float hanningWindow[FFT_WINDOW_SIZE];
void initHanning(void)
{
@ -128,10 +128,10 @@ const gyroFftData_t *gyroFftData(int axis)
void gyroDataAnalyse(const gyroDev_t *gyroDev, biquadFilter_t *notchFilterDyn)
{
// accumulator for oversampled data => no aliasing and less noise
static FAST_RAM float fftAcc[XYZ_AXIS_COUNT];
static FAST_RAM uint32_t fftAccCount;
static FAST_RAM_ZERO_INIT float fftAcc[XYZ_AXIS_COUNT];
static FAST_RAM_ZERO_INIT uint32_t fftAccCount;
static FAST_RAM uint32_t gyroDataAnalyseUpdateTicks;
static FAST_RAM_ZERO_INIT uint32_t gyroDataAnalyseUpdateTicks;
// if gyro sampling is > 1kHz, accumulate multiple samples
for (int axis = 0; axis < XYZ_AXIS_COUNT; axis++) {