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

Tallies a running sum of the input. More...

#include "processor_common.h"

Go to the source code of this file.

Functions

METAWEAR_API int32_t mbl_mw_dataprocessor_accumulator_create (MblMwDataSignal *source, void *context, MblMwFnDataProcessor processor_created)
 Create an accumulator whose output is the same size as the input. More...
 
METAWEAR_API int32_t mbl_mw_dataprocessor_accumulator_create_size (MblMwDataSignal *source, uint8_t output_size, void *context, MblMwFnDataProcessor processor_created)
 Create an accumulator with a specific output size. More...
 
METAWEAR_API int32_t mbl_mw_dataprocessor_set_accumulator_state (MblMwDataProcessor *accumulator, float new_running_sum)
 Overwrites the current accumulator value with a new value Can be used to reset the running sum. More...
 

Detailed Description

Tallies a running sum of the input.

Function Documentation

◆ mbl_mw_dataprocessor_accumulator_create()

METAWEAR_API int32_t mbl_mw_dataprocessor_accumulator_create ( MblMwDataSignal source,
void *  context,
MblMwFnDataProcessor  processor_created 
)

Create an accumulator whose output is the same size as the input.

Keeps a running sum of the input 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
contextPointer to additional data for the callback function
processor_createdCallback function to be executed when the processor is created

◆ mbl_mw_dataprocessor_accumulator_create_size()

METAWEAR_API int32_t mbl_mw_dataprocessor_accumulator_create_size ( MblMwDataSignal source,
uint8_t  output_size,
void *  context,
MblMwFnDataProcessor  processor_created 
)

Create an accumulator with a specific output size.


Keeps a running sum of the input and returns the output as the specified size 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
output_sizeOutput size, between [1, 4] bytes
contextPointer to additional data for the callback function
processor_createdCallback function to be executed when the processor is created

◆ mbl_mw_dataprocessor_set_accumulator_state()

METAWEAR_API int32_t mbl_mw_dataprocessor_set_accumulator_state ( MblMwDataProcessor accumulator,
float  new_running_sum 
)

Overwrites the current accumulator value with a new value Can be used to reset the running sum.

Parameters
accumulatorAccumulator processor to modify
new_running_sumNew running sum of the accumulator
Returns
MBL_MW_STATUS_OK if processor state was updated, MBL_MW_STATUS_WARNING_INVALID_PROCESSOR_TYPE if a non-accumulator was passed in