Skip to content

An Efficient moving average implementation intended to be used for micro-controllers.

License

Notifications You must be signed in to change notification settings

mhtb32/EfficientMovingAverage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Efficient Moving Average

This is an efficient implementation of moving average filter intended to be used for micro-controllers, Tested on STM32 series.

Example code

This is a pseudo-code showing how one can use this library for his/her desired target platform.

volatile uint32_t ADCValue = 0;
uint32_t ADCValueFiltered = 0;
FilterTypeDef filterStruct;

int main(void)
{

    Moving_Average_Init(&filterStruct);

    while(1)
    {
        ADCValue = ADC_Get_Value(adc);
        ADCValueFiltered = Moving_Average_Compute(ADCValue, &filterStruct);
    }

    return 0;
}

You can change length of filter window by changing #define WindowLength 10 in header file.

Acknowledgement

I would like to thank Sepehr Hashtroudi for all the improvements he suggested to my original implementation of algorithm.

About

An Efficient moving average implementation intended to be used for micro-controllers.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages