From 32449f8d93de86bc840b6e931b4fc2bc480c51e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Buga?= Date: Fri, 11 Oct 2024 18:46:38 +0200 Subject: [PATCH] Trim things a bit --- esp-hal/src/gpio/interconnect.rs | 30 +++++++++++++++++++----------- esp-hal/src/gpio/placeholder.rs | 8 -------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/esp-hal/src/gpio/interconnect.rs b/esp-hal/src/gpio/interconnect.rs index aa58fd560ab..82acd7b7a43 100644 --- a/esp-hal/src/gpio/interconnect.rs +++ b/esp-hal/src/gpio/interconnect.rs @@ -435,27 +435,38 @@ impl OutputConnection { #[doc(hidden)] to match &self.0 { OutputConnectionInner::Output(pin) => pin, - OutputConnectionInner::Dummy(pin) => pin, + OutputConnectionInner::Dummy(_) => Level::Low, } { pub fn pull_direction(&self, pull: Pull, _internal: private::Internal); pub fn init_input(&self, pull: Pull, _internal: private::Internal); pub fn is_input_high(&self, _internal: private::Internal) -> bool; pub fn input_signals(&self, _internal: private::Internal) -> [Option; 6]; - - pub fn is_set_high(&self, _internal: private::Internal) -> bool; - pub fn output_signals(&self, _internal: private::Internal) -> [Option; 6]; } - #[doc(hidden)] to match &mut self.0 { OutputConnectionInner::Output(pin) => pin, - OutputConnectionInner::Dummy(pin) => pin, + OutputConnectionInner::Dummy(_) => Level::Low, } { pub fn enable_input(&mut self, on: bool, _internal: private::Internal); pub fn enable_input_in_sleep_mode(&mut self, on: bool, _internal: private::Internal); pub fn connect_input_to_peripheral(&mut self, signal: crate::gpio::InputSignal, _internal: private::Internal); pub fn disconnect_input_from_peripheral(&mut self, signal: crate::gpio::InputSignal, _internal: private::Internal); + } + #[doc(hidden)] + to match &self.0 { + OutputConnectionInner::Output(pin) => pin, + OutputConnectionInner::Dummy(pin) => pin, + } { + pub fn is_set_high(&self, _internal: private::Internal) -> bool; + pub fn output_signals(&self, _internal: private::Internal) -> [Option; 6]; + } + + #[doc(hidden)] + to match &mut self.0 { + OutputConnectionInner::Output(pin) => pin, + OutputConnectionInner::Dummy(pin) => pin, + } { pub fn set_to_open_drain_output(&mut self, _internal: private::Internal); pub fn set_to_push_pull_output(&mut self, _internal: private::Internal); pub fn enable_output(&mut self, on: bool, _internal: private::Internal); @@ -475,7 +486,6 @@ impl OutputConnection { enum InputConnectionInner { Input(InputSignal), Constant(Level), - Dummy(NoPin), } /// A type-erased input signal, intended for internal use. @@ -508,8 +518,8 @@ impl From for InputConnection { } impl From for InputConnection { - fn from(pin: NoPin) -> Self { - Self(InputConnectionInner::Dummy(pin)) + fn from(_pin: NoPin) -> Self { + Self(InputConnectionInner::Constant(Level::Low)) } } @@ -534,7 +544,6 @@ impl InputConnection { to match &self.0 { InputConnectionInner::Input(pin) => pin, InputConnectionInner::Constant(level) => level, - InputConnectionInner::Dummy(pin) => pin, } { pub fn pull_direction(&self, pull: Pull, _internal: private::Internal); pub fn init_input(&self, pull: Pull, _internal: private::Internal); @@ -546,7 +555,6 @@ impl InputConnection { to match &mut self.0 { InputConnectionInner::Input(pin) => pin, InputConnectionInner::Constant(level) => level, - InputConnectionInner::Dummy(pin) => pin, } { pub fn enable_input(&mut self, on: bool, _internal: private::Internal); pub fn enable_input_in_sleep_mode(&mut self, on: bool, _internal: private::Internal); diff --git a/esp-hal/src/gpio/placeholder.rs b/esp-hal/src/gpio/placeholder.rs index 1cf226c8413..4a4b948bec4 100644 --- a/esp-hal/src/gpio/placeholder.rs +++ b/esp-hal/src/gpio/placeholder.rs @@ -114,14 +114,6 @@ impl NoPin { delegate::delegate! { to Level::Low { - pub(crate) fn init_input(&self, _pull: Pull, _internal: private::Internal); - pub(crate) fn enable_input(&mut self, _on: bool, _internal: private::Internal); - pub(crate) fn enable_input_in_sleep_mode(&mut self, _on: bool, _internal: private::Internal); - pub(crate) fn is_input_high(&self, _internal: private::Internal) -> bool; - pub(crate) fn connect_input_to_peripheral(&mut self, _signal: InputSignal, _internal: private::Internal); - pub(crate) fn disconnect_input_from_peripheral(&mut self, _signal: InputSignal, _internal: private::Internal); - pub(crate) fn input_signals(&self, _internal: private::Internal) -> [Option; 6]; - pub(crate) fn set_to_open_drain_output(&mut self, _internal: private::Internal); pub(crate) fn set_to_push_pull_output(&mut self, _internal: private::Internal); pub(crate) fn enable_output(&mut self, _on: bool, _internal: private::Internal);