aboutsummaryrefslogtreecommitdiffstats
path: root/os/ex/ST/l3gd20.c
diff options
context:
space:
mode:
authorRocco Marco Guglielmi <roccomarco.guglielmi@gmail.com>2018-03-09 23:14:37 +0000
committerRocco Marco Guglielmi <roccomarco.guglielmi@gmail.com>2018-03-09 23:14:37 +0000
commit610290753dff711fca3c84f50877b2ca0e921d01 (patch)
treefc98797b585143fe2c38e7d5583b05abf24fafc5 /os/ex/ST/l3gd20.c
parentae9e1ec08f4ceaf6ff0623d7e12171ffcdb13a26 (diff)
downloadChibiOS-610290753dff711fca3c84f50877b2ca0e921d01.tar.gz
ChibiOS-610290753dff711fca3c84f50877b2ca0e921d01.tar.bz2
ChibiOS-610290753dff711fca3c84f50877b2ca0e921d01.zip
Minor adjustments on L3GD20 and LSMS303DLHC drivers
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11675 110e8d01-0319-4d1e-a829-52ad28d1bb01
Diffstat (limited to 'os/ex/ST/l3gd20.c')
-rw-r--r--os/ex/ST/l3gd20.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/os/ex/ST/l3gd20.c b/os/ex/ST/l3gd20.c
index c3093d40c..fcb6dd17d 100644
--- a/os/ex/ST/l3gd20.c
+++ b/os/ex/ST/l3gd20.c
@@ -176,16 +176,11 @@ static msg_t gyro_read_cooked(void *ip, float axes[]) {
devp = objGetInstance(L3GD20Driver*, (BaseGyroscope*)ip);
osalDbgAssert((devp->state == L3GD20_READY),
- "gyro_read_cooked(), invalid state");
-#if L3GD20_USE_SPI
- osalDbgAssert((devp->config->spip->state == SPI_READY),
- "gyro_read_cooked(), channel not ready");
-#endif
+ "gyro_read_cooked(), invalid state");
msg = gyro_read_raw(ip, raw);
for(i = 0; i < L3GD20_GYRO_NUMBER_OF_AXES; i++){
- axes[i] = raw[i] * devp->gyrosensitivity[i];
- axes[i] -= devp->gyrobias[i];
+ axes[i] = (raw[i] * devp->gyrosensitivity[i]) - devp->gyrobias[i];
}
return msg;
}
@@ -259,7 +254,7 @@ static msg_t gyro_set_bias(void *ip, float *bp) {
/* Getting parent instance pointer.*/
devp = objGetInstance(L3GD20Driver*, (BaseGyroscope*)ip);
- osalDbgAssert((devp->state != L3GD20_UNINIT),
+ osalDbgAssert((devp->state == L3GD20_READY),
"gyro_set_bias(), invalid state");
for(i = 0; i < L3GD20_GYRO_NUMBER_OF_AXES; i++) {
@@ -287,7 +282,7 @@ static msg_t gyro_reset_bias(void *ip) {
/* Getting parent instance pointer.*/
devp = objGetInstance(L3GD20Driver*, (BaseGyroscope*)ip);
- osalDbgAssert((devp->state != L3GD20_UNINIT),
+ osalDbgAssert((devp->state == L3GD20_READY),
"gyro_reset_bias(), invalid state");
for(i = 0; i < L3GD20_GYRO_NUMBER_OF_AXES; i++)
@@ -316,7 +311,7 @@ static msg_t gyro_set_sensivity(void *ip, float *sp) {
/* Getting parent instance pointer.*/
devp = objGetInstance(L3GD20Driver*, (BaseGyroscope*)ip);
- osalDbgAssert((devp->state != L3GD20_UNINIT),
+ osalDbgAssert((devp->state == L3GD20_READY),
"gyro_set_sensivity(), invalid state");
for(i = 0; i < L3GD20_GYRO_NUMBER_OF_AXES; i++) {
@@ -345,7 +340,7 @@ static msg_t gyro_reset_sensivity(void *ip) {
/* Getting parent instance pointer.*/
devp = objGetInstance(L3GD20Driver*, (BaseGyroscope*)ip);
- osalDbgAssert((devp->state != L3GD20_UNINIT),
+ osalDbgAssert((devp->state == L3GD20_READY),
"gyro_reset_sensivity(), invalid state");
if(devp->config->gyrofullscale == L3GD20_FS_250DPS)
@@ -384,7 +379,7 @@ static msg_t gyro_set_full_scale(L3GD20Driver *devp, l3gd20_fs_t fs) {
osalDbgCheck(devp != NULL);
- osalDbgAssert((devp->state != L3GD20_UNINIT),
+ osalDbgAssert((devp->state == L3GD20_READY),
"gyro_set_full_scale(), invalid state");
#if L3GD20_USE_SPI
osalDbgAssert((devp->config->spip->state == SPI_READY),