MetaWear C++ API  0.18.0
C++ implementation of the MetaWear protocol
Enumerations | Functions
comparator.h File Reference

Only allows data through that satisfies a comparison operation. More...

#include "processor_common.h"

Go to the source code of this file.

Enumerations

enum  MblMwComparatorOperation {
  MBL_MW_COMPARATOR_OP_EQ = 0, MBL_MW_COMPARATOR_OP_NEQ, MBL_MW_COMPARATOR_OP_LT, MBL_MW_COMPARATOR_OP_LTE,
  MBL_MW_COMPARATOR_OP_GT, MBL_MW_COMPARATOR_OP_GTE
}
 Available operations for the processor. More...
 
enum  MblMwComparatorMode { MBL_MW_COMPARATOR_MODE_ABSOLUTE = 0, MBL_MW_COMPARATOR_MODE_REFERENCE, MBL_MW_COMPARATOR_MODE_ZONE, MBL_MW_COMPARATOR_MODE_BINARY }
 Output modes for the comparator, only supported in firmware v1.2.3 and higher. More...
 

Functions

METAWEAR_API int32_t mbl_mw_dataprocessor_comparator_create (MblMwDataSignal *source, MblMwComparatorOperation op, float reference, void *context, MblMwFnDataProcessor processor_created)
 Create a comparator processor where signed/unsigned is inferred. More...
 
METAWEAR_API int32_t mbl_mw_dataprocessor_comparator_create_signed (MblMwDataSignal *source, MblMwComparatorOperation op, float reference, void *context, MblMwFnDataProcessor processor_created)
 Create a comparator processor specifically for a signed comparison. More...
 
METAWEAR_API int32_t mbl_mw_dataprocessor_comparator_create_unsigned (MblMwDataSignal *source, MblMwComparatorOperation op, float reference, void *context, MblMwFnDataProcessor processor_created)
 Create a comparator processor specifically for an unsigned comparison. More...
 
METAWEAR_API int32_t mbl_mw_dataprocessor_comparator_modify (MblMwDataProcessor *comparator, MblMwComparatorOperation op, float reference)
 Modifies the comparator processor, changing the operation and reference value. More...
 
METAWEAR_API int32_t mbl_mw_dataprocessor_comparator_modify_signal (MblMwDataProcessor *comparator, MblMwComparatorOperation op, MblMwDataSignal *reference_signal)
 Modifies the comparator processor for a feedback or feedforward loop. More...
 
METAWEAR_API int32_t mbl_mw_dataprocessor_multi_comparator_create (MblMwDataSignal *source, MblMwComparatorOperation op, MblMwComparatorMode mode, float references[], uint8_t references_length, void *context, MblMwFnDataProcessor processor_created)
 Create a multi-value comparator where a signed/unsigned comparison is inferred. More...
 
METAWEAR_API int32_t mbl_mw_dataprocessor_multi_comparator_create_signed (MblMwDataSignal *source, MblMwComparatorOperation op, MblMwComparatorMode mode, float references[], uint8_t references_length, void *context, MblMwFnDataProcessor processor_created)
 Create a multi-value comparator for signed comparisons. More...
 
METAWEAR_API int32_t mbl_mw_dataprocessor_multi_comparator_create_unsigned (MblMwDataSignal *source, MblMwComparatorOperation op, MblMwComparatorMode mode, float references[], uint8_t references_length, void *context, MblMwFnDataProcessor processor_created)
 Create a multi-value comparator for unsigned comparisons. More...
 
METAWEAR_API int32_t mbl_mw_dataprocessor_multi_comparator_modify (MblMwDataProcessor *comparator, MblMwComparatorOperation op, float references[], uint8_t references_length)
 Modifies the multi-value comparator, changing the operation and reference values. More...
 

Detailed Description

Only allows data through that satisfies a comparison operation.

Enumeration Type Documentation

◆ MblMwComparatorMode

Output modes for the comparator, only supported in firmware v1.2.3 and higher.

Enumerator
MBL_MW_COMPARATOR_MODE_ABSOLUTE 

Return the data as is.

MBL_MW_COMPARATOR_MODE_REFERENCE 

Return the reference value for the satisfied comparison.

MBL_MW_COMPARATOR_MODE_ZONE 

Return the position of the reference value satisfying the comparison, n + 1 for not satisfied.

MBL_MW_COMPARATOR_MODE_BINARY 

Return 1 if any reference values satisfy the comparison, 0 if none do.

◆ MblMwComparatorOperation

Available operations for the processor.

Enumerator
MBL_MW_COMPARATOR_OP_EQ 

Equals to.

MBL_MW_COMPARATOR_OP_NEQ 

Not equals to.

MBL_MW_COMPARATOR_OP_LT 

Less than.

MBL_MW_COMPARATOR_OP_LTE 

Less than or equals to.

MBL_MW_COMPARATOR_OP_GT 

Greater than.

MBL_MW_COMPARATOR_OP_GTE 

Greater than or equals to.

Function Documentation

◆ mbl_mw_dataprocessor_comparator_create()

METAWEAR_API int32_t mbl_mw_dataprocessor_comparator_create ( MblMwDataSignal source,
MblMwComparatorOperation  op,
float  reference,
void *  context,
MblMwFnDataProcessor  processor_created 
)

Create a comparator processor where signed/unsigned is inferred.

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
opComparison operation to execute
referenceReference value to compare the input to
contextPointer to additional data for the callback function
processor_createdCallback function to be executed when the processor is created

◆ mbl_mw_dataprocessor_comparator_create_signed()

METAWEAR_API int32_t mbl_mw_dataprocessor_comparator_create_signed ( MblMwDataSignal source,
MblMwComparatorOperation  op,
float  reference,
void *  context,
MblMwFnDataProcessor  processor_created 
)

Create a comparator processor specifically for a signed comparison.

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
opComparison operation to execute
referenceReference value to compare the input to
contextPointer to additional data for the callback function
processor_createdCallback function to be executed when the processor is created

◆ mbl_mw_dataprocessor_comparator_create_unsigned()

METAWEAR_API int32_t mbl_mw_dataprocessor_comparator_create_unsigned ( MblMwDataSignal source,
MblMwComparatorOperation  op,
float  reference,
void *  context,
MblMwFnDataProcessor  processor_created 
)

Create a comparator processor specifically for an unsigned comparison.

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
opComparison operation to execute
referenceReference value to compare the input to
contextPointer to additional data for the callback function
processor_createdCallback function to be executed when the processor is created

◆ mbl_mw_dataprocessor_comparator_modify()

METAWEAR_API int32_t mbl_mw_dataprocessor_comparator_modify ( MblMwDataProcessor comparator,
MblMwComparatorOperation  op,
float  reference 
)

Modifies the comparator processor, changing the operation and reference value.

Parameters
comparatorComparator processor to modify
opNew comparison operation
referenceNew reference value
Returns
MBL_MW_STATUS_OK if processor configuration was updated, MBL_MW_STATUS_WARNING_INVALID_PROCESSOR_TYPE if a non-comparator processor was passed in

◆ mbl_mw_dataprocessor_comparator_modify_signal()

METAWEAR_API int32_t mbl_mw_dataprocessor_comparator_modify_signal ( MblMwDataProcessor comparator,
MblMwComparatorOperation  op,
MblMwDataSignal reference_signal 
)

Modifies the comparator processor for a feedback or feedforward loop.

Parameters
comparatorComparator processor to modify
opNew comparison operation
reference_signalData signal output to be used for the reference value
Returns
MBL_MW_STATUS_OK if processor configuration was updated, MBL_MW_STATUS_WARNING_INVALID_PROCESSOR_TYPE if a non-comparator processor was passed in

◆ mbl_mw_dataprocessor_multi_comparator_create()

METAWEAR_API int32_t mbl_mw_dataprocessor_multi_comparator_create ( MblMwDataSignal source,
MblMwComparatorOperation  op,
MblMwComparatorMode  mode,
float  references[],
uint8_t  references_length,
void *  context,
MblMwFnDataProcessor  processor_created 
)

Create a multi-value comparator where a signed/unsigned comparison is inferred.

This feature is only available on firmware v1.2.3 and later.
A pointer representing the processor will be passed back to the user via a callback function.

Parameters
sourceData signal providing the input
opComparison operation to execute
modeProcessor output mode
referencesArray of reference values to compare against
references_lengthNumber of elements in the references array
contextPointer to additional data for the callback function
processor_createdCallback function to be executed when the processor is created

◆ mbl_mw_dataprocessor_multi_comparator_create_signed()

METAWEAR_API int32_t mbl_mw_dataprocessor_multi_comparator_create_signed ( MblMwDataSignal source,
MblMwComparatorOperation  op,
MblMwComparatorMode  mode,
float  references[],
uint8_t  references_length,
void *  context,
MblMwFnDataProcessor  processor_created 
)

Create a multi-value comparator for signed comparisons.

This feature is only available on firmware v1.2.3 and later. A pointer representing the processor will be passed back to the user via a callback function.

Parameters
sourceData signal providing the input
opComparison operation to execute
modeProcessor output mode
referencesArray of reference values to compare against
references_lengthNumber of elements in the references array
contextPointer to additional data for the callback function
processor_createdCallback function to be executed when the processor is created

◆ mbl_mw_dataprocessor_multi_comparator_create_unsigned()

METAWEAR_API int32_t mbl_mw_dataprocessor_multi_comparator_create_unsigned ( MblMwDataSignal source,
MblMwComparatorOperation  op,
MblMwComparatorMode  mode,
float  references[],
uint8_t  references_length,
void *  context,
MblMwFnDataProcessor  processor_created 
)

Create a multi-value comparator for unsigned comparisons.

This feature is only available on firmware v1.2.3 and later. A pointer representing the processor will be passed back to the user via a callback function.

Parameters
sourceData signal providing the input
opComparison operation to execute
modeProcessor output mode
referencesArray of reference values to compare against
references_lengthNumber of elements in the references array
contextPointer to additional data for the callback function
processor_createdCallback function to be executed when the processor is created

◆ mbl_mw_dataprocessor_multi_comparator_modify()

METAWEAR_API int32_t mbl_mw_dataprocessor_multi_comparator_modify ( MblMwDataProcessor comparator,
MblMwComparatorOperation  op,
float  references[],
uint8_t  references_length 
)

Modifies the multi-value comparator, changing the operation and reference values.

This feature is only available on firmware v1.2.3 and later.

Parameters
comparatorComparator processor to modify
opNew comparison operation
referencesArray of new reference values
references_lengthNumber of elements in the references array
Returns
MBL_MW_STATUS_OK if processor configuration was updated, MBL_MW_STATUS_WARNING_INVALID_PROCESSOR_TYPE if a non-comparator processor was passed in