Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

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

Stars

20 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages