diff options
author | Björn Stenberg <bjorn@haxx.se> | 2003-02-14 09:44:34 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2003-02-14 09:44:34 +0000 |
commit | c4d8d970f6602c80d7362a41da8851dbbf59ae1b (patch) | |
tree | 7e8f936eae5c1854c006c4fe134c4c2ce6f91291 /firmware/drivers/i2c.c | |
parent | 84706a4188cea193a5a095855c1068b1c31a3875 (diff) | |
download | rockbox-c4d8d970f6602c80d7362a41da8851dbbf59ae1b.tar.gz rockbox-c4d8d970f6602c80d7362a41da8851dbbf59ae1b.zip |
The power-saving SLEEP patch by Simon Elén.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3259 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/i2c.c')
-rw-r--r-- | firmware/drivers/i2c.c | 7 |
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 */ |