aboutsummaryrefslogtreecommitdiffstats
path: root/os/ex/ST/lsm6ds0.h
diff options
context:
space:
mode:
authorRocco Marco Guglielmi <roccomarco.guglielmi@live.com>2016-04-23 14:42:32 +0000
committerRocco Marco Guglielmi <roccomarco.guglielmi@live.com>2016-04-23 14:42:32 +0000
commitf7a345cfc638ba24581fe91cf135679d1f3f7123 (patch)
treeba2feb59c8a00381596a03a31e4f811b29d6ccdd /os/ex/ST/lsm6ds0.h
parent40a039e13831636ec9d61c054123879798303e16 (diff)
downloadChibiOS-f7a345cfc638ba24581fe91cf135679d1f3f7123.tar.gz
ChibiOS-f7a345cfc638ba24581fe91cf135679d1f3f7123.tar.bz2
ChibiOS-f7a345cfc638ba24581fe91cf135679d1f3f7123.zip
Added support for LSM6DS0, improved hal_accelerometer and hal_gyroscope, added a new demo
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9349 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/ex/ST/lsm6ds0.h')
-rw-r--r--os/ex/ST/lsm6ds0.h41
1 files changed, 33 insertions, 8 deletions
diff --git a/os/ex/ST/lsm6ds0.h b/os/ex/ST/lsm6ds0.h
index 06f41419c..2315fd53b 100644
--- a/os/ex/ST/lsm6ds0.h
+++ b/os/ex/ST/lsm6ds0.h
@@ -89,7 +89,7 @@
* @details This is the time between each bias acquisition.
*/
#if !defined(LSM6DS0_GYRO_BIAS_SETTLING_uS) || defined(__DOXYGEN__)
-#define LSM6DS0_GYRO_BIAS_SETTLING_uS 5000
+#define LSM6DS0_GYRO_BIAS_SETTLING_uS 5000
#endif
/** @} */
@@ -502,7 +502,9 @@ typedef struct LSM6DS0Driver LSM6DS0Driver;
* @brief @p LSM6DS0 gyroscope subsystem specific methods.
*/
#define _lsm6ds0_gyro_methods \
- _base_gyroscope_methods
+ _base_gyroscope_methods \
+ /* Retrieve the temperature of LSM6DS0 chip.*/ \
+ msg_t (*get_temperature)(void *instance, float* temperature);
/**
* @extends BaseAccelerometerVMT
@@ -533,9 +535,11 @@ struct LSM6DS0GYROVMT {
/* Current configuration data.*/ \
const LSM6DS0Config *config; \
/* Current accelerometer sensitivity.*/ \
- float accsens; \
+ float accsensitivity[LSM6DS0_ACC_NUMBER_OF_AXES]; \
+ /* Accelerometer bias data.*/ \
+ int32_t accbias[LSM6DS0_ACC_NUMBER_OF_AXES]; \
/* Current gyroscope sensitivity.*/ \
- float gyrosens; \
+ float gyrosensitivity[LSM6DS0_GYRO_NUMBER_OF_AXES]; \
/* Bias data.*/ \
int32_t gyrobias[LSM6DS0_GYRO_NUMBER_OF_AXES];
@@ -543,10 +547,16 @@ struct LSM6DS0GYROVMT {
* @brief LSM6DS0 6-axis accelerometer/gyroscope class.
*/
struct LSM6DS0Driver {
- /** @brief Accelerometer Virtual Methods Table.*/
- const struct LSM6DS0ACCVMT *vmt_baseaccelerometer;
- /** @brief Gyroscope Virtual Methods Table.*/
- const struct LSM6DS0GYROVMT *vmt_basegyroscope;
+ /** @brief BaseSensor Virtual Methods Table. */
+ const struct BaseSensorVMT *vmt_basesensor;
+ /** @brief BaseAccelerometer Virtual Methods Table. */
+ const struct BaseAccelerometerVMT *vmt_baseaccelerometer;
+ /** @brief BaseGyroscope Virtual Methods Table. */
+ const struct BaseGyroscopeVMT *vmt_basegyroscope;
+ /** @brief LSM6DS0 Accelerometer Virtual Methods Table. */
+ const struct LSM6DS0ACCVMT *vmt_lsm6ds0acc;
+ /** @brief LSM6DS0 Gyroscope Virtual Methods Table. */
+ const struct LSM6DS0GYROVMT *vmt_lsm6ds0gyro;
_lsm6ds0_data
};
/** @} */
@@ -555,6 +565,21 @@ struct LSM6DS0Driver {
/* Driver macros. */
/*===========================================================================*/
+/**
+ * @brief Get current MEMS temperature.
+ * @detail This information is very useful especially for high accuracy IMU
+ *
+ * @param[in] ip pointer to a @p BaseGyroscope class.
+ * @param[out] temp the MEMS temperature as single precision floating.
+ *
+ * @return The operation status.
+ * @retval MSG_OK if the function succeeded.
+ * @retval MSG_RESET if one or more errors occurred.
+ * @api
+ */
+#define gyroscopeGetTemp(ip, tpp) \
+ (ip)->vmt_lsm6ds0gyro->get_temperature(ip, tpp)
+
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/