aboutsummaryrefslogtreecommitdiffstats
path: root/os/ex
diff options
context:
space:
mode:
authorRocco Marco Guglielmi <roccomarco.guglielmi@gmail.com>2018-02-05 11:24:40 +0000
committerRocco Marco Guglielmi <roccomarco.guglielmi@gmail.com>2018-02-05 11:24:40 +0000
commit6b491d1edabf6148873e5a1ccd70b161b854c734 (patch)
tree726892a54fa4b5b224d0ce24c4a8674bbcd9fc03 /os/ex
parent8c23b103dd0c50f98dec7509b0452bae2043dcae (diff)
downloadChibiOS-6b491d1edabf6148873e5a1ccd70b161b854c734.tar.gz
ChibiOS-6b491d1edabf6148873e5a1ccd70b161b854c734.tar.bz2
ChibiOS-6b491d1edabf6148873e5a1ccd70b161b854c734.zip
Updated LSM6DS0 driver to v 1.0.4 (Fixing Bug #915).
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11447 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/ex')
-rw-r--r--os/ex/ST/lsm6ds0.c25
-rw-r--r--os/ex/ST/lsm6ds0.h81
2 files changed, 52 insertions, 54 deletions
diff --git a/os/ex/ST/lsm6ds0.c b/os/ex/ST/lsm6ds0.c
index 392926ce4..81b35d559 100644
--- a/os/ex/ST/lsm6ds0.c
+++ b/os/ex/ST/lsm6ds0.c
@@ -554,28 +554,17 @@ static msg_t gyro_set_full_scale(void *ip, lsm6ds0_gyro_fs_t fs) {
return msg;
}
-static const struct BaseSensorVMT vmt_basesensor = {
+static const struct BaseSensorVMT vmt_sensor = {
sens_get_axes_number, sens_read_raw, sens_read_cooked
};
-static const struct BaseGyroscopeVMT vmt_basegyroscope = {
- gyro_get_axes_number, gyro_read_raw, gyro_read_cooked,
- gyro_sample_bias, gyro_set_bias, gyro_reset_bias,
- gyro_set_sensivity, gyro_reset_sensivity
-};
-
-static const struct BaseAccelerometerVMT vmt_baseaccelerometer = {
- acc_get_axes_number, acc_read_raw, acc_read_cooked,
- acc_set_bias, acc_reset_bias, acc_set_sensivity, acc_reset_sensivity
-};
-
-static const struct LSM6DS0ACCVMT vmt_lsm6ds0acc = {
+static const struct LSM6DS0AccelerometerVMT vmt_accelerometer = {
acc_get_axes_number, acc_read_raw, acc_read_cooked,
acc_set_bias, acc_reset_bias, acc_set_sensivity, acc_reset_sensivity,
acc_set_full_scale
};
-static const struct LSM6DS0GYROVMT vmt_lsm6ds0gyro = {
+static const struct LSM6DS0GyroscopeVMT vmt_gyroscope = {
gyro_get_axes_number, gyro_read_raw, gyro_read_cooked,
gyro_sample_bias, gyro_set_bias, gyro_reset_bias,
gyro_set_sensivity, gyro_reset_sensivity, gyro_set_full_scale
@@ -594,11 +583,9 @@ static const struct LSM6DS0GYROVMT vmt_lsm6ds0gyro = {
*/
void lsm6ds0ObjectInit(LSM6DS0Driver *devp) {
uint32_t i;
- devp->vmt_basesensor = &vmt_basesensor;
- devp->vmt_baseaccelerometer = &vmt_baseaccelerometer;
- devp->vmt_basegyroscope = &vmt_basegyroscope;
- devp->vmt_lsm6ds0acc = &vmt_lsm6ds0acc;
- devp->vmt_lsm6ds0gyro = &vmt_lsm6ds0gyro;
+ devp->vmt_sensor = &vmt_sensor;
+ devp->vmt_accelerometer = &vmt_accelerometer;
+ devp->vmt_gyroscope = &vmt_gyroscope;
devp->config = NULL;
for(i = 0; i < LSM6DS0_ACC_NUMBER_OF_AXES; i++)
devp->accbias[i] = 0.0f;
diff --git a/os/ex/ST/lsm6ds0.h b/os/ex/ST/lsm6ds0.h
index fa180d768..e1d52883b 100644
--- a/os/ex/ST/lsm6ds0.h
+++ b/os/ex/ST/lsm6ds0.h
@@ -43,22 +43,22 @@
/**
* @brief LSM6DS0 driver version string.
*/
-#define EX_LSM6DS0_VERSION "1.0.3"
+#define EX_LSM6DS0_VERSION "1.0.4"
/**
* @brief LSM6DS0 driver version major number.
*/
-#define EX_LSM6DS0_MAJOR 1
+#define EX_LSM6DS0_MAJOR 1
/**
* @brief LSM6DS0 driver version minor number.
*/
-#define EX_LSM6DS0_MINOR 0
+#define EX_LSM6DS0_MINOR 0
/**
* @brief LSM6DS0 driver version patch number.
*/
-#define EX_LSM6DS0_PATCH 3
+#define EX_LSM6DS0_PATCH 4
/** @} */
/**
@@ -99,11 +99,11 @@
* @name LSM6DS0 communication interfaces related bit masks
* @{
*/
-#define LSM6DS0_DI_MASK 0xFF /**< Data In mask */
-#define LSM6DS0_DI(n) (1 << n) /**< Data In bit n */
-#define LSM6DS0_AD_MASK 0x7F /**< Address Data mask */
-#define LSM6DS0_AD(n) (1 << n) /**< Address Data bit n */
-#define LSM6DS0_MS (1 << 7) /**< Multiple read write */
+#define LSM6DS0_DI_MASK 0xFF
+#define LSM6DS0_DI(n) (1 << n)
+#define LSM6DS0_AD_MASK 0x7F
+#define LSM6DS0_AD(n) (1 << n)
+#define LSM6DS0_MS (1 << 7)
/** @} */
/**
@@ -677,33 +677,42 @@ typedef struct {
} LSM6DS0Config;
/**
- * @brief Structure representing a LSM6DS0 driver.
- */
-typedef struct LSM6DS0Driver LSM6DS0Driver;
-
-/**
* @brief @p LSM6DS0 accelerometer subsystem specific methods.
*/
-#define _lsm6ds0_acc_methods \
- _base_accelerometer_methods \
+#define _lsm6ds0_accelerometer_methods_alone \
/* Change full scale value of LSM6DS0 accelerometer subsystem .*/ \
msg_t (*set_full_scale)(void *instance, lsm6ds0_acc_fs_t fs);
+
+/**
+ * @brief @p LSM6DS0 accelerometer subsystem specific methods.
+ */
+#define _lsm6ds0_accelerometer_methods \
+ _base_accelerometer_methods \
+ _lsm6ds0_accelerometer_methods_alone
+
/**
* @brief @p LSM6DS0 gyroscope subsystem specific methods.
*/
-#define _lsm6ds0_gyro_methods \
- _base_gyroscope_methods \
+#define _lsm6ds0_gyroscope_methods_alone \
/* Change full scale value of LSM6DS0 gyroscope subsystem .*/ \
msg_t (*set_full_scale)(void *instance, lsm6ds0_gyro_fs_t fs);
+
+/**
+ * @brief @p LSM6DS0 gyroscope subsystem specific methods.
+ */
+#define _lsm6ds0_gyroscope_methods \
+ _base_gyroscope_methods \
+ _lsm6ds0_gyroscope_methods_alone
+
/**
* @extends BaseAccelerometerVMT
*
* @brief @p LSM6DS0 accelerometer virtual methods table.
*/
-struct LSM6DS0ACCVMT {
- _lsm6ds0_acc_methods
+struct LSM6DS0AccelerometerVMT {
+ _lsm6ds0_accelerometer_methods
};
/**
@@ -711,16 +720,14 @@ struct LSM6DS0ACCVMT {
*
* @brief @p LSM6DS0 gyroscope virtual methods table.
*/
-struct LSM6DS0GYROVMT {
- _lsm6ds0_gyro_methods
+struct LSM6DS0GyroscopeVMT {
+ _lsm6ds0_gyroscope_methods
};
/**
* @brief @p LSM6DS0Driver specific data.
*/
#define _lsm6ds0_data \
- _base_accelerometer_data \
- _base_gyroscope_data \
/* Driver state.*/ \
lsm6ds0_state_t state; \
/* Current configuration data.*/ \
@@ -743,17 +750,21 @@ struct LSM6DS0GYROVMT {
*/
struct LSM6DS0Driver {
/** @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;
+ const struct BaseSensorVMT *vmt_sensor;
+ _base_sensor_data
/** @brief LSM6DS0 Accelerometer Virtual Methods Table. */
- const struct LSM6DS0ACCVMT *vmt_lsm6ds0acc;
+ const struct LSM6DS0AccelerometerVMT *vmt_accelerometer;
+ _base_accelerometer_data
/** @brief LSM6DS0 Gyroscope Virtual Methods Table. */
- const struct LSM6DS0GYROVMT *vmt_lsm6ds0gyro;
+ const struct LSM6DS0GyroscopeVMT *vmt_gyroscope;
+ _base_gyroscope_data
_lsm6ds0_data
};
+
+/**
+ * @brief Structure representing a LSM6DS0 driver.
+ */
+typedef struct LSM6DS0Driver LSM6DS0Driver;
/** @} */
/*===========================================================================*/
@@ -763,7 +774,7 @@ struct LSM6DS0Driver {
/**
* @brief Change accelerometer fullscale value.
*
- * @param[in] ip pointer to a @p BaseAccelerometer class.
+ * @param[in] ip pointer to a @p LSM6DS0Driver class.
* @param[in] fs the new full scale value.
*
* @return The operation status.
@@ -772,12 +783,12 @@ struct LSM6DS0Driver {
* @api
*/
#define accelerometerSetFullScale(ip, fs) \
- (ip)->vmt_lsm6ds0acc->set_full_scale(ip, fs)
+ (ip)->vmt_accelerometer->set_full_scale(ip, fs)
/**
* @brief Change compass fullscale value.
*
- * @param[in] ip pointer to a @p BaseGyroscope class.
+ * @param[in] ip pointer to a @p LSM6DS0Driver class.
* @param[in] fs the new full scale value.
*
* @return The operation status.
@@ -786,7 +797,7 @@ struct LSM6DS0Driver {
* @api
*/
#define gyroscopeSetFullScale(ip, fs) \
- (ip)->vmt_lsm6ds0gyro->set_full_scale(ip, fs)
+ (ip)->vmt_gyroscope->set_full_scale(ip, fs)
/*===========================================================================*/
/* External declarations. */