Skip to content

Commit 7db8f70

Browse files
committed
change return type of micros() and millis()
Fixes: espressif#384
1 parent 21ff3d0 commit 7db8f70

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

cores/esp32/esp32-hal-misc.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ void yield()
3030

3131
portMUX_TYPE microsMux = portMUX_INITIALIZER_UNLOCKED;
3232

33-
uint32_t IRAM_ATTR micros()
33+
unsigned long IRAM_ATTR micros()
3434
{
35-
static uint32_t lccount = 0;
36-
static uint32_t overflow = 0;
37-
uint32_t ccount;
35+
static unsigned long lccount = 0;
36+
static unsigned long overflow = 0;
37+
unsigned long ccount;
3838
portENTER_CRITICAL_ISR(&microsMux);
3939
__asm__ __volatile__ ( "rsr %0, ccount" : "=a" (ccount) );
4040
if(ccount < lccount){
@@ -45,7 +45,7 @@ uint32_t IRAM_ATTR micros()
4545
return overflow + (ccount / CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ);
4646
}
4747

48-
uint32_t IRAM_ATTR millis()
48+
unsigned long IRAM_ATTR millis()
4949
{
5050
return xTaskGetTickCount() * portTICK_PERIOD_MS;
5151
}

cores/esp32/esp32-hal.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ void yield(void);
6161
#include "esp32-hal-bt.h"
6262
#include "esp_system.h"
6363

64-
uint32_t micros();
65-
uint32_t millis();
64+
unsigned long micros();
65+
unsigned long millis();
6666
void delay(uint32_t);
6767
void delayMicroseconds(uint32_t us);
6868

0 commit comments

Comments
 (0)