Skip to content

Commit

Permalink
Enhancement: Move set_bias to all input-like pins
Browse files Browse the repository at this point in the history
  • Loading branch information
KronsyC committed Sep 4, 2024
1 parent 7da5626 commit 17b1a24
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/gpio/pin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ macro_rules! impl_input {
pub fn is_high(&self) -> bool {
self.pin.read() == Level::High
}

/// Configures the built-in pull-up/pull-down resistors.
#[inline]
pub fn set_bias(&mut self, bias: Bias) {
self.pin.set_bias(bias);
self.bias = bias;
}
};
}

Expand Down Expand Up @@ -756,12 +763,6 @@ impl IoPin {
self.pin.set_mode(mode);
}

/// Configures the built-in pull-up/pull-down resistors.
#[inline]
pub fn set_bias(&mut self, bias: Bias) {
self.pin.set_bias(bias);
self.bias = bias;
}

impl_input!();
impl_output!();
Expand Down

0 comments on commit 17b1a24

Please sign in to comment.