Skip to content

Commit

Permalink
Merge pull request #157 from KronsyC/master
Browse files Browse the repository at this point in the history
Enhancement: Move `set_bias` to all input-like pins
  • Loading branch information
golemparts authored Sep 5, 2024
2 parents 7da5626 + 17b1a24 commit 3fdb2b8
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 3fdb2b8

Please sign in to comment.