kBuffer  1.1
Mean of buffer

Enabling of mean functions

Notice: Only enable the mean functions, if the element datatype (i.e. buffer datatype) is some sort of numeric type (i.e. integer, float, ...) To enable the buffer mean functions, you have to uncommented the following define in kBuffer.h:

#define BUFFER_ENABLE_MEAN

Caution!

There might be problems with this functions. The sum of the values (or the squared values) must be stored in a variable.
This variable is currently a long, but under certain conditions it might overflow.
You could replace it with an "unsigned long long" (or something smaller)

Mean of the buffer

You can take the mean of the buffer with the function bufferMean():

uint16_t mean;
bufferMean(&buffer, &mean);

You can also get the RMS (Root Mean Square), by calling the function bufferMeanRMS() (Parameters are the same)