NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
filter.h
Go to the documentation of this file.
1 /*
2  * This file is part of Ninjaflight.
3  *
4  * Ninjaflight is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * Ninjaflight is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Ninjaflight. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #pragma once
19 
20 typedef struct filterStatePt1_s {
21  float state;
22  float RC;
23  float constdT;
25 
26 /* this holds the data required to update samples thru a filter */
27 typedef struct biquad_s {
28  float b0, b1, b2, a1, a2;
29  float x1, x2, y1, y2;
30 } biquad_t;
31 
32 float filterApplyPt1(float input, filterStatePt1_t *filter, uint8_t f_cut, float dt);
33 float applyBiQuadFilter(float sample, biquad_t *state);
34 void BiQuadNewLpf(float filterCutFreq, biquad_t *newState, uint32_t refreshRate);
35 int32_t filterApplyAverage(int32_t input, uint8_t count, int32_t averageState[]);
36 float filterApplyAveragef(float input, uint8_t count, float averageState[]);
float y1
Definition: filter.h:29
void BiQuadNewLpf(float filterCutFreq, biquad_t *newState, uint32_t refreshRate)
Definition: filter.c:47
float filterApplyAveragef(float input, uint8_t count, float averageState[])
Definition: filter.c:113
Definition: filter.h:20
float filterApplyPt1(float input, filterStatePt1_t *filter, uint8_t f_cut, float dt)
Definition: filter.c:33
int32_t filterApplyAverage(int32_t input, uint8_t count, int32_t averageState[])
Definition: filter.c:101
float b1
Definition: filter.h:28
uint8_t input
Definition: mixer.h:13
float b2
Definition: filter.h:28
float a1
Definition: filter.h:28
struct biquad_s biquad_t
float applyBiQuadFilter(float sample, biquad_t *state)
Definition: filter.c:82
float b0
Definition: filter.h:28
float x2
Definition: filter.h:29
float state
Definition: filter.h:21
float RC
Definition: filter.h:22
float constdT
Definition: filter.h:23
float x1
Definition: filter.h:29
struct filterStatePt1_s filterStatePt1_t
float a2
Definition: filter.h:28
float y2
Definition: filter.h:29
Definition: filter.h:27