diff --git a/rp2040-hal/examples/blinky.rs b/rp2040-hal/examples/blinky.rs index cf54150..e567df8 100644 --- a/rp2040-hal/examples/blinky.rs +++ b/rp2040-hal/examples/blinky.rs @@ -18,7 +18,9 @@ fn main() -> ! { let mut pac = rp2040_pac::Peripherals::take().unwrap(); let sio = Sio::new(pac.SIO); - let pins = pac.IO_BANK0.split(pac.PADS_BANK0, sio.gpio_bank0, &mut pac.RESETS); + let pins = pac + .IO_BANK0 + .split(pac.PADS_BANK0, sio.gpio_bank0, &mut pac.RESETS); let mut led_pin = pins.gpio25.into_output(); loop { diff --git a/rp2040-hal/examples/gpio_in_out.rs b/rp2040-hal/examples/gpio_in_out.rs index f405135..21947bf 100644 --- a/rp2040-hal/examples/gpio_in_out.rs +++ b/rp2040-hal/examples/gpio_in_out.rs @@ -20,7 +20,9 @@ fn main() -> ! { let mut pac = rp2040_pac::Peripherals::take().unwrap(); let sio = Sio::new(pac.SIO); - let pins = pac.IO_BANK0.split(pac.PADS_BANK0, sio.gpio_bank0, &mut pac.RESETS); + let pins = pac + .IO_BANK0 + .split(pac.PADS_BANK0, sio.gpio_bank0, &mut pac.RESETS); let mut led_pin = pins.gpio25.into_output(); let button_pin = pins.gpio15.into_input().pull_up(); diff --git a/rp2040-hal/src/lib.rs b/rp2040-hal/src/lib.rs index 500dc5a..9c0cb0d 100644 --- a/rp2040-hal/src/lib.rs +++ b/rp2040-hal/src/lib.rs @@ -21,6 +21,7 @@ pub mod prelude; pub mod pwm; pub mod rom_data; pub mod rtc; +pub mod sio; pub mod spi; pub mod ssi; pub mod timer; @@ -28,4 +29,3 @@ pub mod uart; pub mod usb; pub mod watchdog; pub mod xosc; -pub mod sio; diff --git a/rp2040-hal/src/sio.rs b/rp2040-hal/src/sio.rs index 37be161..111376b 100644 --- a/rp2040-hal/src/sio.rs +++ b/rp2040-hal/src/sio.rs @@ -1,4 +1,4 @@ -//! Single Cycle Input and Output (CIO) +//! Single Cycle Input and Output (SIO) //! //! To be able to partition parts of the SIO block to other modules: //! @@ -15,14 +15,16 @@ use super::*; use core::marker::PhantomData; /// Marker struct for ownership of SIO gpio bank0 -pub struct SioGpioBank0 { _private: PhantomData } +pub struct SioGpioBank0 { + _private: PhantomData, +} /// Struct containing ownership markers for managing ownership of the SIO registers. pub struct Sio { - _sio : pac::SIO, + _sio: pac::SIO, /// GPIO Bank 0 registers - pub gpio_bank0 : SioGpioBank0, + pub gpio_bank0: SioGpioBank0, // we can hand out other things here, for example: // gpio_qspi // divider @@ -31,11 +33,13 @@ pub struct Sio { } impl Sio { /// Create `Sio` from the PAC. - pub fn new(sio : pac::SIO) -> Self { + pub fn new(sio: pac::SIO) -> Self { Self { _sio: sio, - gpio_bank0: SioGpioBank0 { _private: PhantomData } + gpio_bank0: SioGpioBank0 { + _private: PhantomData, + }, } } -} \ No newline at end of file +}