Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
tilt.h
Go to the documentation of this file.
1
11
12#ifndef INFUSE_SDK_INCLUDE_INFUSE_ALGORITHM_RUNNER_ALGORITHMS_TILT_H_
13#define INFUSE_SDK_INCLUDE_INFUSE_ALGORITHM_RUNNER_ALGORITHMS_TILT_H_
14
15#include <stdint.h>
16
17#include <zephyr/toolchain.h>
18
21#include <infuse/math/filter.h>
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
33
34enum {
36};
37
45
47void algorithm_tilt_fn(const struct zbus_channel *chan,
48 const struct algorithm_runner_common_config *common, const void *args,
49 void *data);
50
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, \
67 }; \
68 static struct kv_alg_tilt_args name##_default_args = { \
69 .logging = \
70 { \
71 .loggers = loggers_, \
72 .tdf_mask = tdfs, \
73 }, \
74 .args = \
75 { \
76 .iir_filter_alpha = filter_alpha, \
77 .one_g_percent = one_g_valid_percent, \
78 }, \
79 }; \
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, \
86 }
87
91
92#ifdef __cplusplus
93}
94#endif
95
96#endif /* INFUSE_SDK_INCLUDE_INFUSE_ALGORITHM_RUNNER_ALGORITHMS_TILT_H_ */
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
Data filtering library.
Infuse-IoT statistics helpers.
Definition runner.h:31
Definition tilt.h:38
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