MetaWear C++ API  0.20.0
C++ implementation of the MetaWear protocol
Functions
average.h File Reference

Computes a running average of the input. More...

#include "processor_common.h"

Go to the source code of this file.

Functions

METAWEAR_API int32_t mbl_mw_dataprocessor_average_create (MblMwDataSignal *source, uint8_t size, void *context, MblMwFnDataProcessor processor_created)
 
METAWEAR_API int32_t mbl_mw_dataprocessor_highpass_create (MblMwDataSignal *source, uint8_t size, void *context, MblMwFnDataProcessor processor_created)
 Create a high-pass filter Uses the averager to compute the difference of the current value from a running average of the previous (amount of) "size" samples. More...
 
METAWEAR_API int32_t mbl_mw_dataprocessor_lowpass_create (MblMwDataSignal *source, uint8_t size, void *context, MblMwFnDataProcessor processor_created)
 Create a low-pass filter Uses the averager to create a moving average. More...
 
METAWEAR_API int32_t mbl_mw_dataprocessor_average_reset (MblMwDataProcessor *average)
 Resets the running average (averager current value) More...
 
METAWEAR_API int32_t mbl_mw_dataprocessor_average_modify_size (MblMwDataProcessor *average, uint8_t size)
 Modifies the sample size of the average processor The sample size is the number of previous data samples to compare against Recommended to be a power of 2 for faster computation. More...
 

Detailed Description

Computes a running average of the input.

Function Documentation

◆ mbl_mw_dataprocessor_average_create()

METAWEAR_API int32_t mbl_mw_dataprocessor_average_create ( MblMwDataSignal source,
uint8_t  size,
void *  context,
MblMwFnDataProcessor  processor_created 
)
Deprecated:
As of v0.10.0, use mbl_mw_dataprocessor_lowpass_create

◆ mbl_mw_dataprocessor_average_modify_size()

METAWEAR_API int32_t mbl_mw_dataprocessor_average_modify_size ( MblMwDataProcessor average,
uint8_t  size 
)

Modifies the sample size of the average processor The sample size is the number of previous data samples to compare against Recommended to be a power of 2 for faster computation.

Parameters
averageAverage processor to modify
sizeNew sample size to use
Returns
MBL_MW_STATUS_OK if processor configuration was updated, MBL_MW_STATUS_WARNING_INVALID_PROCESSOR_TYPE if a non-average processor was passed in

◆ mbl_mw_dataprocessor_average_reset()

METAWEAR_API int32_t mbl_mw_dataprocessor_average_reset ( MblMwDataProcessor average)

Resets the running average (averager current value)

Parameters
averageAverage processor to reset
Returns
MBL_MW_STATUS_OK if processor configuration was updated, MBL_MW_STATUS_WARNING_INVALID_PROCESSOR_TYPE if a non-average processor was passed in

◆ mbl_mw_dataprocessor_highpass_create()

METAWEAR_API int32_t mbl_mw_dataprocessor_highpass_create ( MblMwDataSignal source,
uint8_t  size,
void *  context,
MblMwFnDataProcessor  processor_created 
)

Create a high-pass filter Uses the averager to compute the difference of the current value from a running average of the previous (amount of) "size" samples.

A pointer representing the processor will be passed back to the user via a callback function.

Parameters
sourceData signal providing the input for the processor
sizeNumber of previous data samples to compare against, Recommended to be a power of 2 for faster computation.
contextPointer to additional data for the callback function
processor_createdCallback function to be executed when the processor is created

◆ mbl_mw_dataprocessor_lowpass_create()

METAWEAR_API int32_t mbl_mw_dataprocessor_lowpass_create ( MblMwDataSignal source,
uint8_t  size,
void *  context,
MblMwFnDataProcessor  processor_created 
)

Create a low-pass filter Uses the averager to create a moving average.

A pointer representing the processor will be passed back to the user via a callback function.

Parameters
sourceData signal providing the input for the processor
sizeNumber of previous data samples to compare against, Recommended to be a power of 2 for faster computation.
contextPointer to additional data for the callback function
processor_createdCallback function to be executed when the processor is created