Struct stm32wlxx_hal::gpio::PortA
source · pub struct PortA {}
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
impl PortA
sourcepub fn split(gpioa: GPIOA, rcc: &mut RCC) -> Self
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;
sourcepub unsafe fn steal() -> Self
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() };
sourcepub unsafe fn disable_clock(rcc: &mut RCC)
pub unsafe fn disable_clock(rcc: &mut RCC)
Disable the GPIOA clock.
Safety
- You cannot use any port-A GPIO pin while the clock is disabled.
- You are responsible for re-enabling the clock before resuming use of any port A GPIO.
sourcepub fn enable_clock(rcc: &mut RCC)
pub fn enable_clock(rcc: &mut RCC)
Enable the GPIOA 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 PortA
impl Send for PortA
impl Sync for PortA
impl Unpin for PortA
impl UnwindSafe for PortA
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