Struct stm32wlxx_hal::gpio::PortB
source · pub struct PortB {}
Expand description
Port B GPIOs
Fields§
§b0: B0
§b1: B1
§b2: B2
§b3: B3
§b4: B4
§b5: B5
§b6: B6
§b7: B7
§b8: B8
§b9: B9
§b10: B10
§b11: B11
§b12: B12
§b13: B13
§b14: B14
§b15: B15
Implementations§
source§impl PortB
impl PortB
sourcepub fn split(gpiob: GPIOB, rcc: &mut RCC) -> Self
pub fn split(gpiob: GPIOB, rcc: &mut RCC) -> Self
Reset GPIO port B and split the port into individual pins.
This will enable clocks and reset the GPIO port.
Example
Get GPIO B0.
use stm32wlxx_hal::{
gpio::{pins, PortB},
pac,
};
let mut dp: pac::Peripherals = pac::Peripherals::take().unwrap();
let gpiob: PortB = PortB::split(dp.GPIOB, &mut dp.RCC);
let b0: pins::B0 = gpiob.b0;
sourcepub unsafe fn steal() -> Self
pub unsafe fn steal() -> Self
Steal the port B GPIOs from whatever is currently using them.
This will not initialize the GPIOs (unlike split
).
Safety
This will create new GPIOs, bypassing the singleton checks that normally occur. You are responsible for ensuring that the driver has exclusive access to the GPIOs. You are also responsible for ensuring the GPIO peripheral has been setup correctly.
Example
use stm32wlxx_hal::gpio::PortB;
// ... setup happens here
let gpioa: PortB = unsafe { PortB::steal() };
sourcepub unsafe fn disable_clock(rcc: &mut RCC)
pub unsafe fn disable_clock(rcc: &mut RCC)
Disable the GPIOB clock.
Safety
- You cannot use any port-B GPIO pin while the clock is disabled.
- You are responsible for re-enabling the clock before resuming use of any port B GPIO.
sourcepub fn enable_clock(rcc: &mut RCC)
pub fn enable_clock(rcc: &mut RCC)
Enable the GPIOB clock.
sourcepub fn set_sleep_clock(rcc: &mut RCC, enable: bool)
pub fn set_sleep_clock(rcc: &mut RCC, enable: bool)
Set the IO port clock enable during sleep mode.
false
: Clock disabled during Sleep and Stop modestrue
: Clock enabled during Sleep mode, disabled during Stop mode
sourcepub fn input_level() -> u16
pub fn input_level() -> u16
Get the input level of all pins on this port.
sourcepub fn output_level() -> u16
pub fn output_level() -> u16
Get the output level of all pins on this port.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for PortB
impl Send for PortB
impl Sync for PortB
impl Unpin for PortB
impl UnwindSafe for PortB
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more