Skip to content

Commit

Permalink
Move micros, delayMicroseconds, millis to IRAM (esp8266#1326)
Browse files Browse the repository at this point in the history
  • Loading branch information
igrr committed Mar 13, 2016
1 parent 297bb17 commit 652703e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cores/esp8266/core_esp8266_wiring.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ void micros_overflow_tick(void* arg) {
micros_at_last_overflow_tick = m;
}

unsigned long millis() {
unsigned long ICACHE_RAM_ATTR millis() {
uint32_t m = system_get_time();
uint32_t c = micros_overflow_count + ((m < micros_at_last_overflow_tick) ? 1 : 0);
return c * 4294967 + m / 1000;
}

unsigned long micros() {
unsigned long ICACHE_RAM_ATTR micros() {
return system_get_time();
}

void delayMicroseconds(unsigned int us) {
void ICACHE_RAM_ATTR delayMicroseconds(unsigned int us) {
os_delay_us(us);
}

Expand Down

0 comments on commit 652703e

Please sign in to comment.