mirror of
https://github.com/italicsjenga/rp-hal-boards.git
synced 2025-01-23 01:36:35 +11:00
typo fix, rustfmt
This commit is contained in:
parent
2ef1343c05
commit
35464a1c4b
4 changed files with 18 additions and 10 deletions
|
@ -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 {
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<u32> }
|
||||
pub struct SioGpioBank0 {
|
||||
_private: PhantomData<u32>,
|
||||
}
|
||||
|
||||
/// 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,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue