Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
movement_threshold.h
Go to the documentation of this file.
1
15
16#ifndef INFUSE_SDK_INCLUDE_INFUSE_ALGORITHM_RUNNER_ALGORITHMS_MOVEMENT_THRESHOLD_H_
17#define INFUSE_SDK_INCLUDE_INFUSE_ALGORITHM_RUNNER_ALGORITHMS_MOVEMENT_THRESHOLD_H_
18
19#include <stdint.h>
20
21#include <zephyr/toolchain.h>
22
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
36
37/* Algorithm runtime state */
39struct algorithm_movement_threshold_data {
40 uint32_t initial_threshold_low;
41 uint32_t initial_threshold_high;
42 uint32_t continue_threshold_low;
43 uint32_t continue_threshold_high;
44 uint8_t full_scale_range;
45};
47
49void algorithm_movement_threshold_fn(const struct zbus_channel *chan,
50 const struct infuse_algorithm *algorithm, const void *args,
51 void *data);
52
61#define ALGORITHM_MOVEMENT_THRESHOLD_DEFINE(name, moving_for_, initial_threshold_ug_, \
62 continue_threshold_ug_) \
63 static void name##_wrapper(const struct zbus_channel *chan, \
64 const struct infuse_algorithm *algorithm, const void *args) \
65 { \
66 static struct algorithm_movement_threshold_data data; \
67 algorithm_movement_threshold_fn(chan, algorithm, args, &data); \
68 } \
69 static struct kv_alg_movement_threshold_args_v2 name##_default_args = { \
70 .logging = {0}, \
71 .args = \
72 { \
73 .moving_for = moving_for_, \
74 .initial_threshold_ug = initial_threshold_ug_, \
75 .continue_threshold_ug = continue_threshold_ug_, \
76 }, \
77 }; \
78 static const struct infuse_algorithm name = { \
79 .fn = name##_wrapper, \
80 .algorithm_id = 0x15F20002, \
81 .zbus_channel = INFUSE_ZBUS_CHAN_IMU_ACC_MAG, \
82 .arguments = &name##_default_args, \
83 .arguments_size = sizeof(struct kv_alg_movement_threshold_args_v2), \
84 .arguments_kv_key = KV_KEY_ALG_MOVEMENT_THRESHOLD_ARGS_V2, \
85 }
86
90
91#ifdef __cplusplus
92}
93#endif
94
95#endif /* INFUSE_SDK_INCLUDE_INFUSE_ALGORITHM_RUNNER_ALGORITHMS_MOVEMENT_THRESHOLD_H_ */
Infuse-IoT algorithm runner.
Infuse-IoT zbus channels.
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.
Algorithm definition.
Definition implementation.h:47