48 #ifndef __DRV_MOTION_H__
49 #define __DRV_MOTION_H__
53 #include "nrf_drv_twi.h"
59 DRV_MOTION_FEATURE_RAW_ACCEL,
60 DRV_MOTION_FEATURE_RAW_GYRO,
61 DRV_MOTION_FEATURE_RAW_COMPASS,
62 DRV_MOTION_FEATURE_QUAT,
63 DRV_MOTION_FEATURE_EULER,
64 DRV_MOTION_FEATURE_ROT_MAT,
65 DRV_MOTION_FEATURE_HEADING,
66 DRV_MOTION_FEATURE_GRAVITY_VECTOR,
67 DRV_MOTION_FEATURE_TAP,
68 DRV_MOTION_FEATURE_ORIENTATION,
69 DRV_MOTION_FEATURE_PEDOMETER,
70 DRV_MOTION_FEATURE_WAKE_ON_MOTION
73 typedef uint32_t drv_motion_feature_mask_t;
75 #define DRV_MOTION_FEATURE_MASK_RAW ((1UL << DRV_MOTION_FEATURE_RAW_ACCEL) | (1UL << DRV_MOTION_FEATURE_RAW_COMPASS) | (1UL << DRV_MOTION_FEATURE_RAW_GYRO))
76 #define DRV_MOTION_FEATURE_MASK_RAW_ACCEL (1UL << DRV_MOTION_FEATURE_RAW_ACCEL)
77 #define DRV_MOTION_FEATURE_MASK_RAW_GYRO (1UL << DRV_MOTION_FEATURE_RAW_GYRO)
78 #define DRV_MOTION_FEATURE_MASK_RAW_COMPASS (1UL << DRV_MOTION_FEATURE_RAW_COMPASS)
79 #define DRV_MOTION_FEATURE_MASK_QUAT (1UL << DRV_MOTION_FEATURE_QUAT)
80 #define DRV_MOTION_FEATURE_MASK_EULER (1UL << DRV_MOTION_FEATURE_EULER)
81 #define DRV_MOTION_FEATURE_MASK_ROT_MAT (1UL << DRV_MOTION_FEATURE_ROT_MAT)
82 #define DRV_MOTION_FEATURE_MASK_HEADING (1UL << DRV_MOTION_FEATURE_HEADING)
83 #define DRV_MOTION_FEATURE_MASK_GRAVITY_VECTOR (1UL << DRV_MOTION_FEATURE_GRAVITY_VECTOR)
84 #define DRV_MOTION_FEATURE_MASK_TAP (1UL << DRV_MOTION_FEATURE_TAP)
85 #define DRV_MOTION_FEATURE_MASK_ORIENTATION (1UL << DRV_MOTION_FEATURE_ORIENTATION)
86 #define DRV_MOTION_FEATURE_MASK_PEDOMETER (1UL << DRV_MOTION_FEATURE_PEDOMETER)
87 #define DRV_MOTION_FEATURE_MASK_WAKE_ON_MOTION (1UL << DRV_MOTION_FEATURE_WAKE_ON_MOTION)
89 #define DRV_MOTION_FEATURE_MASK (DRV_MOTION_FEATURE_MASK_RAW_ACCEL | \
90 DRV_MOTION_FEATURE_MASK_RAW_GYRO | \
91 DRV_MOTION_FEATURE_MASK_RAW_COMPASS | \
92 DRV_MOTION_FEATURE_MASK_QUAT | \
93 DRV_MOTION_FEATURE_MASK_EULER | \
94 DRV_MOTION_FEATURE_MASK_ROT_MAT | \
95 DRV_MOTION_FEATURE_MASK_HEADING | \
96 DRV_MOTION_FEATURE_MASK_GRAVITY_VECTOR | \
97 DRV_MOTION_FEATURE_MASK_TAP | \
98 DRV_MOTION_FEATURE_MASK_ORIENTATION | \
99 DRV_MOTION_FEATURE_MASK_PEDOMETER | \
100 DRV_MOTION_FEATURE_MASK_WAKE_ON_MOTION)
102 #define DRV_MOTION_FEATURE_DMP_MASK (DRV_MOTION_FEATURE_MASK_QUAT | \
103 DRV_MOTION_FEATURE_MASK_EULER | \
104 DRV_MOTION_FEATURE_MASK_ROT_MAT | \
105 DRV_MOTION_FEATURE_MASK_HEADING | \
106 DRV_MOTION_FEATURE_MASK_GRAVITY_VECTOR | \
107 DRV_MOTION_FEATURE_MASK_TAP | \
108 DRV_MOTION_FEATURE_MASK_ORIENTATION | \
109 DRV_MOTION_FEATURE_MASK_PEDOMETER)
111 #define DRV_MOTION_FEATURE_GESTURE_MASK (DRV_MOTION_FEATURE_MASK_TAP | \
112 DRV_MOTION_FEATURE_MASK_ORIENTATION | \
113 DRV_MOTION_FEATURE_MASK_PEDOMETER)
115 #define DRV_MOTION_FEATURE_CONTINUOS_MASK (DRV_MOTION_FEATURE_MASK_RAW_ACCEL | \
116 DRV_MOTION_FEATURE_MASK_RAW_GYRO | \
117 DRV_MOTION_FEATURE_MASK_RAW_COMPASS | \
118 DRV_MOTION_FEATURE_MASK_QUAT | \
119 DRV_MOTION_FEATURE_MASK_EULER | \
120 DRV_MOTION_FEATURE_MASK_ROT_MAT | \
121 DRV_MOTION_FEATURE_MASK_HEADING | \
122 DRV_MOTION_FEATURE_MASK_GRAVITY_VECTOR)
130 DRV_MOTION_EVT_EULER,
131 DRV_MOTION_EVT_ROT_MAT,
132 DRV_MOTION_EVT_HEADING,
133 DRV_MOTION_EVT_GRAVITY,
135 DRV_MOTION_EVT_ORIENTATION,
136 DRV_MOTION_EVT_PEDOMETER
147 uint16_t pedo_interval_ms;
148 uint16_t temp_interval_ms;
149 uint16_t compass_interval_ms;
150 uint16_t motion_freq_hz;
151 uint8_t wake_on_motion;
158 nrf_drv_twi_t
const * p_twi_instance;
159 nrf_drv_twi_config_t
const * p_twi_cfg;