Created
December 15, 2020 00:15
-
-
Save mattgaidica/7d7483a898c55c6ad1118be169bd966a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CMSIS Math | |
#include "arm_math.h" | |
#include "arm_const_structs.h" | |
#define SIG_SAMPLES 1024 | |
#define BLOCK_SIZE 32; | |
#include "SWAsignal.h" | |
static float32_t filtSignal[SIG_SAMPLES]; | |
// FILTER | |
#define IIR_ORDER 4 | |
#define IIR_NUMSTAGES (IIR_ORDER / 2) | |
static float32_t m_biquad_state[IIR_ORDER]; | |
static float32_t m_biquad_coeffs[5 * IIR_NUMSTAGES] = { 1.0000000000f, | |
-1.9169186492f, 1.0000000000f, 1.9314191302f, -0.9338812219f, | |
1.0000000000f, -1.9829505952f, 1.0000000000f, 1.9737574359f, | |
-0.9797267211f }; | |
arm_biquad_cascade_df2T_instance_f32 const filtInst = { | |
IIR_ORDER / 2, m_biquad_state, m_biquad_coeffs }; | |
static uint32_t filtBlockSize = BLOCK_SIZE; | |
static uint32_t filtNumBlocks = SIG_SAMPLES / BLOCK_SIZE; | |
void main() { | |
float32_t *inputF32, *outputF32; | |
uint32_t i; | |
inputF32 = &inputSignal[0]; | |
outputF32 = &filtSignal[0]; | |
for (i = 0; i < filtNumBlocks; i++) { | |
arm_biquad_cascade_df2T_f32(&filtInst, | |
inputF32 + (i * filtBlockSize), | |
outputF32 + (i * filtBlockSize), filtBlockSize); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment