squash! Impl ToggleableOutputPin for embassy-rp Output

Use value_xor as suggested in pull request feedback.
This commit is contained in:
Daniel Bevenius 2022-05-19 06:07:14 +02:00
parent da97944322
commit 99c2defa76

View File

@ -135,10 +135,9 @@ impl<'d, T: Pin> Output<'d, T> {
/// Toggle pin output /// Toggle pin output
#[inline] #[inline]
pub fn toggle(&mut self) { pub fn toggle(&mut self) {
if self.is_set_low() { let val = 1 << self.pin.pin();
self.set_high() unsafe {
} else { self.pin.sio_out().value_xor().write_value(val);
self.set_low()
} }
} }
} }