Struct stm32wlxx_hal::gpio::PortB

source ·
pub struct PortB {
Show 16 fields pub b0: B0, pub b1: B1, pub b2: B2, pub b3: B3, pub b4: B4, pub b5: B5, pub b6: B6, pub b7: B7, pub b8: B8, pub b9: B9, pub b10: B10, pub b11: B11, pub b12: B12, pub b13: B13, pub b14: B14, pub b15: B15,
}
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

source

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;
source

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() };
source

pub unsafe fn disable_clock(rcc: &mut RCC)

Disable the GPIOB clock.

Safety
  1. You cannot use any port-B GPIO pin while the clock is disabled.
  2. You are responsible for re-enabling the clock before resuming use of any port B GPIO.
source

pub fn enable_clock(rcc: &mut RCC)

Enable the GPIOB clock.

source

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 modes
  • true: Clock enabled during Sleep mode, disabled during Stop mode
source

pub fn input_level() -> u16

Get the input level of all pins on this port.

source

pub fn output_level() -> u16

Get the output level of all pins on this port.

Trait Implementations§

source§

impl Debug for PortB

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.