From 3c87bb588b38ebba6395a0d7b1c37727a7919fe2 Mon Sep 17 00:00:00 2001 From: Georges Palauqui Date: Mon, 6 Jan 2025 12:43:48 +0100 Subject: [PATCH] `embassy-rp`: add `set_pullup()` for `OutputOpenDrain` --- embassy-rp/src/gpio.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/embassy-rp/src/gpio.rs b/embassy-rp/src/gpio.rs index 2031928276..b3a53d1b98 100644 --- a/embassy-rp/src/gpio.rs +++ b/embassy-rp/src/gpio.rs @@ -450,6 +450,16 @@ impl<'d> OutputOpenDrain<'d> { Self { pin } } + /// Set the pin's pull-up. + #[inline] + pub fn set_pullup(&mut self, enable: bool) { + if enable { + self.pin.set_pull(Pull::Up); + } else { + self.pin.set_pull(Pull::None); + } + } + /// Set the pin's drive strength. #[inline] pub fn set_drive_strength(&mut self, strength: Drive) {