pub fn execute(&self, t0: Instant, pins: &mut DeviceInputs) -> Result<Execution> {
        let timeline = self.actions.iter()
            .map(|Reverse(op)| (t0 + Duration::from_millis(op.time), op));
        for (t, op) in timeline {
            while Instant::now() < t {  } // spin wait?

            if let Some(action) = op.action {
                match action {
                    Action::Idle(wait_length) => {
                        let t_until = t + wait_length;
                        while Instant::now() < t_until {  } // spin wait?
                    },

                    Action::Input(signal, pin_no) => match signal {
                        Signal::Digital(true) => (*pins.get_pin_mut(pin_no)?).set_high(),
                        Signal::Digital(false) => (*pins.get_pin_mut(pin_no)?).set_low(),
                        input => panic!("Unhandled input type: {:?}", input),
                    },
                };
            }
        }

        Ok(Execution::new(t0, Instant::now()))
    }
/// Drive test outputs (inputs to the device).
Drive test outputs (inputs to the device).
Drive test outputs ( inputs to the device ) .
pub fn execute(&self, t0: Instant, pins: &mut DeviceInputs) -> Result<Execution> {
        let timeline = self.actions.iter()
            .map(|Reverse(op)| (t0 + Duration::from_millis(op.time), op));
        for (t, op) in timeline {
            while Instant::now() < t {  } // spin wait?
            if let Some(action) = op.action {
                match action {
                    Action::Idle(wait_length) => {
                        let t_until = t + wait_length;
                        while Instant::now() < t_until {  } // spin wait?
                    },
                    Action::Input(signal, pin_no) => match signal {
                        Signal::Digital(true) => (*pins.get_pin_mut(pin_no)?).set_high(),
                        Signal::Digital(false) => (*pins.get_pin_mut(pin_no)?).set_low(),
                        input => panic!("Unhandled input type: {:?}", input),
                    },
                };
            }
        }
        Ok(Execution::new(t0, Instant::now()))
    }
pub fn execute ( & self , t0 : Instant , pins : & mut DeviceInputs ) -> Result < Execution > { let timeline = self . actions . iter ( ) . map ( | Reverse ( op ) | ( t0 + Duration :: from_millis ( op . time ) , op ) ) ; for ( t , op ) in timeline { while Instant :: now ( ) < t { } // spin wait? if let Some ( action ) = op . action { match action { Action :: Idle ( wait_length ) => { let t_until = t + wait_length ; while Instant :: now ( ) < t_until { } // spin wait? } , Action :: Input ( signal , pin_no ) => match signal { Signal :: Digital ( true ) => ( * pins . get_pin_mut ( pin_no ) ? ) . set_high ( ) , Signal :: Digital ( false ) => ( * pins . get_pin_mut ( pin_no ) ? ) . set_low ( ) , input => panic ! ( " " input ) , } , } ; } } Ok ( Execution :: new ( t0 , Instant :: now ( ) ) ) }
Drive test outputs (inputs to the device).
Drive test outputs ( inputs to the device ) .
&self
t0
Instant
pins
&mut DeviceInputs
&self
t0
Instant
pins
&mut DeviceInputs