Struct stm32wlxx_hal::gpio::PortA

source ·
pub struct PortA {
Show 16 fields pub a0: A0, pub a1: A1, pub a2: A2, pub a3: A3, pub a4: A4, pub a5: A5, pub a6: A6, pub a7: A7, pub a8: A8, pub a9: A9, pub a10: A10, pub a11: A11, pub a12: A12, pub a13: A13, pub a14: A14, pub a15: A15,
}
Expand description

Port A GPIOs

Fields§

§a0: A0§a1: A1§a2: A2§a3: A3§a4: A4§a5: A5§a6: A6§a7: A7§a8: A8§a9: A9§a10: A10§a11: A11§a12: A12§a13: A13§a14: A14§a15: A15

Implementations§

source§

impl PortA

source

pub fn split(gpioa: GPIOA, rcc: &mut RCC) -> Self

Reset GPIO port A and split the port into individual pins.

This will enable clocks and reset the GPIO port.

Example

Get GPIO A0.

use stm32wlxx_hal::{
    gpio::{pins, PortA},
    pac,
};

let mut dp: pac::Peripherals = pac::Peripherals::take().unwrap();

let gpioa: PortA = PortA::split(dp.GPIOA, &mut dp.RCC);
let a0: pins::A0 = gpioa.a0;
source

pub unsafe fn steal() -> Self

Steal the port A 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::PortA;

// ... setup happens here

let gpioa: PortA = unsafe { PortA::steal() };
source

pub unsafe fn disable_clock(rcc: &mut RCC)

Disable the GPIOA clock.

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

pub fn enable_clock(rcc: &mut RCC)

Enable the GPIOA 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 PortA

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for PortA

§

impl Send for PortA

§

impl Sync for PortA

§

impl Unpin for PortA

§

impl UnwindSafe for PortA

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.