You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/12/14 17:20:01 UTC

[GitHub] vrahane commented on a change in pull request #1559: [Do Not Merge] - Change HAL I2C driver to use TWIM+EasyDMA

vrahane commented on a change in pull request #1559: [Do Not Merge] - Change HAL I2C driver to use TWIM+EasyDMA
URL: https://github.com/apache/mynewt-core/pull/1559#discussion_r241828984
 
 

 ##########
 File path: hw/bus/i2c/src/i2c.c
 ##########
 @@ -119,7 +120,10 @@ bus_i2c_read(struct bus_dev *bdev, struct bus_node *bnode, uint8_t *buf,
 
     last_op = !(flags & BUS_F_NOSTOP);
 
-    rc = hal_i2c_master_read(dev->cfg.i2c_num, &i2c_data, timeout, last_op);
+    //rc = hal_i2c_master_read(dev->cfg.i2c_num, &i2c_data, timeout, last_op);
+    rc = i2cn_master_read(dev->cfg.i2c_num, &i2c_data, timeout, last_op,
+                          MYNEWT_VAL(MS5840_I2C_RETRIES));
 
 Review comment:
   I agree, since bus driver is a driver, retries should happen at a higher layer which was i2cn to begin with. I wonder why all the drivers now use bus driver instead of going through i2cn ? Ok, I see since it is a generic bus driver, drivers could directly utilize the bus driver and not worry about which hal to call into SPI or I2C which sounds correct fundamentally but now the bus driver needs to have retries which should be part of the API. Something like 
   ```
   rc = i2cn_master_read(dev->cfg.i2c_num, &i2c_data, timeout, last_op,
                           MYNEWT_VAL(MS5840_I2C_RETRIES));
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services