pub trait GpioBitbanging {
    // Required methods
    fn start<'a>(
        &self,
        pins: &[&dyn GpioPin],
        clock_tick: Duration,
        waveform: Box<[BitbangEntry<'a, 'a>]>
    ) -> Result<Box<dyn GpioBitbangOperation<'a, 'a> + 'a>>;
    fn dac_start(
        &self,
        pins: &[&dyn GpioPin],
        clock_tick: Duration,
        waveform: Box<[DacBangEntry<'_>]>
    ) -> Result<Box<dyn GpioDacBangOperation>>;

    // Provided methods
    fn run<'a>(
        &self,
        pins: &[&dyn GpioPin],
        clock_tick: Duration,
        waveform: Box<[BitbangEntry<'a, 'a>]>
    ) -> Result<Box<[BitbangEntry<'a, 'a>]>> { ... }
    fn dac_run(
        &self,
        pins: &[&dyn GpioPin],
        clock_tick: Duration,
        waveform: Box<[DacBangEntry<'_>]>
    ) -> Result<()> { ... }
}
Expand description

A trait implemented by transports which support synchronous bit-banging on GPIO pins, similar to FTDI devices. This trait allows generation of arbitrary waveforms on a set of pins, and optionally getting back samples from same or other pins, taken at precise times.

Required Methods§

source

fn start<'a>( &self, pins: &[&dyn GpioPin], clock_tick: Duration, waveform: Box<[BitbangEntry<'a, 'a>]> ) -> Result<Box<dyn GpioBitbangOperation<'a, 'a> + 'a>>

Apply the given sequence of values to the given set of GPIO pins, by each tick of a clock with the given period. This function does not change the mode of any pins, they must already be put into PushPull, OpenDrain or Input mode as appropriate. (In the latter case, the specified waveform data does not matter, as the pin is not driving, and would be included in the set of pins only in order to have it sampled at each clock tick.) Returns a GpioBitbangOperation which must be continuously polled, to know when the waveform is complete.

source

fn dac_start( &self, pins: &[&dyn GpioPin], clock_tick: Duration, waveform: Box<[DacBangEntry<'_>]> ) -> Result<Box<dyn GpioDacBangOperation>>

Apply given sequence of voltage values to the given set of pins assumed to already be in AnalogOutput mode.

Provided Methods§

source

fn run<'a>( &self, pins: &[&dyn GpioPin], clock_tick: Duration, waveform: Box<[BitbangEntry<'a, 'a>]> ) -> Result<Box<[BitbangEntry<'a, 'a>]>>

Convenience method which starts the bitbanging operation, and blocks until it is complete.

source

fn dac_run( &self, pins: &[&dyn GpioPin], clock_tick: Duration, waveform: Box<[DacBangEntry<'_>]> ) -> Result<()>

Convenience method which starts the DAC-banging operation, and blocks until it is complete.

Implementors§