aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJames Munns <[email protected]>2025-11-29 16:07:30 +0100
committerGitHub <[email protected]>2025-11-29 16:07:30 +0100
commit3b239cb6de22b7bb8c2d87defb3205294653be7a (patch)
tree36690f9553c2e37007c6a61c40d919e3ad2c8c94 /src
parent87c4eaf3380505ca15ef7ed1d5dc435e9af2200e (diff)
Remove Drive/Slew settings for Input pin (#57)
* Don't set slew+strength for inputs * Update example
Diffstat (limited to 'src')
-rw-r--r--src/gpio.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gpio.rs b/src/gpio.rs
index 332c4c8b2..65f8df985 100644
--- a/src/gpio.rs
+++ b/src/gpio.rs
@@ -818,11 +818,10 @@ pub struct Input<'d> {
818 818
819impl<'d> Input<'d> { 819impl<'d> Input<'d> {
820 /// Create a GPIO input driver for a [GpioPin]. 820 /// Create a GPIO input driver for a [GpioPin].
821 pub fn new(pin: Peri<'d, impl GpioPin>, pull_select: Pull, strength: DriveStrength, slew_rate: SlewRate) -> Self { 821 ///
822 pub fn new(pin: Peri<'d, impl GpioPin>, pull_select: Pull) -> Self {
822 let mut flex = Flex::new(pin); 823 let mut flex = Flex::new(pin);
823 flex.set_as_input(); 824 flex.set_as_input();
824 flex.set_drive_strength(strength);
825 flex.set_slew_rate(slew_rate);
826 flex.set_pull(pull_select); 825 flex.set_pull(pull_select);
827 Self { flex } 826 Self { flex }
828 } 827 }
@@ -840,8 +839,13 @@ impl<'d> Input<'d> {
840 } 839 }
841 840
842 /// Expose the inner `Flex` if callers need to reconfigure the pin. 841 /// Expose the inner `Flex` if callers need to reconfigure the pin.
842 ///
843 /// Since Drive Strength and Slew Rate are not set when creating the Input
844 /// pin, they need to be set when converting
843 #[inline] 845 #[inline]
844 pub fn into_flex(self) -> Flex<'d> { 846 pub fn into_flex(mut self, strength: DriveStrength, slew_rate: SlewRate) -> Flex<'d> {
847 self.flex.set_drive_strength(strength);
848 self.flex.set_slew_rate(slew_rate);
845 self.flex 849 self.flex
846 } 850 }
847 851