Skip to content

Commit

Permalink
Trim things a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani committed Oct 11, 2024
1 parent bcd17c4 commit 32449f8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
30 changes: 19 additions & 11 deletions esp-hal/src/gpio/interconnect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<gpio::InputSignal>; 6];

pub fn is_set_high(&self, _internal: private::Internal) -> bool;
pub fn output_signals(&self, _internal: private::Internal) -> [Option<gpio::OutputSignal>; 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<gpio::OutputSignal>; 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);
Expand All @@ -475,7 +486,6 @@ impl OutputConnection {
enum InputConnectionInner {
Input(InputSignal),
Constant(Level),
Dummy(NoPin),
}

/// A type-erased input signal, intended for internal use.
Expand Down Expand Up @@ -508,8 +518,8 @@ impl From<Level> for InputConnection {
}

impl From<NoPin> for InputConnection {
fn from(pin: NoPin) -> Self {
Self(InputConnectionInner::Dummy(pin))
fn from(_pin: NoPin) -> Self {
Self(InputConnectionInner::Constant(Level::Low))
}
}

Expand All @@ -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);
Expand All @@ -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);
Expand Down
8 changes: 0 additions & 8 deletions esp-hal/src/gpio/placeholder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<InputSignal>; 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);
Expand Down

0 comments on commit 32449f8

Please sign in to comment.