From 9cc5695977f1339e3032104283d7d260806121e9 Mon Sep 17 00:00:00 2001 From: rauchmx Date: Mon, 30 Jul 2018 11:51:16 +0200 Subject: [PATCH 1/3] include PIC standard header --- Filter/Filter_FIR.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Filter/Filter_FIR.h b/Filter/Filter_FIR.h index ed7e64d..056ef45 100644 --- a/Filter/Filter_FIR.h +++ b/Filter/Filter_FIR.h @@ -1,5 +1,6 @@ // ##### Including ##### -#include +//#include +#include /** Inspired by stevenvh (https://electronics.stackexchange.com/users/2064/stevenvh) Post https://electronics.stackexchange.com/questions/42734/fastest-moving-averaging-techniques-with-minimum-footprint */ From b77aa6f2ed5ec6b937e4d9b9092ee6bc772fb133 Mon Sep 17 00:00:00 2001 From: Niuzu Date: Thu, 1 Aug 2019 21:59:15 +0200 Subject: [PATCH 2/3] Fixed FIR_FILTER for ETC usage --- Filter/Filter_FIR.c | 4 ++-- Filter/Filter_FIR.h | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Filter/Filter_FIR.c b/Filter/Filter_FIR.c index 14136f6..29c7f38 100644 --- a/Filter/Filter_FIR.c +++ b/Filter/Filter_FIR.c @@ -16,7 +16,7 @@ // ##### function ##### -void Filter_AV_8_init (struct FIR_AV_8 *Data) { +void Filter_AV_8_init (FIR_AV_8 *Data) { uint_fast8_t i; for (i = 0; i < 8; i++) { @@ -28,7 +28,7 @@ void Filter_AV_8_init (struct FIR_AV_8 *Data) { } } -void Filter_AV_8(struct FIR_AV_8 *Data, uint_fast16_t *Sample) { +void Filter_AV_8(FIR_AV_8 *Data, uint_fast16_t *Sample) { //Lösche Ältesten Eintrag aus der Liste und Positioniere dort den Neuesten Data->total -= Data->Samples[Data->pointer]; Data->total += *Sample; diff --git a/Filter/Filter_FIR.h b/Filter/Filter_FIR.h index 056ef45..88474aa 100644 --- a/Filter/Filter_FIR.h +++ b/Filter/Filter_FIR.h @@ -1,3 +1,6 @@ +#ifndef FILTER_FIR_H +#define FILTER_FIR_H + // ##### Including ##### //#include #include @@ -11,13 +14,13 @@ // ##### definition ##### /** Average over 8 16bit. */ -struct FIR_AV_8{ +typedef struct { uint_fast16_t Samples[8]; /**< Speicher der Messwerte. */ uint_fast16_t average; /**< Mittelwert aus den Samples. */ uint_fast32_t total; /**< Sammples aufsummiert. */ uint_fast8_t pointer; /**< Zeigt auf den Aeltesten Sampel Eintrag. */ unsigned erg_nvalid : 1; /**< 0 Wenn das erste Mall alle sampels in den Speicher eingelesn wurde und den average Ergebnissen vertraut werden kann. */ -}; +} FIR_AV_8; // ##### Status definition ##### @@ -28,9 +31,11 @@ struct FIR_AV_8{ // ##### function ##### -void Filter_AV_8_init (struct FIR_AV_8 *Data); +void Filter_AV_8_init (FIR_AV_8 *Data); /** FIR Filter Average over 8 16bit. * param[in] Data Filter Speicher Struktur. * param[in] Sample Neuer Messwert der Verechnet werden muss */ -void Filter_AV_8 (struct FIR_AV_8 *Data, uint_fast16_t *Sample); +void Filter_AV_8 (FIR_AV_8 *Data, uint_fast16_t *Sample); + +#endif /* FILTER_FIR_H */ \ No newline at end of file From 04e7a13b58527b4594274f4968480d849f493420 Mon Sep 17 00:00:00 2001 From: Maximilian Rauch Date: Fri, 2 Aug 2019 20:03:14 +0200 Subject: [PATCH 3/3] remove type vendor specific includes --- Filter/Filter_FIR.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Filter/Filter_FIR.h b/Filter/Filter_FIR.h index 88474aa..99a6873 100644 --- a/Filter/Filter_FIR.h +++ b/Filter/Filter_FIR.h @@ -3,7 +3,7 @@ // ##### Including ##### //#include -#include +#include "../../../global.h" /** Inspired by stevenvh (https://electronics.stackexchange.com/users/2064/stevenvh) Post https://electronics.stackexchange.com/questions/42734/fastest-moving-averaging-techniques-with-minimum-footprint */