diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2015-01-20 15:51:50 +0100 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2015-01-20 15:51:50 +0100 |
commit | 2c40f4a0e5c9e9bda8d3b59553abf01abe97c5cd (patch) | |
tree | b384758140112e5ec55acd20141339b83d1f1244 /i2c.c | |
parent | 1f6686fe0f16a3620ee4f0ad012a2add5e03c584 (diff) | |
download | hourglass-2c40f4a0e5c9e9bda8d3b59553abf01abe97c5cd.tar.gz hourglass-2c40f4a0e5c9e9bda8d3b59553abf01abe97c5cd.tar.bz2 hourglass-2c40f4a0e5c9e9bda8d3b59553abf01abe97c5cd.zip |
i2c: twRequests returns false if bus is busy
Diffstat (limited to 'i2c.c')
-rw-r--r-- | i2c.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -66,11 +66,15 @@ void twInit () { twr.status = TWST_OK; } -/* high-level write +/* high-level write, returns false if bus is busy */ 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_OK); + /* busy */ + if (twr.status != TWST_OK) { + return false; + } + assert (count > 0); assert (data != NULL); |