summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/target/arm/ipod/adc-ipod-pcf.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/firmware/target/arm/ipod/adc-ipod-pcf.c b/firmware/target/arm/ipod/adc-ipod-pcf.c
index bc2524de5d..c0936251ad 100644
--- a/firmware/target/arm/ipod/adc-ipod-pcf.c
+++ b/firmware/target/arm/ipod/adc-ipod-pcf.c
@@ -24,6 +24,7 @@
#include "string.h"
#include "adc.h"
#include "pcf50605.h"
+#include "i2c-pp.h"
struct adc_struct {
long timeout;
@@ -39,6 +40,9 @@ static unsigned short _adc_read(struct adc_struct *adc)
if (adc->timeout < current_tick) {
unsigned char data[2];
unsigned short value;
+
+ i2c_lock();
+
/* 5x per 2 seconds */
adc->timeout = current_tick + (HZ * 2 / 5);
@@ -53,6 +57,8 @@ static unsigned short _adc_read(struct adc_struct *adc)
adc->conversion(&value);
}
adc->data = value;
+
+ i2c_unlock();
return value;
} else
{