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>
71#define ALGORITHM_DEMO_EVENT_DEFINE(name, loggers_, tdfs, event_chance_percent) \
72 static const struct algorithm_demo_common_config name##_config = { \
75 .algorithm_id = 0xFFFFFFF0, \
76 .zbus_channel = INFUSE_ZBUS_CHAN_IMU, \
77 .state_size = sizeof(union algorithm_demo_common_data), \
80 .loggers = loggers_, \
84 .event_gen_chance = event_chance_percent, \
86 static union algorithm_demo_common_data name##_data; \
87 static struct algorithm_runner_algorithm name = { \
88 .impl = algorithm_demo_event_fn, \
89 .config = &name##_config.common, \
90 .runtime_state = &name##_data, \
102#define ALGORITHM_DEMO_STATE_DEFINE(name, loggers_, tdfs) \
103 static const struct algorithm_demo_common_config name##_config = { \
106 .algorithm_id = 0xFFFFFFF1, \
107 .zbus_channel = INFUSE_ZBUS_CHAN_IMU, \
108 .state_size = sizeof(union algorithm_demo_common_data), \
111 .loggers = loggers_, \
116 static union algorithm_demo_common_data name##_data; \
117 static struct algorithm_runner_algorithm name = { \
118 .impl = algorithm_demo_state_fn, \
119 .config = &name##_config.common, \
120 .runtime_state = &name##_data, \
133#define ALGORITHM_DEMO_METRIC_DEFINE(name, loggers_, tdfs, metric_compute_len) \
134 static const struct algorithm_demo_common_config name##_config = { \
137 .algorithm_id = 0xFFFFFFF2, \
138 .zbus_channel = INFUSE_ZBUS_CHAN_IMU, \
139 .state_size = sizeof(union algorithm_demo_common_data), \
142 .loggers = loggers_, \
146 .compute_metric_len = metric_compute_len, \
148 static union algorithm_demo_common_data name##_data; \
149 static struct algorithm_runner_algorithm name = { \
150 .impl = algorithm_demo_metric_fn, \
151 .config = &name##_config.common, \
152 .runtime_state = &name##_data, \
Infuse-IoT algorithm runner.
Infuse-IoT zbus channels.
void algorithm_demo_state_fn(const struct zbus_channel *chan, const void *config, void *data)
Algorithm implementation, see algorithm_run_fn.
void algorithm_demo_event_fn(const struct zbus_channel *chan, const void *config, void *data)
Algorithm implementation, see algorithm_run_fn.
void algorithm_demo_metric_fn(const struct zbus_channel *chan, const void *config, 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
struct algorithm_runner_common_config common
Common algorithm configuration.
Definition demo.h:38
uint8_t event_gen_chance
Definition demo.h:41
uint16_t compute_metric_len
Definition demo.h:42
uint8_t current_state
Definition demo.h:48
uint32_t processed
Definition demo.h:47