change return type of micros() and millis()
Fixes: https://github.com/espressif/arduino-esp32/issues/384
This commit is contained in:
parent
21ff3d0e32
commit
7db8f70956
@ -30,11 +30,11 @@ void yield()
|
|||||||
|
|
||||||
portMUX_TYPE microsMux = portMUX_INITIALIZER_UNLOCKED;
|
portMUX_TYPE microsMux = portMUX_INITIALIZER_UNLOCKED;
|
||||||
|
|
||||||
uint32_t IRAM_ATTR micros()
|
unsigned long IRAM_ATTR micros()
|
||||||
{
|
{
|
||||||
static uint32_t lccount = 0;
|
static unsigned long lccount = 0;
|
||||||
static uint32_t overflow = 0;
|
static unsigned long overflow = 0;
|
||||||
uint32_t ccount;
|
unsigned long ccount;
|
||||||
portENTER_CRITICAL_ISR(µsMux);
|
portENTER_CRITICAL_ISR(µsMux);
|
||||||
__asm__ __volatile__ ( "rsr %0, ccount" : "=a" (ccount) );
|
__asm__ __volatile__ ( "rsr %0, ccount" : "=a" (ccount) );
|
||||||
if(ccount < lccount){
|
if(ccount < lccount){
|
||||||
@ -45,7 +45,7 @@ uint32_t IRAM_ATTR micros()
|
|||||||
return overflow + (ccount / CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ);
|
return overflow + (ccount / CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t IRAM_ATTR millis()
|
unsigned long IRAM_ATTR millis()
|
||||||
{
|
{
|
||||||
return xTaskGetTickCount() * portTICK_PERIOD_MS;
|
return xTaskGetTickCount() * portTICK_PERIOD_MS;
|
||||||
}
|
}
|
||||||
|
@ -61,8 +61,8 @@ void yield(void);
|
|||||||
#include "esp32-hal-bt.h"
|
#include "esp32-hal-bt.h"
|
||||||
#include "esp_system.h"
|
#include "esp_system.h"
|
||||||
|
|
||||||
uint32_t micros();
|
unsigned long micros();
|
||||||
uint32_t millis();
|
unsigned long millis();
|
||||||
void delay(uint32_t);
|
void delay(uint32_t);
|
||||||
void delayMicroseconds(uint32_t us);
|
void delayMicroseconds(uint32_t us);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user