aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--accel.c2
-rw-r--r--gyro.c2
-rw-r--r--i2c.c4
3 files changed, 4 insertions, 4 deletions
diff --git a/accel.c b/accel.c
index 127cc0f..bd73043 100644
--- a/accel.c
+++ b/accel.c
@@ -167,7 +167,7 @@ bool accelProcess () {
reading = false;
}
} else {
- if (!((PINC >> PINC1) & 0x1) && twr.status != TWST_WAIT) {
+ if (!((PINC >> PINC1) & 0x1) && twr.status == TWST_OK) {
/* new data available in device buffer and bus is free */
if (!twRequest (TWM_READ, LIS302DL, LIS302DL_OUTZ,
(uint8_t *) &zval, sizeof (zval))) {
diff --git a/gyro.c b/gyro.c
index 35ec76b..f31385d 100644
--- a/gyro.c
+++ b/gyro.c
@@ -99,7 +99,7 @@ bool gyroProcess () {
reading = false;
}
} else {
- if (((PINB >> PINB1) & 0x1) && twr.status != TWST_WAIT) {
+ if (((PINB >> PINB1) & 0x1) && twr.status == TWST_OK) {
/* new data available in device buffer and bus is free */
if (!twRequest (TWM_READ, L3GD20, L3GD20_OUTZ,
(uint8_t *) &zval, sizeof (zval))) {
diff --git a/i2c.c b/i2c.c
index 7fe4fd2..00dee14 100644
--- a/i2c.c
+++ b/i2c.c
@@ -64,14 +64,14 @@ void twInit () {
#endif
twr.mode = TWM_INVALID;
- twr.status = TWST_ERR;
+ twr.status = TWST_OK;
}
/* high-level write
*/
bool twRequest (const twMode mode, const uint8_t address,
const uint8_t subaddress, uint8_t * const data, const uint8_t count) {
- assert (twr.status != TWST_WAIT);
+ assert (twr.status == TWST_OK);
twr.mode = mode;
twr.address = address;