Skip to content

Force inlining to fix delays #14

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

Merged
merged 1 commit into from
Jun 8, 2022
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
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
/// Internal function to implement a variable busy-wait loop.
/// # Arguments
/// * 'count' - an i32, the number of times to cycle the loop.
#[inline(always)]
pub fn delay(count: u32) {
// Our asm busy-wait takes a 16 bit word as an argument,
// so the max number of loops is 2^16
Expand All @@ -49,6 +50,7 @@ pub fn delay(count: u32) {
///delay for N miliseconds
/// # Arguments
/// * 'ms' - an u32, number of milliseconds to busy-wait
#[inline(always)]
pub fn delay_ms(ms: u32) {
// microseconds
let us = ms * 1000;
Expand All @@ -58,6 +60,7 @@ pub fn delay_ms(ms: u32) {
///delay for N microseconds
/// # Arguments
/// * 'ms' - an u32, number of microseconds to busy-wait
#[inline(always)]
pub fn delay_us(us: u32) {
// picoseconds
let ps = us * 1000;
Expand Down