10#ifndef INFUSE_SDK_INCLUDE_INFUSE_ALGORITHM_RUNNER_ALGORITHMS_DEMO_H_
11#define INFUSE_SDK_INCLUDE_INFUSE_ALGORITHM_RUNNER_ALGORITHMS_DEMO_H_
15#include <zephyr/toolchain.h>
79#define ALGORITHM_DEMO_EVENT_DEFINE(name, loggers_, tdfs, event_chance_percent) \
80 static const struct algorithm_runner_common_config name##_config = { \
81 .algorithm_id = 0xFFFFFFF0, \
82 .zbus_channel = INFUSE_ZBUS_CHAN_IMU, \
83 .arguments_size = sizeof(struct algorithm_demo_common_args), \
84 .state_size = sizeof(union algorithm_demo_common_data), \
86 static struct algorithm_demo_common_args name##_default_args = { \
89 .loggers = loggers_, \
92 .event_gen_chance = event_chance_percent, \
94 static union algorithm_demo_common_data name##_data; \
95 static struct algorithm_runner_algorithm name = { \
96 .impl = algorithm_demo_event_fn, \
97 .config = &name##_config, \
98 .arguments = &name##_default_args, \
99 .runtime_state = &name##_data, \
111#define ALGORITHM_DEMO_STATE_DEFINE(name, loggers_, tdfs) \
112 static const struct algorithm_runner_common_config name##_config = { \
113 .algorithm_id = 0xFFFFFFF1, \
114 .zbus_channel = INFUSE_ZBUS_CHAN_IMU, \
115 .arguments_size = sizeof(struct algorithm_demo_common_args), \
116 .state_size = sizeof(union algorithm_demo_common_data), \
118 static struct algorithm_demo_common_args name##_default_args = { \
121 .loggers = loggers_, \
125 static union algorithm_demo_common_data name##_data; \
126 static struct algorithm_runner_algorithm name = { \
127 .impl = algorithm_demo_state_fn, \
128 .config = &name##_config, \
129 .arguments = &name##_default_args, \
130 .runtime_state = &name##_data, \
143#define ALGORITHM_DEMO_METRIC_DEFINE(name, loggers_, tdfs, metric_compute_len) \
144 static const struct algorithm_runner_common_config name##_config = { \
145 .algorithm_id = 0xFFFFFFF2, \
146 .zbus_channel = INFUSE_ZBUS_CHAN_IMU, \
147 .arguments_size = sizeof(struct algorithm_demo_common_args), \
148 .state_size = sizeof(union algorithm_demo_common_data), \
150 static struct algorithm_demo_common_args name##_default_args = { \
153 .loggers = loggers_, \
156 .compute_metric_len = metric_compute_len, \
158 static union algorithm_demo_common_data name##_data; \
159 static struct algorithm_runner_algorithm name = { \
160 .impl = algorithm_demo_metric_fn, \
161 .config = &name##_config, \
162 .arguments = &name##_default_args, \
163 .runtime_state = &name##_data, \
Infuse-IoT algorithm runner.
Infuse-IoT zbus channels.
void algorithm_demo_metric_fn(const struct zbus_channel *chan, const struct algorithm_runner_common_config *common, const void *args, void *data)
Algorithm implementation, see algorithm_run_fn.
void algorithm_demo_event_fn(const struct zbus_channel *chan, const struct algorithm_runner_common_config *common, const void *args, void *data)
Algorithm implementation, see algorithm_run_fn.
void algorithm_demo_state_fn(const struct zbus_channel *chan, const struct algorithm_runner_common_config *common, const void *args, void *data)
Algorithm implementation, see algorithm_run_fn.
@ ALGORITHM_DEMO_STATE_LOG
Definition demo.h:32
@ ALGORITHM_DEMO_METRIC_LOG
Definition demo.h:33
@ ALGORITHM_DEMO_EVENT_LOG
Definition demo.h:31
uint8_t event_gen_chance
Definition demo.h:42
struct kv_algorithm_logging logging
Definition demo.h:38
uint16_t compute_metric_len
Definition demo.h:44
Algorithm logging configuration.
Definition kv_types.h:87
uint8_t current_state
Definition demo.h:50
uint32_t processed
Definition demo.h:49