Hi,
Recently, I needed to create a FIR filter for a sensor and I designed it with MATLAB. MATLAB can export the coefficients in a C Header file, and I looked for a library that optimize the FIR filtering for the Teensy and I couldn't find one (maybe I didn't look enough). So I have made a simple class that implements a FIR filter based on the MATLAB coefficient. I tried to optimize it to make the filtering the fastest as I can, so it might interest other people (even if it is really simple to implement).
I make the filtering with 32bits-integer and I suggest to use a number of filter taps that is a power of two to have a faster modulo operation (so, instead of 100 taps, you can set 128 and it will not be slower). Some improvements can be made, like computing the gain automatically. I will look at it later.
Link: FilterFIR for Teensy
Have a great day
Recently, I needed to create a FIR filter for a sensor and I designed it with MATLAB. MATLAB can export the coefficients in a C Header file, and I looked for a library that optimize the FIR filtering for the Teensy and I couldn't find one (maybe I didn't look enough). So I have made a simple class that implements a FIR filter based on the MATLAB coefficient. I tried to optimize it to make the filtering the fastest as I can, so it might interest other people (even if it is really simple to implement).
I make the filtering with 32bits-integer and I suggest to use a number of filter taps that is a power of two to have a faster modulo operation (so, instead of 100 taps, you can set 128 and it will not be slower). Some improvements can be made, like computing the gain automatically. I will look at it later.
Link: FilterFIR for Teensy
Have a great day