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 2017/11/22 18:07:43 UTC

[GitHub] mkiiskila closed pull request #670: MYNEWT-865; flush RXD if needed before starting read operation.

mkiiskila closed pull request #670: MYNEWT-865; flush RXD if needed before starting read operation.
URL: https://github.com/apache/mynewt-core/pull/670
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/hw/mcu/nordic/nrf52xxx/src/hal_i2c.c b/hw/mcu/nordic/nrf52xxx/src/hal_i2c.c
index bd8781aa4..85b54e0c4 100644
--- a/hw/mcu/nordic/nrf52xxx/src/hal_i2c.c
+++ b/hw/mcu/nordic/nrf52xxx/src/hal_i2c.c
@@ -160,7 +160,7 @@ __ASM volatile (
  * This should reset state from (most of) the devices on the other end.
  */
 static void
-hal_i2c_clear_bus(struct nrf52_hal_i2c_cfg *cfg)
+hal_i2c_clear_bus(const struct nrf52_hal_i2c_cfg *cfg)
 {
     int i;
 
@@ -321,6 +321,13 @@ hal_i2c_master_read(uint8_t i2c_num, struct hal_i2c_master_data *pdata,
 
     start = os_time_get();
 
+    if (regs->EVENTS_RXDREADY) {
+        /*
+         * If previous read was interrupted, flush RXD.
+         */
+        (void)regs->RXD;
+        (void)regs->RXD;
+    }
     regs->EVENTS_ERROR = 0;
     regs->EVENTS_STOPPED = 0;
     regs->EVENTS_SUSPENDED = 0;


 

----------------------------------------------------------------
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