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

source

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

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

pub unsafe fn disable_clock(rcc: &mut RCC)

Disable the GPIOC clock.

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

pub fn enable_clock(rcc: &mut RCC)

Enable the GPIOC 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 PortC

source§

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

Formats the value using the given formatter. Read more

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> 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.