From ed57ba77a01f56a792f25e05a3f9ac7e4cec4de0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 12 Dec 2025 11:36:17 +0100 Subject: [PATCH] improve GPIO module --- vorago-shared-hal/src/gpio/mod.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/vorago-shared-hal/src/gpio/mod.rs b/vorago-shared-hal/src/gpio/mod.rs index 498ea92..286b22b 100644 --- a/vorago-shared-hal/src/gpio/mod.rs +++ b/vorago-shared-hal/src/gpio/mod.rs @@ -36,6 +36,14 @@ impl Output { self.0.set_high(); } + #[inline] + pub fn set_state(&mut self, state: PinState) { + match state { + PinState::Low => self.set_low(), + PinState::High => self.set_high(), + } + } + #[inline] pub fn set_low(&mut self) { self.0.set_low(); @@ -268,6 +276,14 @@ impl Flex { } self.ll.set_high(); } + + #[inline] + pub fn set_state(&mut self, state: PinState) { + match state { + PinState::Low => self.set_low(), + PinState::High => self.set_high(), + } + } } impl embedded_hal::digital::ErrorType for Flex { -- 2.43.0