Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
imu_wrapper.h
Go to the documentation of this file.
1
5#ifndef BSP_IMU_WRAPPER_H
6#define BSP_IMU_WRAPPER_H
7
8#include <cstdint>
9
11
12namespace lampda {
13namespace bsp {
15namespace imu {
16
18struct Reading
19{
24};
25
28{
29public:
34 bool init() const;
39 bool shutdown() const;
40
42 Reading get_reading() const;
43
45 enum class InterruptType
46 {
47 FreeFall,
48 BigMotion,
49 Step,
51 };
52
54 bool enable_free_fall_detection() const;
56 bool disable_free_fall_detection() const;
57
59 bool enable_big_motion_detection() const;
62
64 bool enable_step_detection() const;
66 bool disable_step_detection() const;
67
69 bool enable_tilt_detection() const;
71 bool disable_tilt_detection() const;
72
75 void disable_detection(const InterruptType interr) const;
76
82 bool enable_interrupt1(const InterruptType interr) const;
84 void disable_interrupt1() const;
85
91 bool enable_interrupt2(const InterruptType interr) const;
93 void disable_interrupt2() const;
94
96 uint16_t get_step_count() const;
97
99 bool is_event_detected(const InterruptType interr) const;
100};
101
102} // namespace imu
103} // namespace bsp
104} // namespace lampda
105
106#endif
IMU wrapper class.
Definition: imu_wrapper.h:28
bool init() const
Initialize the component.
Definition: imu_wrapper.cpp:19
bool enable_tilt_detection() const
Enable tilt detection.
Definition: imu_wrapper.cpp:154
InterruptType
Interrupt type for the event callbacks.
Definition: imu_wrapper.h:46
@ BigMotion
raised with a >6g acceleration
@ AngleChange
raised on portrait to landscape (or inverse) rotation
@ FreeFall
raised during a free fall event
Reading get_reading() const
get the latest accelerometer/gyroscope measurment
Definition: imu_wrapper.cpp:54
bool disable_step_detection() const
Disable step motion event detection.
Definition: imu_wrapper.cpp:141
bool disable_tilt_detection() const
Disable tilt detection.
Definition: imu_wrapper.cpp:173
bool enable_free_fall_detection() const
Enable free fall events detection.
Definition: imu_wrapper.cpp:68
bool is_event_detected(const InterruptType interr) const
return true if the interrupt is raised, do not depend on physical interrupt pins
Definition: imu_wrapper.cpp:372
bool enable_interrupt2(const InterruptType interr) const
Enable the interrupt 2 signal, with the given interrupt type.
Definition: imu_wrapper.cpp:291
bool disable_free_fall_detection() const
Disable free fall events detection.
Definition: imu_wrapper.cpp:81
bool enable_interrupt1(const InterruptType interr) const
Enable the interrupt 1 signal, with the given interrupt type.
Definition: imu_wrapper.cpp:212
bool disable_big_motion_detection() const
Disable big motion events detection.
Definition: imu_wrapper.cpp:108
void disable_interrupt1() const
Disable the interrupt 1 events.
Definition: imu_wrapper.cpp:268
bool shutdown() const
Gracefully shutdown the component.
Definition: imu_wrapper.cpp:48
uint16_t get_step_count() const
Return the step count, only available with the interrupt 2.
Definition: imu_wrapper.cpp:360
void disable_interrupt2() const
Disable the interrupt 2 events.
Definition: imu_wrapper.cpp:337
void disable_detection(const InterruptType interr) const
disable event detection
Definition: imu_wrapper.cpp:186
bool enable_step_detection() const
Enable step motion event detection.
Definition: imu_wrapper.cpp:121
bool enable_big_motion_detection() const
Enable big motion events detection.
Definition: imu_wrapper.cpp:94
Program scope.
Definition: control_fixed_modes.hpp:12
IMU reading.
Definition: imu_wrapper.h:19
utils::vec3d gyro
gyroscopic speed in degree per second
Definition: imu_wrapper.h:23
utils::vec3d accel
accelerometer in G
Definition: imu_wrapper.h:21
3d vector in any space
Definition: vector_math.h:54
Define vectors and rotation matrices, and the possibility to rotate vectors.