From 17b1a24ece0c901b33a1b1413a95e1ab74c4d7a4 Mon Sep 17 00:00:00 2001 From: Samir Bioud Date: Wed, 4 Sep 2024 23:09:39 +0100 Subject: [PATCH] Enhancement: Move `set_bias` to all input-like pins --- src/gpio/pin.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gpio/pin.rs b/src/gpio/pin.rs index 02ad782..eec832c 100644 --- a/src/gpio/pin.rs +++ b/src/gpio/pin.rs @@ -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; + } }; } @@ -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!();