summaryrefslogtreecommitdiff
path: root/firmware/drivers/i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/i2c.c')
-rw-r--r--firmware/drivers/i2c.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/firmware/drivers/i2c.c b/firmware/drivers/i2c.c
index 97d7a511e1..f0b5907be8 100644
--- a/firmware/drivers/i2c.c
+++ b/firmware/drivers/i2c.c
@@ -19,6 +19,7 @@
19#include "lcd.h" 19#include "lcd.h"
20#include "sh7034.h" 20#include "sh7034.h"
21#include "kernel.h" 21#include "kernel.h"
22#include "thread.h"
22#include "debug.h" 23#include "debug.h"
23 24
24#define PB13 0x2000 25#define PB13 0x2000
@@ -108,7 +109,8 @@ void i2c_ack(int bit)
108 109
109 SCL_INPUT; /* Set the clock to input */ 110 SCL_INPUT; /* Set the clock to input */
110 while(!SCL) /* and wait for the MAS to release it */ 111 while(!SCL) /* and wait for the MAS to release it */
111 yield(); 112 sleep_thread();
113 wake_up_thread();
112 114
113 DELAY; 115 DELAY;
114 SCL_OUTPUT; 116 SCL_OUTPUT;
@@ -130,7 +132,8 @@ int i2c_getack(void)
130 SDA_INPUT; /* And set to input */ 132 SDA_INPUT; /* And set to input */
131 SCL_INPUT; /* Set the clock to input */ 133 SCL_INPUT; /* Set the clock to input */
132 while(!SCL) /* and wait for the MAS to release it */ 134 while(!SCL) /* and wait for the MAS to release it */
133 yield(); 135 sleep_thread();
136 wake_up_thread();
134 137
135 if (SDA) 138 if (SDA)
136 /* ack failed */ 139 /* ack failed */