@@ -45,9 +45,9 @@ extern "C" {
45
45
*
46
46
*/
47
47
enum imusentype_e {
48
- SEN_TYPE_ACCEL , /**< Accelerometer */
49
- SEN_TYPE_GYRO , /**< Gyroscope */
50
- SEN_TYPE_MAG , /**< Magnetometer */
48
+ SENSOR_TYPE_ACCEL , /**< Accelerometer */
49
+ SENSOR_TYPE_GYRO , /**< Gyroscope */
50
+ SENSOR_TYPE_MAG , /**< Magnetometer */
51
51
};
52
52
53
53
/**
@@ -81,8 +81,8 @@ typedef void (*imu_eventcb_f)(int event);
81
81
*
82
82
* when configuration is not provided, below are the default threshold values\n
83
83
*
84
- * static_threshold = 0.01g
85
- * motion_detect_threshold = 0.02g
84
+ * static_threshold = 0.02g
85
+ * motion_detect_threshold = 0.05g
86
86
* harsh_accel_threshold = 0.43g
87
87
* harsh_break_threshold = 0.55g
88
88
* harsh_turn_threshold = 0.47g
@@ -201,11 +201,11 @@ struct imu_sensor_t {
201
201
/**
202
202
* @brief Initialize IMU library
203
203
*
204
- * @param config IMU configuration structure (@ref imuconf_t), can be null for default configuration
205
- * @param callback Event callback function, can be null if callback not required
204
+ * @param config IMU configuration structure (@ref imuconf_t), can be NULL for default configuration
205
+ * @param callback Event callback function, can be set to NULL to disable events
206
206
* @return return 0 on success, -1 on failure
207
207
*/
208
- int imu_init (struct imuconf_t * config , imu_eventcb_f callback );
208
+ int imu_lib_init (struct imuconf_t * config , imu_eventcb_f callback );
209
209
210
210
/**
211
211
* @brief Add new sensor to sensor fusion library
@@ -215,6 +215,14 @@ int imu_init(struct imuconf_t *config, imu_eventcb_f callback);
215
215
*/
216
216
int imu_add_sensor (const struct imu_sensor_t * sensor );
217
217
218
+ /**
219
+ * @brief Init config structure with default values
220
+ *
221
+ * @param config structure pointer to initialize
222
+ * @return return 0 on success, -1 on failure
223
+ */
224
+ int imu_initconfig (struct imuconf_t * config );
225
+
218
226
/**
219
227
* @brief Change/set IMU configuration
220
228
*
@@ -223,6 +231,14 @@ int imu_add_sensor(const struct imu_sensor_t *sensor);
223
231
*/
224
232
int imu_setconfig (struct imuconf_t * config );
225
233
234
+ /**
235
+ * @brief Get current IMU configuration
236
+ *
237
+ * @param config pointer to configuration structure to be filled
238
+ * @return return 0 on success, -1 on failure
239
+ */
240
+ int imu_getconfig (struct imuconf_t * config );
241
+
226
242
/**
227
243
* @brief Change/Set event callback function
228
244
*
@@ -253,9 +269,7 @@ int imu_get_accel(float *ax, float *ay, float *az);
253
269
int imu_get_linearaccel (float * ax , float * ay , float * az );
254
270
255
271
/**
256
- * @brief Get acceleration magnitude without gravity component with direction
257
- * positivity value represents acceleration and negative value represent
258
- * deceleration.
272
+ * @brief Get acceleration magnitude without gravity component.
259
273
*
260
274
* @param force Value of force magnitude in unit of g
261
275
* @return return 0 on success, -1 on failure
@@ -297,6 +311,13 @@ int imu_is_ready(void);
297
311
*/
298
312
int imu_is_motionactive (void );
299
313
314
+ /**
315
+ * @brief Get Tilt status
316
+ *
317
+ * @return returns 1 when motion active and 0 otherwise
318
+ */
319
+ int imu_is_tiltactive (void );
320
+
300
321
/**
301
322
* @brief This function initiates sensor calibration
302
323
*
@@ -307,7 +328,7 @@ int imu_calibrate_sensor(int handle);
307
328
308
329
/**
309
330
* @brief This function sets zero position of sensor placement, used for detection
310
- * of tilt, motion etc. Once set zero position is stored inside flash memory.
331
+ * of tilt, motion etc. Once set, zero position is stored inside flash memory.
311
332
*
312
333
* @return return 0 on success, -1 on failure
313
334
*/
@@ -335,6 +356,13 @@ int imu_calibrate_position(void);
335
356
*/
336
357
void imu_set_debuglevel (int level );
337
358
359
+ /**
360
+ * @brief Get current debug level
361
+ *
362
+ * @return debug level
363
+ */
364
+ int imu_get_debuglevel (void );
365
+
338
366
/**
339
367
* @brief Add GPS as sensor
340
368
* If system uses GPS then imu library can use gps to validate some events
@@ -352,6 +380,24 @@ int imu_add_gpssensor(void);
352
380
*/
353
381
int imu_gps_motionassist (int enable );
354
382
383
+ /**
384
+ * @brief Enable library test mode
385
+ *
386
+ * In test mode, GPS sensor (if enabled) will be disabled and
387
+ * events will be generated without any external dependency to
388
+ * test IMU library.
389
+ *
390
+ * @param enable 1 to enable, 0 to disable
391
+ */
392
+ void imu_set_testmode (int enable );
393
+
394
+ /**
395
+ * @brief Get test mode status
396
+ *
397
+ * @return returns 0 if disabled, 1 if enabled
398
+ */
399
+ int imu_get_testmode (void );
400
+
355
401
#ifdef __cplusplus
356
402
}
357
403
#endif
0 commit comments