Struct xiao_m0::pins::Pins

source ·
pub struct Pins {
Show 16 fields pub a0: Pin<PA02, Reset>, pub a1: Pin<PA04, Reset>, pub a2: Pin<PA10, Reset>, pub a3: Pin<PA11, Reset>, pub a4: Pin<PA08, Reset>, pub a5: Pin<PA09, Reset>, pub a6: Pin<PB08, Reset>, pub a7: Pin<PB09, Reset>, pub a8: Pin<PA07, Reset>, pub a9: Pin<PA05, Reset>, pub a10: Pin<PA06, Reset>, pub led0: Pin<PA17, Reset>, pub led1: Pin<PA18, Reset>, pub led2: Pin<PA19, Reset>, pub usb_dm: Pin<PA24, Reset>, pub usb_dp: Pin<PA25, Reset>, /* private fields */
}
Expand description

BSP replacement for the HAL Pins type

This type is intended to provide more meaningful names for the given pins.

Fields§

§a0: Pin<PA02, Reset>

Pin A0/D0/DAC

§a1: Pin<PA04, Reset>

Pin A1/D1

§a2: Pin<PA10, Reset>

Pin A2/D2

§a3: Pin<PA11, Reset>

Pin A3/D3

§a4: Pin<PA08, Reset>

Pin A4/D4/SDA This field can also be accessed using the [pin_alias!] macro with the following alternate names:

sda, a4_sercom0_pad0,

§a5: Pin<PA09, Reset>

Pin A5/D5/SCL This field can also be accessed using the [pin_alias!] macro with the following alternate names:

scl, a5_sercom0_pad1,

§a6: Pin<PB08, Reset>

Pin A6/D6/TX This field can also be accessed using the [pin_alias!] macro with the following alternate names:

uart_tx,

§a7: Pin<PB09, Reset>

Pin A7/D7/RX This field can also be accessed using the [pin_alias!] macro with the following alternate names:

uart_rx,

§a8: Pin<PA07, Reset>

Pin A8/D8/SCK This field can also be accessed using the [pin_alias!] macro with the following alternate names:

sclk,

§a9: Pin<PA05, Reset>

Pin A9/D9/MISO This field can also be accessed using the [pin_alias!] macro with the following alternate names:

miso,

§a10: Pin<PA06, Reset>

Pin A10/D10/MOSI This field can also be accessed using the [pin_alias!] macro with the following alternate names:

mosi,

§led0: Pin<PA17, Reset>

On-board yellow ‘L’ LED This field can also be accessed using the [pin_alias!] macro with the following alternate names:

led0,

§led1: Pin<PA18, Reset>

On-board blue ‘RX’ LED This field can also be accessed using the [pin_alias!] macro with the following alternate names:

led1,

§led2: Pin<PA19, Reset>

On-board blue ‘TX’ LED This field can also be accessed using the [pin_alias!] macro with the following alternate names:

led2,

§usb_dm: Pin<PA24, Reset>

The USB D- pad This field can also be accessed using the [pin_alias!] macro with the following alternate names:

usb_dm,

§usb_dp: Pin<PA25, Reset>

The USB D+ pad This field can also be accessed using the [pin_alias!] macro with the following alternate names:

usb_dp,

Implementations§

source§

impl Pins

source

pub fn new(port: PORT) -> Self

Take ownership of the PAC [PORT] and split it into discrete [Pin]s.

This struct serves as a replacement for the HAL Pins struct. It is intended to provide more meaningful names for each [Pin] in a BSP. Any [Pin] not defined by the BSP is dropped.

PORT Pin Pins

source

pub unsafe fn port(&mut self) -> PORT

Take the PAC [PORT]

The [PORT] can only be taken once. Subsequent calls to this function will panic.

Safety

Direct access to the [PORT] could allow you to invalidate the compiler’s type-level tracking, so it is unsafe.

PORT

Auto Trait Implementations§

§

impl RefUnwindSafe for Pins

§

impl Send for Pins

§

impl !Sync for Pins

§

impl Unpin for Pins

§

impl UnwindSafe for Pins

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> Same<T> for T

§

type Output = T

Should always be Self
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.