From e1359519abe1b47f3c4c0879175cd050648a119b Mon Sep 17 00:00:00 2001 From: Andreas Urke Date: Tue, 9 Aug 2016 00:25:37 +0200 Subject: [PATCH] Fix i2c multiple write bug, as reported by Ron Segal: https://sourceforge.net/p/contiki/mailman/message/34633862/ --- platform/srf06-cc26xx/sensortag/board-i2c.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/platform/srf06-cc26xx/sensortag/board-i2c.c b/platform/srf06-cc26xx/sensortag/board-i2c.c index cf74e2a93..ba9eddddd 100644 --- a/platform/srf06-cc26xx/sensortag/board-i2c.c +++ b/platform/srf06-cc26xx/sensortag/board-i2c.c @@ -256,12 +256,11 @@ board_i2c_write_read(uint8_t *wdata, uint8_t wlen, uint8_t *rdata, uint8_t rlen) for(i = 1; i < wlen && success; i++) { /* Write next byte */ ti_lib_i2c_master_data_put(I2C0_BASE, wdata[i]); - if(i < wlen - 1) { - /* Clear START */ - ti_lib_i2c_master_control(I2C0_BASE, I2C_MASTER_CMD_BURST_SEND_CONT); - while(ti_lib_i2c_master_busy(I2C0_BASE)); - success = i2c_status(); - } + + /* Clear START */ + ti_lib_i2c_master_control(I2C0_BASE, I2C_MASTER_CMD_BURST_SEND_CONT); + while(ti_lib_i2c_master_busy(I2C0_BASE)); + success = i2c_status(); } if(!success) { return false;