ESP-IDF Firmware
Firmware architecture and call graph
Loading...
Searching...
No Matches
dsps_fird_init_f32.c File Reference
#include "dsps_fir.h"
Include dependency graph for dsps_fird_init_f32.c:

Go to the source code of this file.

Functions

esp_err_t dsps_fird_init_f32 (fir_f32_t *fir, float *coeffs, float *delay, int N, int decim)
 initialize structure for 32 bit Decimation FIR filter Function initialize structure for 32 bit floating point FIR filter with decimation The implementation use ANSI C and could be compiled and run on any platform

Function Documentation

◆ dsps_fird_init_f32()

esp_err_t dsps_fird_init_f32 ( fir_f32_t * fir,
float * coeffs,
float * delay,
int N,
int decim )

initialize structure for 32 bit Decimation FIR filter Function initialize structure for 32 bit floating point FIR filter with decimation The implementation use ANSI C and could be compiled and run on any platform

Parameters
firpointer to fir filter structure, that must be preallocated
coeffsarray with FIR filter coefficients. Must be length N
delayarray for FIR filter delay line. Must be length N
NFIR filter length. Length of coeffs and delay arrays.
decimdecimation factor.
Returns
  • ESP_OK on success
  • One of the error codes from DSP library

Definition at line 18 of file dsps_fird_init_f32.c.

19{
20 fir->coeffs = coeffs;
21 fir->delay = delay;
22 fir->N = N;
23 fir->pos = 0;
24 fir->decim = decim;
25
26#ifdef CONFIG_IDF_TARGET_ESP32S3
27 // The amount of coefficients should be divided to 4,
28 // if not, add zero coefficients to round length to 0
29 if (fir->N % 4 != 0) {
31 }
32 // The coeffs array should be aligned to 16
33 if (((uint32_t)coeffs) & 0x0f) {
35 }
36 // The delay array should be aligned to 16
37 if (((uint32_t)delay) & 0x0f) {
39 }
40#endif // CONFIG_IDF_TARGET_ESP32S3
41
42 for (int i = 0 ; i < N; i++) {
43 fir->delay[i] = 0;
44 }
45 return ESP_OK;
46}
#define ESP_ERR_DSP_INVALID_LENGTH
#define ESP_ERR_DSP_ARRAY_NOT_ALIGNED
#define ESP_OK
Definition esp_err.h:23
float * coeffs
Definition dsps_fir.h:30
int pos
Definition dsps_fir.h:33
float * delay
Definition dsps_fir.h:31
int decim
Definition dsps_fir.h:34
float delay[256]
Definition test_fir.c:15
float coeffs[256]
Definition test_fir.c:14
#define N
Definition test_mmult.c:13

References coeffs, fir_f32_s::coeffs, fir_f32_s::decim, delay, fir_f32_s::delay, ESP_ERR_DSP_ARRAY_NOT_ALIGNED, ESP_ERR_DSP_INVALID_LENGTH, ESP_OK, fir_f32_s::N, N, and fir_f32_s::pos.