From 8400351d5aa9e4378713f042a8170efafbd112ce Mon Sep 17 00:00:00 2001
From: Damien George <damien.p.george@gmail.com>
Date: Mon, 6 Feb 2017 15:10:03 +1100
Subject: [PATCH] stmhal: Use MICROPY_EVENT_POLL_HOOK instead of __WFI where
 appropriate.

---
 stmhal/mphalport.c | 2 +-
 stmhal/uart.c      | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/stmhal/mphalport.c b/stmhal/mphalport.c
index a9812362b..ca8e1c1bd 100644
--- a/stmhal/mphalport.c
+++ b/stmhal/mphalport.c
@@ -43,7 +43,7 @@ int mp_hal_stdin_rx_chr(void) {
         } else if (MP_STATE_PORT(pyb_stdio_uart) != NULL && uart_rx_any(MP_STATE_PORT(pyb_stdio_uart))) {
             return uart_rx_char(MP_STATE_PORT(pyb_stdio_uart));
         }
-        __WFI();
+        MICROPY_EVENT_POLL_HOOK
     }
 }
 
diff --git a/stmhal/uart.c b/stmhal/uart.c
index 81e6f69a5..d53ca5b80 100644
--- a/stmhal/uart.c
+++ b/stmhal/uart.c
@@ -334,7 +334,7 @@ STATIC bool uart_rx_wait(pyb_uart_obj_t *self, uint32_t timeout) {
         if (HAL_GetTick() - start >= timeout) {
             return false; // timeout
         }
-        __WFI();
+        MICROPY_EVENT_POLL_HOOK
     }
 }
 
@@ -375,7 +375,7 @@ STATIC bool uart_tx_wait(pyb_uart_obj_t *self, uint32_t timeout) {
         if (HAL_GetTick() - start >= timeout) {
             return false; // timeout
         }
-        __WFI();
+        MICROPY_EVENT_POLL_HOOK
     }
 }
 
-- 
GitLab