summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 @@
24#include "string.h" 24#include "string.h"
25#include "adc.h" 25#include "adc.h"
26#include "pcf50605.h" 26#include "pcf50605.h"
27#include "i2c-pp.h"
27 28
28struct adc_struct { 29struct adc_struct {
29 long timeout; 30 long timeout;
@@ -39,6 +40,9 @@ static unsigned short _adc_read(struct adc_struct *adc)
39 if (adc->timeout < current_tick) { 40 if (adc->timeout < current_tick) {
40 unsigned char data[2]; 41 unsigned char data[2];
41 unsigned short value; 42 unsigned short value;
43
44 i2c_lock();
45
42 /* 5x per 2 seconds */ 46 /* 5x per 2 seconds */
43 adc->timeout = current_tick + (HZ * 2 / 5); 47 adc->timeout = current_tick + (HZ * 2 / 5);
44 48
@@ -53,6 +57,8 @@ static unsigned short _adc_read(struct adc_struct *adc)
53 adc->conversion(&value); 57 adc->conversion(&value);
54 } 58 }
55 adc->data = value; 59 adc->data = value;
60
61 i2c_unlock();
56 return value; 62 return value;
57 } else 63 } else
58 { 64 {