Skip to content
New issue

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

By clicking “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? Sign in to your account

nimble/ll: Update ticks conversions for MCUs with idiv support #1820

Merged
merged 1 commit into from
Aug 5, 2024
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
8 changes: 8 additions & 0 deletions nimble/controller/include/controller/ble_ll_tmr.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,17 @@ ble_ll_tmr_u2t(uint32_t usecs)
return usecs / 32;
#endif
#if MYNEWT_VAL(OS_CPUTIME_FREQ) == 32768
#if __ARM_FEATURE_IDIV
if (usecs < 131072) {
return (usecs * 32768) / 1000000;
} else {
return ((uint64_t)usecs * 32768) / 1000000;
}
#else
if (usecs <= 31249) {
return (usecs * 137439) / 4194304;
}
#endif
#endif

return os_cputime_usecs_to_ticks(usecs);
Expand Down
Loading