@@ -25,9 +25,9 @@ use core::arch::asm;
25
25
26
26
/// Internal function to implement a variable busy-wait loop.
27
27
/// # Arguments
28
- /// * 'count' - an i32 , the number of times to cycle the loop.
28
+ /// * 'count' - a u64 , the number of times to cycle the loop.
29
29
#[ inline( always) ]
30
- pub fn delay ( count : u32 ) {
30
+ pub fn delay ( count : u64 ) {
31
31
// Our asm busy-wait takes a 16 bit word as an argument,
32
32
// so the max number of loops is 2^16
33
33
let outer_count = count / 65536 ;
@@ -52,21 +52,21 @@ pub fn delay(count: u32) {
52
52
53
53
///delay for N milliseconds
54
54
/// # Arguments
55
- /// * 'ms' - an u32 , number of milliseconds to busy-wait
55
+ /// * 'ms' - an u64 , number of milliseconds to busy-wait
56
56
#[ inline( always) ]
57
- pub fn delay_ms ( ms : u32 ) {
57
+ pub fn delay_ms ( ms : u64 ) {
58
58
// microseconds
59
59
let us = ms * 1000 ;
60
60
delay_us ( us) ;
61
61
}
62
62
63
63
///delay for N microseconds
64
64
/// # Arguments
65
- /// * 'us' - an u32 , number of microseconds to busy-wait
65
+ /// * 'us' - an u64 , number of microseconds to busy-wait
66
66
#[ inline( always) ]
67
- pub fn delay_us ( us : u32 ) {
68
- let us_lp = avr_config:: CPU_FREQUENCY_HZ / 1000000 / 4 ;
69
- let loops = ( us * us_lp ) as u32 ;
67
+ pub fn delay_us ( us : u64 ) {
68
+ let us_in_loop = ( avr_config:: CPU_FREQUENCY_HZ / 1000000 / 4 ) as u64 ;
69
+ let loops = us * us_in_loop ;
70
70
delay ( loops) ;
71
71
}
72
72
0 commit comments