diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/gpio.rs | 12 |
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 | ||
| 819 | impl<'d> Input<'d> { | 819 | impl<'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 | ||
