Skip to content

Commit 60b6b2c

Browse files
committed
Merge pull request #287 from tkuyucu/master
Update with I2C fix
2 parents c3b233c + 35602c2 commit 60b6b2c

File tree

1 file changed

+5
-4
lines changed
  • libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_NRF51822

1 file changed

+5
-4
lines changed

libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_NRF51822/i2c_api.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,17 @@ int i2c_do_write(i2c_t *obj, int value) {
128128

129129
int i2c_do_read(i2c_t *obj, char * data, int last) {
130130
int timeOut = 100000;
131+
132+
if (last){
133+
obj->i2c->TASKS_STOP = 1;
134+
}
131135
while(!obj->i2c->EVENTS_RXDREADY){
132136
timeOut--;
133137
if(timeOut<0)
134138
return 1;
135139
}
136140
obj->i2c->EVENTS_RXDREADY = 0;
137-
138-
if (last){
139-
obj->i2c->TASKS_STOP = 1;
140-
}
141+
141142
*data = obj->i2c->RXD;
142143

143144
for(int i=0;i<320;i++){

0 commit comments

Comments
 (0)