diff --git a/esp-hal/MIGRATING-0.21.md b/esp-hal/MIGRATING-0.21.md index 197cbd541f..91326aa1de 100644 --- a/esp-hal/MIGRATING-0.21.md +++ b/esp-hal/MIGRATING-0.21.md @@ -192,3 +192,6 @@ The previous signal function have been replaced by `split`. This change affects -let output_signal = gpioN.into_peripheral_output(); +let (input_signal, output_signal) = gpioN.split(); ``` + +`into_peripheral_output`, `split` (for output pins only) and `peripheral_input` have been added to +the GPIO drivers (`Input`, `Output`, `OutputOpenDrain` and `Flex`) instead. diff --git a/esp-hal/src/gpio/mod.rs b/esp-hal/src/gpio/mod.rs index 19f6c56971..a731172935 100644 --- a/esp-hal/src/gpio/mod.rs +++ b/esp-hal/src/gpio/mod.rs @@ -1526,14 +1526,6 @@ where Self { pin } } - /// Split the pin into an input and output signal. - /// - /// Peripheral signals allow connecting peripherals together without using - /// external hardware. - pub fn split(self) -> (interconnect::InputSignal, interconnect::OutputSignal) { - self.pin.degrade_pin(private::Internal).split() - } - /// Returns a peripheral [input][interconnect::InputSignal] connected to /// this pin. /// @@ -1542,16 +1534,6 @@ where pub fn peripheral_input(&self) -> interconnect::InputSignal { self.pin.degrade_pin(private::Internal).split().0 } - - /// Turns the pin object into a peripheral - /// [output][interconnect::OutputSignal]. - /// - /// The output signal can be passed to peripherals in place of an output - /// pin. - #[inline] - pub fn into_peripheral_output(self) -> interconnect::OutputSignal { - self.split().1 - } } impl
Flex<'_, P> @@ -1701,17 +1683,30 @@ where pub fn set_drive_strength(&mut self, strength: DriveStrength) { self.pin.set_drive_strength(strength, private::Internal); } -} -impl
Flex<'_, P> -where - P: InputPin + OutputPin, -{ /// Set the GPIO to open-drain mode. pub fn set_as_open_drain(&mut self, pull: Pull) { self.pin.set_to_open_drain_output(private::Internal); self.pin.pull_direction(pull, private::Internal); } + + /// Split the pin into an input and output signal. + /// + /// Peripheral signals allow connecting peripherals together without using + /// external hardware. + pub fn split(self) -> (interconnect::InputSignal, interconnect::OutputSignal) { + self.pin.degrade_pin(private::Internal).split() + } + + /// Turns the pin object into a peripheral + /// [output][interconnect::OutputSignal]. + /// + /// The output signal can be passed to peripherals in place of an output + /// pin. + #[inline] + pub fn into_peripheral_output(self) -> interconnect::OutputSignal { + self.split().1 + } } pub(crate) mod internal {