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 2019/06/05 19:09:22 UTC

[GitHub] [mynewt-core] benmccrea commented on a change in pull request #1839: Fix/i2c scan

benmccrea commented on a change in pull request #1839: Fix/i2c scan
URL: https://github.com/apache/mynewt-core/pull/1839#discussion_r290891758
 
 

 ##########
 File path: hw/mcu/dialog/da1469x/src/hal_i2c.c
 ##########
 @@ -442,12 +442,13 @@ hal_i2c_master_read(uint8_t i2c_num, struct hal_i2c_master_data *pdata,
 int
 hal_i2c_master_probe(uint8_t i2c_num, uint8_t address, uint32_t timo)
 {
-    struct hal_i2c_master_data rx;
-    uint8_t buf;
+    struct hal_i2c_master_data tx;
+    uint8_t buf = 0;
 
-    rx.address = address;
-    rx.buffer = &buf;
-    rx.len = 1;
+    tx.address = address;
+    tx.buffer = &buf;
+    tx.len = 1;
 
-    return hal_i2c_master_read(i2c_num, &rx, timo, 1);
+    /* Reading before writing causes i2c bus to hang up sometimes. */
 
 Review comment:
   I think this comment should explain more clearly why hal_i2c_master_write() is used instead of a read. Something like,  'Using a write because a read results in ... <whatever the issue with read was>'

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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