Skip to content

Commit 3b80ff7

Browse files
authored
Merge pull request #14 from v1nsai/master
Force inlining to fix delays
2 parents cfe9848 + 4d4187d commit 3b80ff7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use core::arch::asm;
2626
/// Internal function to implement a variable busy-wait loop.
2727
/// # Arguments
2828
/// * 'count' - an i32, the number of times to cycle the loop.
29+
#[inline(always)]
2930
pub fn delay(count: u32) {
3031
// Our asm busy-wait takes a 16 bit word as an argument,
3132
// so the max number of loops is 2^16
@@ -52,6 +53,7 @@ pub fn delay(count: u32) {
5253
///delay for N miliseconds
5354
/// # Arguments
5455
/// * 'ms' - an u32, number of milliseconds to busy-wait
56+
#[inline(always)]
5557
pub fn delay_ms(ms: u32) {
5658
// microseconds
5759
let us = ms * 1000;
@@ -61,6 +63,7 @@ pub fn delay_ms(ms: u32) {
6163
///delay for N microseconds
6264
/// # Arguments
6365
/// * 'ms' - an u32, number of microseconds to busy-wait
66+
#[inline(always)]
6467
pub fn delay_us(us: u32) {
6568
// picoseconds
6669
let ps = us * 1000;

0 commit comments

Comments
 (0)