From 5699fc9d0e16b89b8052d29db9a3c5a349dab94a Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky <pfalcon@users.sourceforge.net>
Date: Thu, 29 Oct 2015 02:06:13 +0300
Subject: [PATCH] esp8266: Switch to standard mp_hal_delay_us() MPHAL function.

---
 esp8266/esp_mphal.c | 6 +++---
 esp8266/esp_mphal.h | 2 +-
 esp8266/main.c      | 2 +-
 esp8266/modpyb.c    | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/esp8266/esp_mphal.c b/esp8266/esp_mphal.c
index 736cf3b0a..5252e9ce8 100644
--- a/esp8266/esp_mphal.c
+++ b/esp8266/esp_mphal.c
@@ -46,7 +46,7 @@ void mp_hal_feed_watchdog(void) {
     //wdt_feed(); // might also work
 }
 
-void mp_hal_udelay(uint32_t us) {
+void mp_hal_delay_us(uint32_t us) {
     ets_delay_us(us);
 }
 
@@ -56,7 +56,7 @@ int mp_hal_stdin_rx_chr(void) {
         if (c != -1) {
             return c;
         }
-        mp_hal_udelay(1);
+        mp_hal_delay_us(1);
         mp_hal_feed_watchdog();
     }
 }
@@ -87,7 +87,7 @@ uint32_t HAL_GetTick(void) {
 }
 
 void HAL_Delay(uint32_t Delay) {
-    mp_hal_udelay(Delay * 1000);
+    mp_hal_delay_us(Delay * 1000);
 }
 
 void mp_hal_set_interrupt_char(int c) {
diff --git a/esp8266/esp_mphal.h b/esp8266/esp_mphal.h
index 617a0f8c1..3d64293fd 100644
--- a/esp8266/esp_mphal.h
+++ b/esp8266/esp_mphal.h
@@ -32,7 +32,6 @@ void ets_isr_mask(unsigned);
 
 void mp_hal_init(void);
 void mp_hal_feed_watchdog(void);
-void mp_hal_udelay(uint32_t);
 int mp_hal_stdin_rx_chr(void);
 void mp_hal_stdout_tx_str(const char *str);
 void mp_hal_stdout_tx_strn(const char *str, uint32_t len);
@@ -40,6 +39,7 @@ void mp_hal_stdout_tx_strn_cooked(const char *str, uint32_t len);
 
 uint32_t HAL_GetTick(void);
 void HAL_Delay(uint32_t Delay);
+void mp_hal_delay_us(uint32_t);
 void mp_hal_set_interrupt_char(int c);
 uint32_t mp_hal_get_cpu_freq(void);
 
diff --git a/esp8266/main.c b/esp8266/main.c
index 95315dae4..18fd2bd64 100644
--- a/esp8266/main.c
+++ b/esp8266/main.c
@@ -56,7 +56,7 @@ STATIC void mp_reset(void) {
 
 void soft_reset(void) {
     mp_hal_stdout_tx_str("PYB: soft reset\r\n");
-    mp_hal_udelay(10000); // allow UART to flush output
+    mp_hal_delay_us(10000); // allow UART to flush output
     mp_reset();
     pyexec_event_repl_init();
 }
diff --git a/esp8266/modpyb.c b/esp8266/modpyb.c
index aaa359a93..45096f8cb 100644
--- a/esp8266/modpyb.c
+++ b/esp8266/modpyb.c
@@ -137,7 +137,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_delay_obj, pyb_delay);
 STATIC mp_obj_t pyb_udelay(mp_obj_t usec_in) {
     mp_int_t usec = mp_obj_get_int(usec_in);
     if (usec >= 0) {
-        mp_hal_udelay(usec);
+        mp_hal_delay_us(usec);
     }
     return mp_const_none;
 }
-- 
GitLab