23
23
24
24
/// Internal function to implement a variable busy-wait loop.
25
25
/// # Arguments
26
- /// * 'count' - an i32 , the number of times to cycle the loop.
27
- pub fn delay ( count : u32 ) {
26
+ /// * 'count' - a u64 , the number of times to cycle the loop.
27
+ pub fn delay ( count : u64 ) {
28
28
// Our asm busy-wait takes a 16 bit word as an argument,
29
29
// so the max number of loops is 2^16
30
30
let outer_count = count / 65536 ;
@@ -48,19 +48,19 @@ pub fn delay(count: u32) {
48
48
49
49
///delay for N milliseconds
50
50
/// # Arguments
51
- /// * 'ms' - an u32 , number of milliseconds to busy-wait
52
- pub fn delay_ms ( ms : u32 ) {
51
+ /// * 'ms' - a u64 , number of milliseconds to busy-wait
52
+ pub fn delay_ms ( ms : u64 ) {
53
53
// microseconds
54
54
let us = ms * 1000 ;
55
55
delay_us ( us) ;
56
56
}
57
57
58
58
///delay for N microseconds
59
59
/// # Arguments
60
- /// * 'us' - an u32 , number of microseconds to busy-wait
61
- pub fn delay_us ( us : u32 ) {
62
- let us_lp = avr_config:: CPU_FREQUENCY_HZ / 1000000 / 4 ;
63
- let loops = ( us * us_lp ) as u32 ;
60
+ /// * 'us' - a u64 , number of microseconds to busy-wait
61
+ pub fn delay_us ( us : u64 ) {
62
+ let us_in_loop = ( avr_config:: CPU_FREQUENCY_HZ / 1000000 / 4 ) as u64 ;
63
+ let loops = us * us_in_loop ;
64
64
delay ( loops) ;
65
65
}
66
66
0 commit comments