change return type of micros() and millis()

Fixes: https://github.com/espressif/arduino-esp32/issues/384
This commit is contained in:
me-no-dev 2017-05-22 15:47:12 +03:00
parent 21ff3d0e32
commit 7db8f70956
2 changed files with 7 additions and 7 deletions

View File

@ -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(&microsMux);
__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;
}

View File

@ -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);