MetaWear C++ API  0.18.0
C++ implementation of the MetaWear protocol
accelerometer_bosch.h
Go to the documentation of this file.
1 
9 #pragma once
10 
11 #include "sensor_common.h"
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 const uint8_t MBL_MW_MODULE_ACC_TYPE_BMI160 = 1;
18 const uint8_t MBL_MW_MODULE_ACC_TYPE_BMA255 = 3;
19 
23 typedef enum {
29 
33 typedef enum {
34  MBL_MW_ACC_BMI160_ODR_0_78125Hz= 0,
35  MBL_MW_ACC_BMI160_ODR_1_5625Hz,
36  MBL_MW_ACC_BMI160_ODR_3_125Hz,
37  MBL_MW_ACC_BMI160_ODR_6_25Hz,
38  MBL_MW_ACC_BMI160_ODR_12_5Hz,
39  MBL_MW_ACC_BMI160_ODR_25Hz,
40  MBL_MW_ACC_BMI160_ODR_50Hz,
41  MBL_MW_ACC_BMI160_ODR_100Hz,
42  MBL_MW_ACC_BMI160_ODR_200Hz,
43  MBL_MW_ACC_BMI160_ODR_400Hz,
44  MBL_MW_ACC_BMI160_ODR_800Hz,
45  MBL_MW_ACC_BMI160_ODR_1600Hz
47 
51 typedef enum {
52  MBL_MW_ACC_BMA255_ODR_15_62Hz= 0,
53  MBL_MW_ACC_BMA255_ODR_31_26Hz,
54  MBL_MW_ACC_BMA255_ODR_62_5Hz,
55  MBL_MW_ACC_BMA255_ODR_125Hz,
56  MBL_MW_ACC_BMA255_ODR_250Hz,
57  MBL_MW_ACC_BMA255_ODR_500Hz,
58  MBL_MW_ACC_BMA255_ODR_1000Hz,
59  MBL_MW_ACC_BMA255_ODR_2000Hz
61 
65 typedef enum {
73 
78 typedef enum {
81  MBL_MW_ACC_BOSCH_ORIENTATION_MODE_HIGH_ASYMMETRICAL,
82  MBL_MW_ACC_BOSCH_ORIENTATION_MODE_LOW_ASYMMETRICAL
84 
89 typedef enum {
90  MBL_MW_ACC_BOSCH_TAP_QUIET_TIME_30ms= 0,
91  MBL_MW_ACC_BOSCH_TAP_QUIET_TIME_20ms
97 typedef enum {
98  MBL_MW_ACC_BOSCH_TAP_SHOCK_TIME_50ms= 0,
99  MBL_MW_ACC_BOSCH_TAP_SHOCK_TIME_75ms
105 typedef enum {
106  MBL_MW_ACC_BOSCH_DOUBLE_TAP_WINDOW_50ms= 0,
107  MBL_MW_ACC_BOSCH_DOUBLE_TAP_WINDOW_100ms,
108  MBL_MW_ACC_BOSCH_DOUBLE_TAP_WINDOW_150ms,
109  MBL_MW_ACC_BOSCH_DOUBLE_TAP_WINDOW_200ms,
110  MBL_MW_ACC_BOSCH_DOUBLE_TAP_WINDOW_250ms,
111  MBL_MW_ACC_BOSCH_DOUBLE_TAP_WINDOW_375ms,
112  MBL_MW_ACC_BOSCH_DOUBLE_TAP_WINDOW_500ms,
113  MBL_MW_ACC_BOSCH_DOUBLE_TAP_WINDOW_700ms
115 
119 typedef struct {
120  uint8_t sign;
121  uint8_t x_axis_active;
122  uint8_t y_axis_active;
123  uint8_t z_axis_active;
125 
172 
196 
223 
234 
262 
299 METAWEAR_API void mbl_mw_acc_bosch_enable_tap_detection(const MblMwMetaWearBoard *board, uint8_t enable_single, uint8_t enable_double);
306 
334 
335 
346 
357 
358 #ifdef __cplusplus
359 }
360 #endif
uint8_t y_axis_active
Non-zero if y-axis triggered the motion interrupt.
Definition: accelerometer_bosch.h:122
MblMwAccBoschDoubleTapWindow
Available windows for double tap detection.
Definition: accelerometer_bosch.h:105
METAWEAR_API void mbl_mw_acc_bosch_set_any_motion_threshold(MblMwMetaWearBoard *board, float threshold)
Sets the any motion detector's threshold parameter.
MblMwAccBoschTapQuietTime
Available quiet times for tap detection.
Definition: accelerometer_bosch.h:89
MblMwAccBoschOrientationMode
Calculation modes controlling the conditions that determine the sensor's orientation.
Definition: accelerometer_bosch.h:78
METAWEAR_API MblMwDataSignal * mbl_mw_acc_bosch_get_packed_acceleration_data_signal(const MblMwMetaWearBoard *board)
Variant of acceleration data that packs multiple data samples into 1 BLE packet to increase the data ...
METAWEAR_API void mbl_mw_acc_bosch_start(const MblMwMetaWearBoard *board)
Switches the accelerometer to active mode.
METAWEAR_API void mbl_mw_acc_bosch_write_tap_config(const MblMwMetaWearBoard *board)
Sets the tap detector's double tap window.
MblMwAccBoschRange
Available g-ranges on the Bosch accelerometers.
Definition: accelerometer_bosch.h:23
struct MblMwMetaWearBoard MblMwMetaWearBoard
Software representation of a physical MetaWear board.
Definition: metawearboard_fwd.h:17
METAWEAR_API void mbl_mw_acc_bosch_set_orientation_mode(MblMwMetaWearBoard *board, MblMwAccBoschOrientationMode mode)
Set the orientation calculation mode.
METAWEAR_API void mbl_mw_acc_bmi160_disable_step_detector(const MblMwMetaWearBoard *board)
Disables the BMI160 step detector.
METAWEAR_API MblMwDataSignal * mbl_mw_acc_bosch_get_acceleration_data_signal(const MblMwMetaWearBoard *board)
Retrieves the data signal representing acceleration data from a Bosch accelerometer.
MblMwAccBoschTapShockTime
Available shock times for tap detection.
Definition: accelerometer_bosch.h:97
METAWEAR_API void mbl_mw_acc_bosch_disable_tap_detection(const MblMwMetaWearBoard *board)
Disable the tap detector.
Gives few false positives but eventually more false negatives.
Definition: accelerometer_bosch.h:71
Recommended for light weighted persons, gives few false negatives but eventually more false positives...
Definition: accelerometer_bosch.h:69
METAWEAR_API void mbl_mw_acc_bosch_set_double_tap_window(MblMwMetaWearBoard *board, MblMwAccBoschDoubleTapWindow window)
Sets the tap detector's double tap window.
METAWEAR_API MblMwDataSignal * mbl_mw_acc_bosch_get_tap_data_signal(const MblMwMetaWearBoard *board)
Retrieves the data signal representing data from the tap detection algorithm.
METAWEAR_API void mbl_mw_acc_bosch_disable_acceleration_sampling(const MblMwMetaWearBoard *board)
Disables acceleration sampling.
MblMwAccBma255Odr
Available ouput data rates on the BMA255 accelerometer.
Definition: accelerometer_bosch.h:51
METAWEAR_API MblMwDataSignal * mbl_mw_acc_bosch_get_high_freq_acceleration_data_signal(const MblMwMetaWearBoard *board)
METAWEAR_API void mbl_mw_acc_bosch_write_motion_config(const MblMwMetaWearBoard *board)
Writes the motion configuration to the remote device.
METAWEAR_API void mbl_mw_acc_bmi160_enable_step_detector(const MblMwMetaWearBoard *board)
Enables the BMI160 step detector.
METAWEAR_API void mbl_mw_acc_bosch_disable_orientation_detection(const MblMwMetaWearBoard *board)
Disables orientation detection.
MblMwAccBmi160Odr
Available ouput data rates on the BMI160 accelerometer.
Definition: accelerometer_bosch.h:33
METAWEAR_API void mbl_mw_acc_bosch_enable_motion_detection(const MblMwMetaWearBoard *board)
Enables motion detection.
METAWEAR_API void mbl_mw_acc_bmi160_enable_step_counter(MblMwMetaWearBoard *board)
Enables the BMI160 step counter.
METAWEAR_API void mbl_mw_acc_bmi160_write_step_counter_config(const MblMwMetaWearBoard *board)
Writes the step counter configuration to the sensor.
METAWEAR_API MblMwDataSignal * mbl_mw_acc_bmi160_get_step_counter_data_signal(const MblMwMetaWearBoard *board)
Retrieves the data signal representing data from the BMI160 step counter.
METAWEAR_API void mbl_mw_acc_bmi160_set_step_counter_mode(MblMwMetaWearBoard *board, MblMwAccBmi160StepCounterMode mode)
Sets the operational mode of the step counter.
METAWEAR_API void mbl_mw_acc_bosch_stop(const MblMwMetaWearBoard *board)
Switches the accelerometer to standby mode.
METAWEAR_API void mbl_mw_acc_bosch_set_quiet_time(MblMwMetaWearBoard *board, MblMwAccBoschTapQuietTime time)
Sets the tap detector's quiet time parameter.
METAWEAR_API void mbl_mw_acc_bosch_set_range(MblMwMetaWearBoard *board, MblMwAccBoschRange range)
Sets the acceleration range.
METAWEAR_API void mbl_mw_acc_bosch_disable_motion_detection(const MblMwMetaWearBoard *board)
Disables motion detection.
MblMwAccBmi160StepCounterMode
Operation modes for the step counter algorithm.
Definition: accelerometer_bosch.h:65
METAWEAR_API void mbl_mw_acc_bosch_write_orientation_config(const MblMwMetaWearBoard *board)
Writes the orientation detection settings to the board.
METAWEAR_API void mbl_mw_acc_bma255_set_odr(MblMwMetaWearBoard *board, MblMwAccBma255Odr odr)
Sets the output data rate for the BMA255 accelerometer.
METAWEAR_API void mbl_mw_acc_bosch_set_orientation_hysteresis(MblMwMetaWearBoard *board, float hysteresis)
Set the hysteresis offset for portrait/landscape detection.
METAWEAR_API void mbl_mw_acc_bmi160_set_odr(MblMwMetaWearBoard *board, MblMwAccBmi160Odr odr)
Sets the output data rate for the BMI160 accelerometer.
METAWEAR_API MblMwDataSignal * mbl_mw_acc_bosch_get_motion_data_signal(const MblMwMetaWearBoard *board)
Retrieves the data signal representing data from the motion detection algorithm.
Default mode.
Definition: accelerometer_bosch.h:80
METAWEAR_API MblMwDataSignal * mbl_mw_acc_bosch_get_orientation_detection_data_signal(const MblMwMetaWearBoard *board)
Retrieves the data signal representing data from the orientation detection algorithm.
METAWEAR_API void mbl_mw_acc_bosch_enable_tap_detection(const MblMwMetaWearBoard *board, uint8_t enable_single, uint8_t enable_double)
Enables the tap detector.
const uint8_t MBL_MW_MODULE_ACC_TYPE_BMI160
Constant identifying the BMI160 accelerometer module type.
Definition: accelerometer_bosch.h:17
METAWEAR_API void mbl_mw_acc_bosch_set_any_motion_count(MblMwMetaWearBoard *board, uint8_t count)
Sets the any motion detector's count parameter.
+/- 4g
Definition: accelerometer_bosch.h:25
uint8_t x_axis_active
Non-zero if x-axis triggered the motion interrupt.
Definition: accelerometer_bosch.h:121
uint8_t z_axis_active
Non-zero if z-axis triggered the motion interrupt.
Definition: accelerometer_bosch.h:123
METAWEAR_API void mbl_mw_acc_bosch_enable_acceleration_sampling(const MblMwMetaWearBoard *board)
Enables acceleration sampling.
+/- 2g
Definition: accelerometer_bosch.h:24
+/- 16g
Definition: accelerometer_bosch.h:27
METAWEAR_API void mbl_mw_acc_bmi160_reset_step_counter(const MblMwMetaWearBoard *board)
Resets the BMI160 step counter.
Recommended for most applications, well balanced between false positives and false negatives...
Definition: accelerometer_bosch.h:67
METAWEAR_API MblMwDataSignal * mbl_mw_acc_bmi160_get_step_detector_data_signal(const MblMwMetaWearBoard *board)
Retrieves the data signal representing data from the BMI160 step detector.
uint8_t sign
Slope sign of the triggering motion, 0 if negative, non-zero if positive.
Definition: accelerometer_bosch.h:120
METAWEAR_API void mbl_mw_acc_bmi160_disable_step_counter(MblMwMetaWearBoard *board)
Disables the BMI160 step counter.
const uint8_t MBL_MW_MODULE_ACC_TYPE_BMA255
Constant identifying the BMA255 accelerometer module type.
Definition: accelerometer_bosch.h:18
METAWEAR_API void mbl_mw_acc_bosch_write_acceleration_config(const MblMwMetaWearBoard *board)
Writes the acceleration settings to the sensor.
METAWEAR_API void mbl_mw_acc_bosch_set_shock_time(MblMwMetaWearBoard *board, MblMwAccBoschTapShockTime time)
Sets the tap detector's shock time parameter.
+/- 8g
Definition: accelerometer_bosch.h:26
METAWEAR_API void mbl_mw_acc_bosch_enable_orientation_detection(const MblMwMetaWearBoard *board)
Enables orientation detection.
#define METAWEAR_API
Indicates the function should be exported to the symbol table.
Definition: dllmarker.h:27
Wrapper class encapsulating responses from any motion detection.
Definition: accelerometer_bosch.h:119
METAWEAR_API void mbl_mw_acc_bosch_set_threshold(MblMwMetaWearBoard *board, float threshold)
Sets the tap detector's threshold.
struct MblMwDataSignal MblMwDataSignal
A event fired from the MetaWear board that also contains data.
Definition: datasignal_fwd.h:15