Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Movement threshold algorithm

Movement Threshold API. More...

Macros

#define ALGORITHM_MOVEMENT_THRESHOLD_DEFINE(name, moving_for_, initial_threshold_ug_, continue_threshold_ug_)
 Statically define an instance of the movement threshold algorithm.

Functions

void algorithm_movement_threshold_fn (const struct zbus_channel *chan, const struct infuse_algorithm *algorithm, const void *args, void *data)
 Algorithm implementation, see algorithm_run_fn.

Detailed Description

Movement Threshold API.

Macro Definition Documentation

◆ ALGORITHM_MOVEMENT_THRESHOLD_DEFINE

#define ALGORITHM_MOVEMENT_THRESHOLD_DEFINE ( name,
moving_for_,
initial_threshold_ug_,
continue_threshold_ug_ )

#include </__w/infuse-sdk/infuse-sdk/infuse-sdk/include/infuse/algorithm_runner/algorithms/movement_threshold.h>

Value:
static void name##_wrapper(const struct zbus_channel *chan, \
const struct infuse_algorithm *algorithm, const void *args) \
{ \
static struct algorithm_movement_threshold_data data; \
algorithm_movement_threshold_fn(chan, algorithm, args, &data); \
} \
static struct kv_alg_movement_threshold_args_v2 name##_default_args = { \
.logging = {0}, \
.args = \
{ \
.moving_for = moving_for_, \
.initial_threshold_ug = initial_threshold_ug_, \
.continue_threshold_ug = continue_threshold_ug_, \
}, \
}; \
static const struct infuse_algorithm name = { \
.fn = name##_wrapper, \
.algorithm_id = 0x15F20002, \
.zbus_channel = INFUSE_ZBUS_CHAN_IMU_ACC_MAG, \
.arguments = &name##_default_args, \
.arguments_size = sizeof(struct kv_alg_movement_threshold_args_v2), \
}
@ KV_KEY_ALG_MOVEMENT_THRESHOLD_ARGS_V2
Configuration for the 'Movement Threshold' algorithm.
Definition kv_types.h:739
@ INFUSE_ZBUS_CHAN_IMU_ACC_MAG
Data type: imu_magnitude_array.
Definition types.h:56
Algorithm definition.
Definition implementation.h:47
uint32_t algorithm_id
Unique algorithm identifier.
Definition implementation.h:55
Configuration for the 'Movement Threshold' algorithm.
Definition kv_types.h:578

Statically define an instance of the movement threshold algorithm.

Parameters
nameVariable name base
moving_for_How long the moving state is set for
initial_threshold_ug_Magnitude this far away from 1G triggers the moving state
continue_threshold_ug_Magnitude this far away from 1G continues the moving state

Function Documentation

◆ algorithm_movement_threshold_fn()

void algorithm_movement_threshold_fn ( const struct zbus_channel * chan,
const struct infuse_algorithm * algorithm,
const void * args,
void * data )