Skip to content

Fix micros() for nano without breaking giga #62

New issue

Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “No Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? No Sign in to your account

Merged
merged 1 commit into from
Mar 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cores/arduino/zephyrCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,12 @@ void delay(unsigned long ms) { k_sleep(K_MSEC(ms)); }
void delayMicroseconds(unsigned int us) { k_sleep(K_USEC(us)); }

unsigned long micros(void) {
#ifdef CONFIG_TIMER_HAS_64BIT_CYCLE_COUNTER
return k_cyc_to_us_floor32(k_cycle_get_64());
}
#else
return k_cyc_to_us_floor32(k_cycle_get_32());
#endif
}

unsigned long millis(void) { return k_uptime_get_32(); }

Expand Down
Loading