aboutsummaryrefslogtreecommitdiffstats
path: root/os/ex
diff options
context:
space:
mode:
authorRocco Marco Guglielmi <roccomarco.guglielmi@gmail.com>2018-02-05 10:46:40 +0000
committerRocco Marco Guglielmi <roccomarco.guglielmi@gmail.com>2018-02-05 10:46:40 +0000
commitb18d616b0cf4317a3b946f5f9a7549b76c3d8e9c (patch)
treecccc0994ed7f90000a3161035f94b4208f598e4c /os/ex
parent6746c5da3f2a1d3ca83ad29708b9a3647f775a06 (diff)
downloadChibiOS-b18d616b0cf4317a3b946f5f9a7549b76c3d8e9c.tar.gz
ChibiOS-b18d616b0cf4317a3b946f5f9a7549b76c3d8e9c.tar.bz2
ChibiOS-b18d616b0cf4317a3b946f5f9a7549b76c3d8e9c.zip
Updated LIS3MDL driver to v 1.0.5 (Fixing Bug #915).
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11444 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/ex')
-rw-r--r--os/ex/ST/lis3mdl.c14
-rw-r--r--os/ex/ST/lis3mdl.h122
2 files changed, 68 insertions, 68 deletions
diff --git a/os/ex/ST/lis3mdl.c b/os/ex/ST/lis3mdl.c
index 07583827d..edb5efd6b 100644
--- a/os/ex/ST/lis3mdl.c
+++ b/os/ex/ST/lis3mdl.c
@@ -297,16 +297,11 @@ static msg_t set_full_scale(void *ip, lis3mdl_fs_t fs) {
return msg;
}
-static const struct BaseSensorVMT vmt_basesensor = {
+static const struct BaseSensorVMT vmt_sensor = {
get_axes_number, read_raw, read_cooked
};
-static const struct BaseCompassVMT vmt_basecompass = {
- get_axes_number, read_raw, read_cooked,
- set_bias, reset_bias, set_sensivity, reset_sensivity
-};
-
-static const struct LIS3MDLVMT vmt_lis3mdl = {
+static const struct LIS3MDLCompassVMT vmt_compass = {
get_axes_number, read_raw, read_cooked,
set_bias, reset_bias, set_sensivity, reset_sensivity,
set_full_scale
@@ -325,9 +320,8 @@ static const struct LIS3MDLVMT vmt_lis3mdl = {
*/
void lis3mdlObjectInit(LIS3MDLDriver *devp) {
uint32_t i;
- devp->vmt_basesensor = &vmt_basesensor;
- devp->vmt_basecompass = &vmt_basecompass;
- devp->vmt_lis3mdl = &vmt_lis3mdl;
+ devp->vmt_sensor = &vmt_sensor;
+ devp->vmt_compass = &vmt_compass;
devp->config = NULL;
for(i = 0; i < LIS3MDL_NUMBER_OF_AXES; i++)
devp->bias[i] = 0.0f;
diff --git a/os/ex/ST/lis3mdl.h b/os/ex/ST/lis3mdl.h
index b82e7adf5..8f3745bb7 100644
--- a/os/ex/ST/lis3mdl.h
+++ b/os/ex/ST/lis3mdl.h
@@ -42,22 +42,22 @@
/**
* @brief LIS3MDL driver version string.
*/
-#define EX_LIS3MDL_VERSION "1.0.4"
+#define EX_LIS3MDL_VERSION "1.0.5"
/**
* @brief LIS3MDL driver version major number.
*/
-#define EX_LIS3MDL_MAJOR 1
+#define EX_LIS3MDL_MAJOR 1
/**
* @brief LIS3MDL driver version minor number.
*/
-#define EX_LIS3MDL_MINOR 0
+#define EX_LIS3MDL_MINOR 0
/**
* @brief LIS3MDL driver version patch number.
*/
-#define EX_LIS3MDL_PATCH 4
+#define EX_LIS3MDL_PATCH 5
/** @} */
/**
@@ -65,56 +65,56 @@
*
* @{
*/
-#define LIS3MDL_NUMBER_OF_AXES 3U
-
-#define LIS3MDL_4GA 4.0f
-#define LIS3MDL_8GA 8.0f
-#define LIS3MDL_12GA 12.0f
-#define LIS3MDL_16GA 16.0f
-
-#define LIS3MDL_SENS_4GA 0.00014615f
-#define LIS3MDL_SENS_8GA 0.00029231f
-#define LIS3MDL_SENS_12GA 0.0004384f
-#define LIS3MDL_SENS_16GA 0.00058445f
+#define LIS3MDL_NUMBER_OF_AXES 3U
+
+#define LIS3MDL_4GA 4.0f
+#define LIS3MDL_8GA 8.0f
+#define LIS3MDL_12GA 12.0f
+#define LIS3MDL_16GA 16.0f
+
+#define LIS3MDL_SENS_4GA 0.00014615f
+#define LIS3MDL_SENS_8GA 0.00029231f
+#define LIS3MDL_SENS_12GA 0.0004384f
+#define LIS3MDL_SENS_16GA 0.00058445f
/** @} */
/**
* @name LIS3MDL communication interfaces related bit masks
* @{
*/
-#define LIS3MDL_DI_MASK 0xFF /**< Data In mask */
-#define LIS3MDL_DI(n) (1 << n) /**< Data In bit n */
-#define LIS3MDL_AD_MASK 0x3F /**< Address Data mask */
-#define LIS3MDL_AD(n) (1 << n) /**< Address Data bit n */
-#define LIS3MDL_MS (1 << 6) /**< Multiple selection */
-#define LIS3MDL_RW (1 << 7) /**< Read Write selector */
-
-#define LIS3MDL_SUB_MS (1 << 7) /**< Multiple RW in I2C mode*/
+#define LIS3MDL_DI_MASK 0xFF
+#define LIS3MDL_DI(n) (1 << n)
+#define LIS3MDL_AD_MASK 0x3F
+#define LIS3MDL_AD(n) (1 << n)
+#define LIS3MDL_MS (1 << 6)
+#define LIS3MDL_RW (1 << 7)
+
+#define LIS3MDL_SUB_MS (1 << 7)
/** @} */
/**
* @name LIS3MDL register addresses
* @{
*/
-#define LIS3MDL_AD_WHO_AM_I 0x0F
-#define LIS3MDL_AD_CTRL_REG1 0x20
-#define LIS3MDL_AD_CTRL_REG2 0x21
-#define LIS3MDL_AD_CTRL_REG3 0x22
-#define LIS3MDL_AD_CTRL_REG4 0x23
-#define LIS3MDL_AD_CTRL_REG5 0x24
-#define LIS3MDL_AD_STATUS_REG 0x27
-#define LIS3MDL_AD_OUT_X_L 0x28
-#define LIS3MDL_AD_OUT_X_H 0x29
-#define LIS3MDL_AD_OUT_Y_L 0x2A
-#define LIS3MDL_AD_OUT_Y_H 0x2B
-#define LIS3MDL_AD_OUT_Z_L 0x2C
-#define LIS3MDL_AD_OUT_Z_H 0x2D
-#define LIS3MDL_AD_TEMP_OUT_L 0x2E
-#define LIS3MDL_AD_TEMP_OUT_H 0x2F
-#define LIS3MDL_AD_INT_CFG 0x30
-#define LIS3MDL_AD_INT_SOURCE 0x31
-#define LIS3MDL_AD_INT_THS_L 0x32
-#define LIS3MDL_AD_INT_THS_H 0x33
+#define LIS3MDL_AD_WHO_AM_I 0x0F
+#define LIS3MDL_AD_CTRL_REG1 0x20
+#define LIS3MDL_AD_CTRL_REG2 0x21
+#define LIS3MDL_AD_CTRL_REG3 0x22
+#define LIS3MDL_AD_CTRL_REG4 0x23
+#define LIS3MDL_AD_CTRL_REG5 0x24
+#define LIS3MDL_AD_STATUS_REG 0x27
+#define LIS3MDL_AD_OUT_X_L 0x28
+#define LIS3MDL_AD_OUT_X_H 0x29
+#define LIS3MDL_AD_OUT_Y_L 0x2A
+#define LIS3MDL_AD_OUT_Y_H 0x2B
+#define LIS3MDL_AD_OUT_Z_L 0x2C
+#define LIS3MDL_AD_OUT_Z_H 0x2D
+#define LIS3MDL_AD_TEMP_OUT_L 0x2E
+#define LIS3MDL_AD_TEMP_OUT_H 0x2F
+#define LIS3MDL_AD_INT_CFG 0x30
+#define LIS3MDL_AD_INT_SOURCE 0x31
+#define LIS3MDL_AD_INT_THS_L 0x32
+#define LIS3MDL_AD_INT_THS_H 0x33
/** @} */
/**
@@ -424,25 +424,26 @@ typedef struct {
} LIS3MDLConfig;
/**
- * @brief Structure representing a LIS3MDL driver.
+ * @brief @p LIS3MDL compass subsystem specific methods.
*/
-typedef struct LIS3MDLDriver LIS3MDLDriver;
-
+#define _lis3msl_compass_methods_alone \
+ /* Change full scale value of LIS3MDL.*/ \
+ msg_t (*set_full_scale)(void *instance, lis3mdl_fs_t fs);
+
/**
* @brief @p LIS3MDL specific methods.
*/
-#define _lis3mdl_methods \
+#define _lis3mdl_compass_methods \
_base_compass_methods \
- /* Change full scale value of LIS3MDL.*/ \
- msg_t (*set_full_scale)(void *instance, lis3mdl_fs_t fs);
+ _lis3msl_compass_methods_alone
/**
* @extends BaseCompassVMT
*
- * @brief @p LIS3MDL virtual methods table.
+ * @brief @p LIS3MDL compass virtual methods table.
*/
-struct LIS3MDLVMT {
- _lis3mdl_methods
+struct LIS3MDLCompassVMT {
+ _lis3mdl_compass_methods
};
/**
@@ -470,13 +471,18 @@ struct LIS3MDLVMT {
*/
struct LIS3MDLDriver {
/** @brief BaseSensor Virtual Methods Table. */
- const struct BaseSensorVMT *vmt_basesensor;
- /** @brief BaseCompass Virtual Methods Table. */
- const struct BaseCompassVMT *vmt_basecompass;
- /** @brief LIS3MDL Virtual Methods Table. */
- const struct LIS3MDLVMT *vmt_lis3mdl;
+ const struct BaseSensorVMT *vmt_sensor;
+ _base_sensor_data
+ /** @brief LIS3MDL Compass Virtual Methods Table. */
+ const struct LIS3MDLCompassVMT *vmt_compass;
+_base_compass_data
_lis3mdl_data
};
+
+/**
+ * @brief Structure representing a LIS3MDL driver.
+ */
+typedef struct LIS3MDLDriver LIS3MDLDriver;
/** @} */
/*===========================================================================*/
@@ -486,7 +492,7 @@ struct LIS3MDLDriver {
/**
* @brief Change compass full scale value.
*
- * @param[in] ip pointer to a @p BaseCompass class.
+ * @param[in] ip pointer to a @p LIS3MDLDriver class.
* @param[in] fs the new full scale value.
*
* @return The operation status.
@@ -495,7 +501,7 @@ struct LIS3MDLDriver {
* @api
*/
#define compassSetFullScale(ip, fs) \
- (ip)->vmt_lis3mdl->set_full_scale(ip, fs)
+ (ip)->vmt_compass->set_full_scale(ip, fs)
/*===========================================================================*/
/* External declarations. */