提交 7db8f709 编写于 作者: M me-no-dev

change return type of micros() and millis()

Fixes: https://github.com/espressif/arduino-esp32/issues/384
上级 21ff3d0e
......@@ -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;
}
......
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册