diff options
author | Clyne Sullivan <clyne@bitgloo.com> | 2021-08-08 22:12:53 -0400 |
---|---|---|
committer | Clyne Sullivan <clyne@bitgloo.com> | 2021-08-08 22:12:53 -0400 |
commit | bf0a126e8a9d30b77007829166f4bf91a3900079 (patch) | |
tree | 9d4a769daca81393a4562e96d9c2efb96092100a /templates/4_fir_pro.cpp | |
parent | 707b24dd07236243269cf092728f85172e94e8a4 (diff) |
update templates to new api; open template status fix
Diffstat (limited to 'templates/4_fir_pro.cpp')
-rw-r--r-- | templates/4_fir_pro.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/templates/4_fir_pro.cpp b/templates/4_fir_pro.cpp index 379b83b..b1a6832 100644 --- a/templates/4_fir_pro.cpp +++ b/templates/4_fir_pro.cpp @@ -10,7 +10,7 @@ typedef struct static void arm_fir_f32(const arm_fir_instance_f32 * S, float32_t * pSrc, float32_t * pDst, uint32_t blockSize); -adcsample_t *process_data(adcsample_t *samples, unsigned int size) +Sample *process_data(Samples samples) { // 1. Define our array sizes (Be sure to set Run > Set buffer size... to below value!) constexpr unsigned int buffer_size = 500; @@ -34,18 +34,18 @@ adcsample_t *process_data(adcsample_t *samples, unsigned int size) static float working[buffer_size + filter_size]; // 3. Scale 0-4095 interger sample values to +/- 1.0 floats - for (unsigned int i = 0; i < size; i++) + for (unsigned int i = 0; i < samples.size(); i++) input[i] = (samples[i] - 2048) / 2048.f; // 4. Compute the FIR arm_fir_instance_f32 fir { filter_size, working, filter }; - arm_fir_f32(&fir, input, output, size); + arm_fir_f32(&fir, input, output, samples.size()); // 5. Convert float results back to 0-4095 range for output - for (unsigned int i = 0; i < size; i++) + for (unsigned int i = 0; i < samples.size(); i++) samples[i] = output[i] * 2048.f + 2048; - return samples; + return samples.data(); } // Below taken from the CMSIS DSP Library (find it on GitHub) |