diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2014-04-22 16:48:50 +0200 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2014-04-22 16:51:13 +0200 |
commit | b05df9df58bc6fdd122abfec3012bc2537fc069c (patch) | |
tree | f0be81167c40aa7f3490e8018ea92cc21b16f2be /i2c.c | |
parent | 68c180f2aba4471483e1786556c2bc2a94a7d2a7 (diff) | |
download | hourglass-b05df9df58bc6fdd122abfec3012bc2537fc069c.tar.gz hourglass-b05df9df58bc6fdd122abfec3012bc2537fc069c.tar.bz2 hourglass-b05df9df58bc6fdd122abfec3012bc2537fc069c.zip |
Fix interrupt stuff
Sorta polling based now, with interrupts used to wake up from sleep only. At
least it works.
Diffstat (limited to 'i2c.c')
-rw-r--r-- | i2c.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -1,6 +1,8 @@ #include <stdio.h> #include <util/twi.h> #include <avr/interrupt.h> +#include <stdlib.h> +#include <assert.h> #include "i2c.h" #include "common.h" @@ -67,10 +69,7 @@ void twInit () { */ bool twRequest (const twMode mode, const uint8_t address, const uint8_t subaddress, uint8_t * const data, const uint8_t count) { - /* do not start if request is pending */ - if (twr.status == TWST_WAIT) { - return false; - } + assert (twr.status != TWST_WAIT); twr.mode = mode; twr.address = address; |