| ICM42370P eMD Driver 2.2.7 Documentation of the eMD Driver API

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

inv_imu_apex.h
Go to the documentation of this file.
1 /*
2 * ________________________________________________________________________________________________________
3 * Copyright (c) 2017 InvenSense Inc. All rights reserved.
4 *
5 * This software, related documentation and any modifications thereto (collectively "Software") is subject
6 * to InvenSense and its licensors' intellectual property rights under U.S. and international copyright
7 * and other intellectual property rights laws.
8 *
9 * InvenSense and its licensors retain all intellectual property and proprietary rights in and to the Software
10 * and any use, reproduction, disclosure or distribution of the Software without an express license agreement
11 * from InvenSense is strictly prohibited.
12 *
13 * EXCEPT AS OTHERWISE PROVIDED IN A LICENSE AGREEMENT BETWEEN THE PARTIES, THE SOFTWARE IS
14 * PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
15 * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
16 * EXCEPT AS OTHERWISE PROVIDED IN A LICENSE AGREEMENT BETWEEN THE PARTIES, IN NO EVENT SHALL
17 * INVENSENSE BE LIABLE FOR ANY DIRECT, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
18 * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
19 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
20 * OF THE SOFTWARE.
21 * ________________________________________________________________________________________________________
22 */
23
31 #ifndef _INV_IMU_APEX_H_
32 #define _INV_IMU_APEX_H_
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 #include "imu/inv_imu_defs.h"
39
40 #include "Invn/InvError.h"
41
42 #include <stdint.h>
43 #include <string.h>
44
45 /* Forward declarations */
46 struct inv_imu_device;
47
49 typedef struct {
50 APEX_CONFIG3_PEDO_AMP_TH_t pedo_amp_th;
51 uint8_t pedo_step_cnt_th;
52 uint8_t pedo_step_det_th;
53 APEX_CONFIG4_PEDO_SB_TIMER_TH_t pedo_sb_timer_th;
54 APEX_CONFIG4_PEDO_HI_ENRGY_TH_t pedo_hi_enrgy_th;
55 APEX_CONFIG5_TILT_WAIT_TIME_t tilt_wait_time;
56 APEX_CONFIG2_DMP_POWER_SAVE_TIME_t power_save_time;
57 APEX_CONFIG0_DMP_POWER_SAVE_t power_save;
58 APEX_CONFIG9_SENSITIVITY_MODE_t sensitivity_mode;
59 APEX_CONFIG2_LOW_ENERGY_AMP_TH_t low_energy_amp_th;
60 APEX_CONFIG9_SMD_SENSITIVITY_t smd_sensitivity;
61 APEX_CONFIG9_FF_DEBOUNCE_DURATION_t ff_debounce_duration;
62 APEX_CONFIG12_FF_MAX_DURATION_t ff_max_duration_cm;
63 APEX_CONFIG12_FF_MIN_DURATION_t ff_min_duration_cm;
64 APEX_CONFIG10_LOWG_PEAK_TH_t lowg_peak_th;
65 APEX_CONFIG5_LOWG_PEAK_TH_HYST_t lowg_peak_hyst;
66 APEX_CONFIG10_LOWG_TIME_TH_SAMPLES_t lowg_samples_th;
67 APEX_CONFIG11_HIGHG_PEAK_TH_t highg_peak_th;
68 APEX_CONFIG5_HIGHG_PEAK_TH_HYST_t highg_peak_hyst;
69 APEX_CONFIG11_HIGHG_TIME_TH_SAMPLES_t highg_samples_th;
70 } inv_imu_apex_parameters_t;
71
73 typedef struct inv_imu_apex_step_activity {
75 uint16_t step_cnt;
76
81 uint8_t step_cadence;
82
86 uint8_t activity_class;
87 } inv_imu_apex_step_activity_t;
88
93 int inv_imu_apex_enable_ff(struct inv_imu_device *s);
94
99 int inv_imu_apex_disable_ff(struct inv_imu_device *s);
100
106 int inv_imu_apex_enable_smd(struct inv_imu_device *s);
107
112 int inv_imu_apex_disable_smd(struct inv_imu_device *s);
113
119 int inv_imu_apex_init_parameters_struct(struct inv_imu_device * s,
120 inv_imu_apex_parameters_t *apex_inputs);
121
130 int inv_imu_apex_configure_parameters(struct inv_imu_device * s,
131 const inv_imu_apex_parameters_t *apex_inputs);
132
138 int inv_imu_apex_get_parameters(struct inv_imu_device *s, inv_imu_apex_parameters_t *apex_params);
139
146 int inv_imu_apex_set_frequency(struct inv_imu_device *s, const APEX_CONFIG1_DMP_ODR_t frequency);
147
152 int inv_imu_apex_enable_pedometer(struct inv_imu_device *s);
153
158 int inv_imu_apex_disable_pedometer(struct inv_imu_device *s);
159
164 int inv_imu_apex_enable_tilt(struct inv_imu_device *s);
165
170 int inv_imu_apex_disable_tilt(struct inv_imu_device *s);
171
177 int inv_imu_apex_get_data_activity(struct inv_imu_device * s,
178 inv_imu_apex_step_activity_t *apex_activity);
179
185 int inv_imu_apex_get_data_free_fall(struct inv_imu_device *s, uint16_t *freefall_duration);
186
187 #ifdef __cplusplus
188 }
189 #endif
190
191 #endif /* _INV_IMU_APEX_H_ */
192
inv_imu_defs.h
File exposing the device register map.
APEX_CONFIG0_DMP_POWER_SAVE_t
APEX_CONFIG0_DMP_POWER_SAVE_t
Definition: inv_imu_defs.h:406
APEX_CONFIG3_PEDO_AMP_TH_t
APEX_CONFIG3_PEDO_AMP_TH_t
Definition: inv_imu_defs.h:739
APEX_CONFIG11_HIGHG_PEAK_TH_t
APEX_CONFIG11_HIGHG_PEAK_TH_t
Definition: inv_imu_defs.h:919
APEX_CONFIG4_PEDO_SB_TIMER_TH_t
APEX_CONFIG4_PEDO_SB_TIMER_TH_t
Definition: inv_imu_defs.h:764
APEX_CONFIG5_TILT_WAIT_TIME_t
APEX_CONFIG5_TILT_WAIT_TIME_t
Definition: inv_imu_defs.h:789
APEX_CONFIG10_LOWG_TIME_TH_SAMPLES_t
APEX_CONFIG10_LOWG_TIME_TH_SAMPLES_t
Definition: inv_imu_defs.h:902
APEX_CONFIG5_LOWG_PEAK_TH_HYST_t
APEX_CONFIG5_LOWG_PEAK_TH_HYST_t
Definition: inv_imu_defs.h:797
APEX_CONFIG4_PEDO_HI_ENRGY_TH_t
APEX_CONFIG4_PEDO_HI_ENRGY_TH_t
Definition: inv_imu_defs.h:776
APEX_CONFIG12_FF_MIN_DURATION_t
APEX_CONFIG12_FF_MIN_DURATION_t
Definition: inv_imu_defs.h:1008
APEX_CONFIG5_HIGHG_PEAK_TH_HYST_t
APEX_CONFIG5_HIGHG_PEAK_TH_HYST_t
Definition: inv_imu_defs.h:809
APEX_CONFIG2_DMP_POWER_SAVE_TIME_t
APEX_CONFIG2_DMP_POWER_SAVE_TIME_t
Definition: inv_imu_defs.h:714
APEX_CONFIG9_SENSITIVITY_MODE_t
APEX_CONFIG9_SENSITIVITY_MODE_t
Definition: inv_imu_defs.h:855
APEX_CONFIG1_DMP_ODR_t
APEX_CONFIG1_DMP_ODR_t
Definition: inv_imu_defs.h:453
APEX_CONFIG9_FF_DEBOUNCE_DURATION_t
APEX_CONFIG9_FF_DEBOUNCE_DURATION_t
Definition: inv_imu_defs.h:826
APEX_CONFIG12_FF_MAX_DURATION_t
APEX_CONFIG12_FF_MAX_DURATION_t
Definition: inv_imu_defs.h:988
APEX_CONFIG9_SMD_SENSITIVITY_t
APEX_CONFIG9_SMD_SENSITIVITY_t
Definition: inv_imu_defs.h:846
APEX_CONFIG2_LOW_ENERGY_AMP_TH_t
APEX_CONFIG2_LOW_ENERGY_AMP_TH_t
Definition: inv_imu_defs.h:694
APEX_CONFIG10_LOWG_PEAK_TH_t
APEX_CONFIG10_LOWG_PEAK_TH_t
Definition: inv_imu_defs.h:866
APEX_CONFIG11_HIGHG_TIME_TH_SAMPLES_t
APEX_CONFIG11_HIGHG_TIME_TH_SAMPLES_t
Definition: inv_imu_defs.h:954
inv_imu_apex_disable_smd
int inv_imu_apex_disable_smd(struct inv_imu_device *s)
Disable Significant Motion Detection.
inv_imu_apex_enable_pedometer
int inv_imu_apex_enable_pedometer(struct inv_imu_device *s)
Enable APEX algorithm Pedometer.
inv_imu_apex_configure_parameters
int inv_imu_apex_configure_parameters(struct inv_imu_device *s, const inv_imu_apex_parameters_t *apex_inputs)
Configures DMP parameters for APEX algorithms.
inv_imu_apex_disable_ff
int inv_imu_apex_disable_ff(struct inv_imu_device *s)
Disable Free Fall.
inv_imu_apex_set_frequency
int inv_imu_apex_set_frequency(struct inv_imu_device *s, const APEX_CONFIG1_DMP_ODR_t frequency)
Configure DMP Output Data Rate for APEX algorithms.
inv_imu_apex_step_activity_t
struct inv_imu_apex_step_activity inv_imu_apex_step_activity_t
APEX pedometer outputs.
inv_imu_apex_get_data_activity
int inv_imu_apex_get_data_activity(struct inv_imu_device *s, inv_imu_apex_step_activity_t *apex_activity)
Retrieve APEX pedometer outputs and format them.
inv_imu_apex_enable_smd
int inv_imu_apex_enable_smd(struct inv_imu_device *s)
Enable Significant Motion Detection.
inv_imu_apex_disable_pedometer
int inv_imu_apex_disable_pedometer(struct inv_imu_device *s)
Disable APEX algorithm Pedometer.
inv_imu_apex_enable_ff
int inv_imu_apex_enable_ff(struct inv_imu_device *s)
Enable Free Fall.
inv_imu_apex_disable_tilt
int inv_imu_apex_disable_tilt(struct inv_imu_device *s)
Disable APEX algorithm Tilt.
inv_imu_apex_init_parameters_struct
int inv_imu_apex_init_parameters_struct(struct inv_imu_device *s, inv_imu_apex_parameters_t *apex_inputs)
Fill the APEX parameters structure with all the default parameters for APEX algorithms.
inv_imu_apex_get_data_free_fall
int inv_imu_apex_get_data_free_fall(struct inv_imu_device *s, uint16_t *freefall_duration)
Retrieve APEX free fall outputs and format them.
inv_imu_apex_get_parameters
int inv_imu_apex_get_parameters(struct inv_imu_device *s, inv_imu_apex_parameters_t *apex_params)
Returns current DMP parameters for APEX algorithms.
inv_imu_apex_enable_tilt
int inv_imu_apex_enable_tilt(struct inv_imu_device *s)
Enable APEX algorithm Tilt.
inv_imu_device
IMU driver states definition.
Definition: inv_imu_driver.h:107
inv_imu_apex_parameters_t
IMU APEX inputs parameters definition.
Definition: inv_imu_apex.h:49
inv_imu_apex_parameters_t::lowg_samples_th
APEX_CONFIG10_LOWG_TIME_TH_SAMPLES_t lowg_samples_th
Definition: inv_imu_apex.h:66
inv_imu_apex_parameters_t::pedo_step_det_th
uint8_t pedo_step_det_th
Definition: inv_imu_apex.h:52
inv_imu_apex_parameters_t::power_save_time
APEX_CONFIG2_DMP_POWER_SAVE_TIME_t power_save_time
Definition: inv_imu_apex.h:56
inv_imu_apex_parameters_t::tilt_wait_time
APEX_CONFIG5_TILT_WAIT_TIME_t tilt_wait_time
Definition: inv_imu_apex.h:55
inv_imu_apex_parameters_t::pedo_step_cnt_th
uint8_t pedo_step_cnt_th
Definition: inv_imu_apex.h:51
inv_imu_apex_parameters_t::power_save
APEX_CONFIG0_DMP_POWER_SAVE_t power_save
Definition: inv_imu_apex.h:57
inv_imu_apex_parameters_t::ff_max_duration_cm
APEX_CONFIG12_FF_MAX_DURATION_t ff_max_duration_cm
Definition: inv_imu_apex.h:62
inv_imu_apex_parameters_t::low_energy_amp_th
APEX_CONFIG2_LOW_ENERGY_AMP_TH_t low_energy_amp_th
Definition: inv_imu_apex.h:59
inv_imu_apex_parameters_t::pedo_amp_th
APEX_CONFIG3_PEDO_AMP_TH_t pedo_amp_th
Definition: inv_imu_apex.h:50
inv_imu_apex_parameters_t::lowg_peak_hyst
APEX_CONFIG5_LOWG_PEAK_TH_HYST_t lowg_peak_hyst
Definition: inv_imu_apex.h:65
inv_imu_apex_parameters_t::sensitivity_mode
APEX_CONFIG9_SENSITIVITY_MODE_t sensitivity_mode
Definition: inv_imu_apex.h:58
inv_imu_apex_parameters_t::ff_min_duration_cm
APEX_CONFIG12_FF_MIN_DURATION_t ff_min_duration_cm
Definition: inv_imu_apex.h:63
inv_imu_apex_parameters_t::pedo_sb_timer_th
APEX_CONFIG4_PEDO_SB_TIMER_TH_t pedo_sb_timer_th
Definition: inv_imu_apex.h:53
inv_imu_apex_parameters_t::lowg_peak_th
APEX_CONFIG10_LOWG_PEAK_TH_t lowg_peak_th
Definition: inv_imu_apex.h:64
inv_imu_apex_parameters_t::smd_sensitivity
APEX_CONFIG9_SMD_SENSITIVITY_t smd_sensitivity
Definition: inv_imu_apex.h:60
inv_imu_apex_parameters_t::ff_debounce_duration
APEX_CONFIG9_FF_DEBOUNCE_DURATION_t ff_debounce_duration
Definition: inv_imu_apex.h:61
inv_imu_apex_parameters_t::highg_samples_th
APEX_CONFIG11_HIGHG_TIME_TH_SAMPLES_t highg_samples_th
Definition: inv_imu_apex.h:69
inv_imu_apex_parameters_t::pedo_hi_enrgy_th
APEX_CONFIG4_PEDO_HI_ENRGY_TH_t pedo_hi_enrgy_th
Definition: inv_imu_apex.h:54
inv_imu_apex_parameters_t::highg_peak_hyst
APEX_CONFIG5_HIGHG_PEAK_TH_HYST_t highg_peak_hyst
Definition: inv_imu_apex.h:68
inv_imu_apex_parameters_t::highg_peak_th
APEX_CONFIG11_HIGHG_PEAK_TH_t highg_peak_th
Definition: inv_imu_apex.h:67
inv_imu_apex_step_activity
APEX pedometer outputs.
Definition: inv_imu_apex.h:73
inv_imu_apex_step_activity::activity_class
uint8_t activity_class
Detected activity.
Definition: inv_imu_apex.h:86
inv_imu_apex_step_activity::step_cadence
uint8_t step_cadence
Walk/run cadence in number of samples.
Definition: inv_imu_apex.h:81
inv_imu_apex_step_activity::step_cnt
uint16_t step_cnt
Number of steps taken.
Definition: inv_imu_apex.h:75