Skip to content

Commit 4d4187d

Browse files
committed
Force inlining to fix delays
1 parent 7925367 commit 4d4187d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
/// Internal function to implement a variable busy-wait loop.
2525
/// # Arguments
2626
/// * 'count' - an i32, the number of times to cycle the loop.
27+
#[inline(always)]
2728
pub fn delay(count: u32) {
2829
// Our asm busy-wait takes a 16 bit word as an argument,
2930
// so the max number of loops is 2^16
@@ -49,6 +50,7 @@ pub fn delay(count: u32) {
4950
///delay for N miliseconds
5051
/// # Arguments
5152
/// * 'ms' - an u32, number of milliseconds to busy-wait
53+
#[inline(always)]
5254
pub fn delay_ms(ms: u32) {
5355
// microseconds
5456
let us = ms * 1000;
@@ -58,6 +60,7 @@ pub fn delay_ms(ms: u32) {
5860
///delay for N microseconds
5961
/// # Arguments
6062
/// * 'ms' - an u32, number of microseconds to busy-wait
63+
#[inline(always)]
6164
pub fn delay_us(us: u32) {
6265
// picoseconds
6366
let ps = us * 1000;

0 commit comments

Comments
 (0)