Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
imu.h
Go to the documentation of this file.
1
10#ifndef INFUSE_SDK_INCLUDE_INFUSE_TASK_RUNNER_TASKS_IMU_H_
11#define INFUSE_SDK_INCLUDE_INFUSE_TASK_RUNNER_TASKS_IMU_H_
12
13#include <zephyr/kernel.h>
14
15#include <infuse/drivers/imu.h>
18
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25/* Accelerometer magnitude broadcast structure */
27 /* Metadata for magnitude samples */
29 /* Linear array of all magnitudes */
30 uint32_t magnitudes[];
31};
32
33/* Create type that holds a given number of IMU magnitude samples */
34#define IMU_MAG_ARRAY_TYPE_DEFINE(type_name, max_samples) \
35 struct type_name { \
36 struct imu_sensor_meta meta; \
37 uint32_t magnitudes[max_samples]; \
38 }
39
47void imu_task_fn(const struct task_schedule *schedule, struct k_poll_signal *terminate,
48 void *imu_dev);
49
57#define IMU_TASK(define_mem, define_config, imu_ptr) \
58 IF_ENABLED(define_mem, \
59 (K_THREAD_STACK_DEFINE(imu_stack_area, CONFIG_TASK_RUNNER_TASK_IMU_STACK_SIZE); \
60 struct k_thread imu_thread_obj)) \
61 IF_ENABLED(define_config, \
62 ({ \
63 .name = "imu", \
64 .task_id = TASK_ID_IMU, \
65 .exec_type = TASK_EXECUTOR_THREAD, \
66 .flags = TASK_FLAG_ARG_IS_DEVICE, \
67 .task_arg.dev = imu_ptr, \
68 .executor.thread = \
69 { \
70 .thread = &imu_thread_obj, \
71 .task_fn = imu_task_fn, \
72 .stack = imu_stack_area, \
73 .stack_size = K_THREAD_STACK_SIZEOF(imu_stack_area), \
74 }, \
75 }))
76
77#ifdef __cplusplus
78}
79#endif
80
81#endif /* INFUSE_SDK_INCLUDE_INFUSE_TASK_RUNNER_TASKS_IMU_H_ */
Specialised driver API for IMU devices.
Task Runner task scheduling.
Definition imu.h:26
struct imu_sensor_meta meta
Definition imu.h:28
uint32_t magnitudes[]
Definition imu.h:30
Metadata for each sub-sensor in a FIFO buffer.
Definition imu.h:73
Schedule for a given task.
Definition schedule.h:143
Task Runner Task API.
void imu_task_fn(const struct task_schedule *schedule, struct k_poll_signal *terminate, void *imu_dev)
IMU task function.