diff options
author | Rocco Marco Guglielmi <roccomarco.guglielmi@live.com> | 2016-08-31 17:28:13 +0000 |
---|---|---|
committer | Rocco Marco Guglielmi <roccomarco.guglielmi@live.com> | 2016-08-31 17:28:13 +0000 |
commit | f3e61d2cde6739acb39cfd85ebaceb2c77bd7cd2 (patch) | |
tree | 5fd81d83137e040ae80a31392e9d34e781eac596 /os | |
parent | 7e20b9958aa68f3c52d3a45ebe92f252a0447e51 (diff) | |
download | ChibiOS-f3e61d2cde6739acb39cfd85ebaceb2c77bd7cd2.tar.gz ChibiOS-f3e61d2cde6739acb39cfd85ebaceb2c77bd7cd2.tar.bz2 ChibiOS-f3e61d2cde6739acb39cfd85ebaceb2c77bd7cd2.zip |
Added missed acquire bus in LSM303DLHC driver
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9754 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
-rw-r--r-- | os/ex/ST/lsm303dlhc.c | 9 | ||||
-rw-r--r-- | os/ex/ST/lsm303dlhc.h | 20 |
2 files changed, 19 insertions, 10 deletions
diff --git a/os/ex/ST/lsm303dlhc.c b/os/ex/ST/lsm303dlhc.c index a86885b27..f538b559c 100644 --- a/os/ex/ST/lsm303dlhc.c +++ b/os/ex/ST/lsm303dlhc.c @@ -472,6 +472,12 @@ static msg_t acc_set_full_scale(void *ip, lsm303dlhc_acc_fs_t fs) { scale = newfs / ((LSM303DLHCDriver *)ip)->accfullscale;
((LSM303DLHCDriver *)ip)->accfullscale = newfs;
+#if LSM303DLHC_SHARED_I2C
+ i2cAcquireBus(((LSM303DLHCDriver *)ip)->config->i2cp);
+ i2cStart(((LSM303DLHCDriver *)ip)->config->i2cp,
+ ((LSM303DLHCDriver *)ip)->config->i2ccfg);
+#endif /* LSM303DLHC_SHARED_I2C */
+
/* Updating register.*/
msg = lsm303dlhcI2CReadRegister(((LSM303DLHCDriver *)ip)->config->i2cp,
LSM303DLHC_SAD_ACC,
@@ -486,6 +492,9 @@ static msg_t acc_set_full_scale(void *ip, lsm303dlhc_acc_fs_t fs) { LSM303DLHC_SAD_ACC, buff, 1);
if(msg != MSG_OK)
return msg;
+#if LSM303DLHC_SHARED_I2C
+ i2cReleaseBus(((LSM303DLHCDriver *)ip)->config->i2cp);
+#endif /* LSM303DLHC_SHARED_I2C */
/* Scaling sensitivity and bias. Re-calibration is suggested anyway. */
for(i = 0; i < LSM303DLHC_ACC_NUMBER_OF_AXES; i++) {
diff --git a/os/ex/ST/lsm303dlhc.h b/os/ex/ST/lsm303dlhc.h index 470d8b77e..0fae07b50 100644 --- a/os/ex/ST/lsm303dlhc.h +++ b/os/ex/ST/lsm303dlhc.h @@ -41,7 +41,7 @@ /**
* @brief LSM303DLHC driver version string.
*/
-#define EX_LSM303DLHC_VERSION "1.0.0"
+#define EX_LSM303DLHC_VERSION "1.0.1"
/**
* @brief LSM303DLHC driver version major number.
@@ -56,7 +56,7 @@ /**
* @brief LSM303DLHC driver version patch number.
*/
-#define EX_LSM303DLHC_PATCH 0
+#define EX_LSM303DLHC_PATCH 1
/** @} */
/**
@@ -176,14 +176,14 @@ * @{
*/
#define LSM303DLHC_CTRL_REG1_A_MASK 0xFF
-#define LSM303DLHC_CTRL_REG1_A_XEN (1 << 0)
-#define LSM303DLHC_CTRL_REG1_A_YEN (1 << 1)
-#define LSM303DLHC_CTRL_REG1_A_ZEN (1 << 2)
-#define LSM303DLHC_CTRL_REG1_A_LPEN (1 << 3)
-#define LSM303DLHC_CTRL_REG1_A_ODR0 (1 << 4)
-#define LSM303DLHC_CTRL_REG1_A_ODR1 (1 << 5)
-#define LSM303DLHC_CTRL_REG1_A_ODR2 (1 << 6)
-#define LSM303DLHC_CTRL_REG1_A_ODR3 (1 << 7)
+#define LSM303DLHC_CTRL_REG1_A_XEN (1 << 0)
+#define LSM303DLHC_CTRL_REG1_A_YEN (1 << 1)
+#define LSM303DLHC_CTRL_REG1_A_ZEN (1 << 2)
+#define LSM303DLHC_CTRL_REG1_A_LPEN (1 << 3)
+#define LSM303DLHC_CTRL_REG1_A_ODR0 (1 << 4)
+#define LSM303DLHC_CTRL_REG1_A_ODR1 (1 << 5)
+#define LSM303DLHC_CTRL_REG1_A_ODR2 (1 << 6)
+#define LSM303DLHC_CTRL_REG1_A_ODR3 (1 << 7)
/** @} */
/**
|