From 7db8f709569e66598a786ddff70033c76507c14d Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Mon, 22 May 2017 15:47:12 +0300 Subject: [PATCH] change return type of micros() and millis() Fixes: https://github.com/espressif/arduino-esp32/issues/384 --- cores/esp32/esp32-hal-misc.c | 10 +++++----- cores/esp32/esp32-hal.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cores/esp32/esp32-hal-misc.c b/cores/esp32/esp32-hal-misc.c index d3a6b9626..ea943b370 100644 --- a/cores/esp32/esp32-hal-misc.c +++ b/cores/esp32/esp32-hal-misc.c @@ -30,11 +30,11 @@ void yield() portMUX_TYPE microsMux = portMUX_INITIALIZER_UNLOCKED; -uint32_t IRAM_ATTR micros() +unsigned long IRAM_ATTR micros() { - static uint32_t lccount = 0; - static uint32_t overflow = 0; - uint32_t ccount; + static unsigned long lccount = 0; + static unsigned long overflow = 0; + unsigned long ccount; portENTER_CRITICAL_ISR(µsMux); __asm__ __volatile__ ( "rsr %0, ccount" : "=a" (ccount) ); if(ccount < lccount){ @@ -45,7 +45,7 @@ uint32_t IRAM_ATTR micros() return overflow + (ccount / CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ); } -uint32_t IRAM_ATTR millis() +unsigned long IRAM_ATTR millis() { return xTaskGetTickCount() * portTICK_PERIOD_MS; } diff --git a/cores/esp32/esp32-hal.h b/cores/esp32/esp32-hal.h index 621f860f8..f6a514276 100644 --- a/cores/esp32/esp32-hal.h +++ b/cores/esp32/esp32-hal.h @@ -61,8 +61,8 @@ void yield(void); #include "esp32-hal-bt.h" #include "esp_system.h" -uint32_t micros(); -uint32_t millis(); +unsigned long micros(); +unsigned long millis(); void delay(uint32_t); void delayMicroseconds(uint32_t us); -- GitLab