From c001b2759e5fd7d7a77e921c757895819a281314 Mon Sep 17 00:00:00 2001 From: bunnie Date: Thu, 10 Oct 2024 02:03:11 +0800 Subject: [PATCH] add a method to clone an iox handle gpios for everyone! --- libs/cramium-hal/src/iox.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/cramium-hal/src/iox.rs b/libs/cramium-hal/src/iox.rs index 113714f27..964a59e96 100644 --- a/libs/cramium-hal/src/iox.rs +++ b/libs/cramium-hal/src/iox.rs @@ -108,6 +108,8 @@ pub struct Iox { impl Iox { pub fn new(base_address: *mut u32) -> Self { Iox { csr: SharedCsr::new(base_address) } } + pub fn clone(&self) -> Self { Iox { csr: SharedCsr::new(self.csr.base) } } + pub fn set_gpio_dir(&self, port: IoxPort, pin: u8, direction: IoxDir) { set_pin_in_bank!(self, iox::SFR_GPIOOE_CRGOE0, port, pin, direction) }