Struct stm32wlxx_hal::gpio::PortC
source · pub struct PortC {
pub c0: C0,
pub c1: C1,
pub c2: C2,
pub c3: C3,
pub c4: C4,
pub c5: C5,
pub c6: C6,
pub c13: C13,
pub c14: C14,
pub c15: C15,
}
Expand description
Port C GPIOs
Fields§
§c0: C0
§c1: C1
§c2: C2
§c3: C3
§c4: C4
§c5: C5
§c6: C6
§c13: C13
§c14: C14
§c15: C15
Implementations§
source§impl PortC
impl PortC
sourcepub fn split(gpioc: GPIOC, rcc: &mut RCC) -> Self
pub fn split(gpioc: GPIOC, rcc: &mut RCC) -> Self
Reset GPIO port C and split the port into individual pins.
This will enable clocks and reset the GPIO port.
Example
Get GPIO C0.
use stm32wlxx_hal::{
gpio::{pins, PortC},
pac,
};
let mut dp: pac::Peripherals = pac::Peripherals::take().unwrap();
let gpioc: PortC = PortC::split(dp.GPIOC, &mut dp.RCC);
let c0: pins::C0 = gpioc.c0;
sourcepub unsafe fn steal() -> Self
pub unsafe fn steal() -> Self
Steal the port C 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::PortC;
// ... setup happens here
let gpioa: PortC = unsafe { PortC::steal() };
sourcepub unsafe fn disable_clock(rcc: &mut RCC)
pub unsafe fn disable_clock(rcc: &mut RCC)
Disable the GPIOC clock.
Safety
- You cannot use any port-C GPIO pin while the clock is disabled.
- You are responsible for re-enabling the clock before resuming use of any port C GPIO.
sourcepub fn enable_clock(rcc: &mut RCC)
pub fn enable_clock(rcc: &mut RCC)
Enable the GPIOC 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 PortC
impl Send for PortC
impl Sync for PortC
impl Unpin for PortC
impl UnwindSafe for PortC
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