pub fn receive_echo(cx: app::receive_echo::Context) {
    let start_time = cx.local.start_time;
    if cx.local.echo.check_interrupt() {
        cx.local.echo.clear_interrupt_pending_bit();

        let pin = cx.local.echo;
        let tim = cx.local.duration_timer;
        let output = cx.shared.range;

        *start_time = if pin.is_high().unwrap() {
            Some(tim.now())
        } else {
            if let Some(get_time) = *start_time {
                let Hertz(freq) = tim.frequency();
                let pulse_time_ms = 1000.0 * get_time.elapsed() as f32 / freq as f32;
                *output = measured_range(pulse_time_ms);
            }
            None
        };
    }
}
// Measures pulse-width on an input EXTI pin to the ms.  Pretty handy little task.
// also outputs this as a measured distance using the measured_range function.
Measures pulse-width on an input EXTI pin to the ms.  Pretty handy little task.
also outputs this as a measured distance using the measured_range function.
Measures pulse - width on an input EXTI pin to the ms . Pretty handy little task . also outputs this as a measured distance using the measured_range function .
pub fn receive_echo(cx: app::receive_echo::Context) {
    let start_time = cx.local.start_time;
    if cx.local.echo.check_interrupt() {
        cx.local.echo.clear_interrupt_pending_bit();
        let pin = cx.local.echo;
        let tim = cx.local.duration_timer;
        let output = cx.shared.range;
        *start_time = if pin.is_high().unwrap() {
            Some(tim.now())
        } else {
            if let Some(get_time) = *start_time {
                let Hertz(freq) = tim.frequency();
                let pulse_time_ms = 1000.0 * get_time.elapsed() as f32 / freq as f32;
                *output = measured_range(pulse_time_ms);
            }
            None
        };
    }
}
pub fn receive_echo ( cx : app :: receive_echo :: Context ) { let start_time = cx . local . start_time ; if cx . local . echo . check_interrupt ( ) { cx . local . echo . clear_interrupt_pending_bit ( ) ; let pin = cx . local . echo ; let tim = cx . local . duration_timer ; let output = cx . shared . range ; * start_time = if pin . is_high ( ) . unwrap ( ) { Some ( tim . now ( ) ) } else { if let Some ( get_time ) = * start_time { let Hertz ( freq ) = tim . frequency ( ) ; let pulse_time_ms = 1000.0 * get_time . elapsed ( ) as f32 / freq as f32 ; * output = measured_range ( pulse_time_ms ) ; } None } ; } }
Measures pulse-width on an input EXTI pin to the ms.
Measures pulse - width on an input EXTI pin to the ms .
cx
app::receive_echo::Context
cx
app::receive_echo::Context