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
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>
22#include <infuse/fs/kv_types.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
35enum {
37};
38
47
55
57void algorithm_tilt_fn(const struct zbus_channel *chan, const void *config, void *data);
58
68#define ALGORITHM_TILT_DEFINE(name, loggers_, tdfs, filter_alpha, one_g_valid_percent) \
69 static const struct algorithm_tilt_config name##_config = { \
70 .common = \
71 { \
72 .algorithm_id = 0x15F20001, \
73 .zbus_channel = INFUSE_ZBUS_CHAN_IMU, \
74 .state_size = sizeof(struct algorithm_tilt_data), \
75 .logging = \
76 { \
77 .loggers = loggers_, \
78 .tdf_mask = tdfs, \
79 }, \
80 }, \
81 .iir_filter_alpha = filter_alpha, \
82 .one_g_percent = one_g_valid_percent, \
83 }; \
84 static struct algorithm_tilt_data name##_data; \
85 static struct algorithm_runner_algorithm name = { \
86 .impl = algorithm_tilt_fn, \
87 .config = &name##_config.common, \
88 .runtime_state = &name##_data, \
89 }
90
95#ifdef __cplusplus
96}
97#endif
98
99#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 void *config, void *data)
Algorithm implementation, see algorithm_run_fn.
@ ALGORITHM_TILT_LOG_ANGLE
Definition tilt.h:36
Autogenerated KV definitions.
Data filtering library.
Infuse-IoT statistics helpers.
Definition runner.h:29
Definition tilt.h:39
float iir_filter_alpha
IIR filter alpha (see iir_filter_single_pole_f32)
Definition tilt.h:43
uint8_t one_g_percent
Percentage within one G magnitude must be to use for tilt calculation.
Definition tilt.h:45
struct algorithm_runner_common_config common
Common algorithm configuration.
Definition tilt.h:41
Definition tilt.h:48
uint32_t kv_store_crc
Definition tilt.h:51
struct iir_filter_single_pole_f32 filter
Definition tilt.h:49
uint16_t gravity_mag
Definition tilt.h:52
struct kv_gravity_reference gravity
Definition tilt.h:50
bool reference_valid
Definition tilt.h:53
Floating point IIR single-pole filter.
Definition filter.h:147
Reference gravity vector for tilt calculations.
Definition kv_types.h:337