diff --git a/avr-hal-generic/src/port.rs b/avr-hal-generic/src/port.rs index 52a72bfa1c..f44dfd6904 100644 --- a/avr-hal-generic/src/port.rs +++ b/avr-hal-generic/src/port.rs @@ -107,8 +107,21 @@ impl Pin, PIN> { /// does it have the mode-relevant methods availailable (e.g. `set_high()` is only available for /// `Output` pins). impl Pin { - /// Convert this pin into an output pin. See [Digital Output](#digital-output). + /// Convert this pin into an output pin, setting the state to low. + /// See [Digital Output](#digital-output). pub fn into_output(mut self) -> Pin { + unsafe { self.pin.out_clear() }; + unsafe { self.pin.make_output() }; + Pin { + pin: self.pin, + _mode: PhantomData, + } + } + + /// Convert this pin into an output pin, setting the state to high. + /// See [Digital Output](#digital-output). + pub fn into_output_high(mut self) -> Pin { + unsafe { self.pin.out_set() }; unsafe { self.pin.make_output() }; Pin { pin: self.pin,