pub fn write_multiple<PD, MUTEX, MODE: HasOutput, const N: usize>(
pins: [&mut Pin<'_, MODE, MUTEX>; N],
states: [bool; N],
) -> Result<(), PD::Error>where
PD: PortDriver,
MUTEX: PortMutex<Port = PD>,
Expand description
Set multiple pins at the same time.
The usual method of setting multiple pins
io0.set_high().unwrap();
io1.set_low().unwrap();
can be problematic because the time between the two operations might be significant (they are
done as two separate bus transactions). If it is desired that multiple pins change state in a
single bus transaction, the write_multiple()
function provides an interface to do this.
ยงExample
port_expander::write_multiple(
[&mut io0, &mut io1],
[true, false],
).unwrap();