add a method to clone an iox handle

gpios for everyone!
This commit is contained in:
bunnie 2024-10-10 02:03:11 +08:00
parent 30fdc139e5
commit c001b2759e

View file

@ -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)
}