12#ifndef INFUSE_SDK_INCLUDE_INFUSE_ALGORITHM_RUNNER_ALGORITHMS_TILT_H_
13#define INFUSE_SDK_INCLUDE_INFUSE_ALGORITHM_RUNNER_ALGORITHMS_TILT_H_
17#include <zephyr/toolchain.h>
60#define ALGORITHM_TILT_DEFINE(name, loggers_, tdfs, filter_alpha, one_g_valid_percent) \
61 static const struct algorithm_runner_common_config name##_config = { \
62 .algorithm_id = 0x15F20001, \
63 .zbus_channel = INFUSE_ZBUS_CHAN_IMU, \
64 .arguments_size = sizeof(struct kv_alg_tilt_args), \
65 .state_size = sizeof(struct algorithm_tilt_data), \
66 .arguments_kv_key = KV_KEY_ALG_TILT_ARGS, \
68 static struct kv_alg_tilt_args name##_default_args = { \
71 .loggers = loggers_, \
76 .iir_filter_alpha = filter_alpha, \
77 .one_g_percent = one_g_valid_percent, \
80 static struct algorithm_tilt_data name##_data; \
81 static struct algorithm_runner_algorithm name = { \
82 .impl = algorithm_tilt_fn, \
83 .config = &name##_config, \
84 .arguments = &name##_default_args, \
85 .runtime_state = &name##_data, \
Infuse-IoT algorithm runner.
Infuse-IoT zbus channels.
void algorithm_tilt_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_TILT_LOG_ANGLE
Definition tilt.h:35
Infuse-IoT statistics helpers.
uint32_t kv_store_crc
Definition tilt.h:41
struct iir_filter_single_pole_f32 filter
Definition tilt.h:39
uint16_t gravity_mag
Definition tilt.h:42
struct kv_gravity_reference gravity
Definition tilt.h:40
bool reference_valid
Definition tilt.h:43
Floating point IIR single-pole filter.
Definition filter.h:147
Reference gravity vector for tilt calculations.
Definition kv_types.h:447