avr-rust / delay

arduino-like delay routines based on busy-wait loops
Apache License 2.0
15 stars 11 forks source link

Update lib.rs - wrong units #12

Closed ghost closed 2 years ago

ghost commented 3 years ago

1/1000 of a microsecond (us) is nanosecond (ns), not picosecond (ps)

stappersg commented 2 years ago

Sorry for close, the "1/1000 of a microsecond (us) is nanosecond (ns), not picosecond (ps)" remark does deserve further attention.

stappersg commented 2 years ago

Now the open I intented earlier.

afbeelding

stappersg commented 2 years ago

Current version of delay_us():

///delay for N microseconds
/// # Arguments
/// * 'us' - an u64, number of microseconds to busy-wait
#[inline(always)]
pub fn delay_us(us: u64) {
    let us_in_loop = (avr_config::CPU_FREQUENCY_HZ / 1000000 / 4) as u64;
    let loops = us * us_in_loop;
    delay(loops);
}

So it is okay that this merge request is closed.