Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
stationary_windowed.h
Go to the documentation of this file.
1
11
12#ifndef INFUSE_SDK_INCLUDE_INFUSE_ALGORITHM_RUNNER_ALGORITHMS_STATIONARY_WINDOWED_H_
13#define INFUSE_SDK_INCLUDE_INFUSE_ALGORITHM_RUNNER_ALGORITHMS_STATIONARY_WINDOWED_H_
14
15#include <stdint.h>
16
17#include <zephyr/toolchain.h>
18
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
33
34enum {
36};
37
38/* Algorithm runtime state */
40struct algorithm_stationary_windowed_data {
41 struct statistics_state stats;
42 uint32_t window_end;
43};
45
47void algorithm_stationary_windowed_fn(const struct zbus_channel *chan,
48 const struct infuse_algorithm *algorithm, const void *args,
49 void *data);
50
61#define ALGORITHM_STATIONARY_WINDOWED_DEFINE(name, loggers_, tdfs, window_seconds_, threshold_ug) \
62 static void name##_wrapper(const struct zbus_channel *chan, \
63 const struct infuse_algorithm *algorithm, const void *args) \
64 { \
65 static struct algorithm_stationary_windowed_data data; \
66 algorithm_stationary_windowed_fn(chan, algorithm, args, &data); \
67 } \
68 static struct kv_alg_stationary_windowed_args name##_default_args = { \
69 .logging = \
70 { \
71 .loggers = loggers_, \
72 .tdf_mask = tdfs, \
73 }, \
74 .args = \
75 { \
76 .window_seconds = window_seconds_, \
77 .std_dev_threshold_ug = threshold_ug, \
78 }, \
79 }; \
80 static const struct infuse_algorithm name = { \
81 .fn = name##_wrapper, \
82 .algorithm_id = 0x15F20000, \
83 .zbus_channel = INFUSE_ZBUS_CHAN_IMU_ACC_MAG, \
84 .arguments = &name##_default_args, \
85 .arguments_size = sizeof(struct kv_alg_stationary_windowed_args), \
86 .arguments_kv_key = KV_KEY_ALG_STATIONARY_WINDOWED_ARGS, \
87 }
88
92
93#ifdef __cplusplus
94}
95#endif
96
97#endif /* INFUSE_SDK_INCLUDE_INFUSE_ALGORITHM_RUNNER_ALGORITHMS_STATIONARY_WINDOWED_H_ */
Infuse-IoT algorithm runner.
Infuse-IoT zbus channels.
void algorithm_stationary_windowed_fn(const struct zbus_channel *chan, const struct infuse_algorithm *algorithm, const void *args, void *data)
Algorithm implementation, see algorithm_run_fn.
@ ALGORITHM_STATIONARY_WINDOWED_LOG_WINDOW_STD_DEV
Definition stationary_windowed.h:35
Infuse-IoT statistics helpers.
Algorithm definition.
Definition implementation.h:47