Struct metro_m0::pins::Pins

source ·
pub struct Pins {
Show 32 fields pub a0: Pin<PA02, Reset>, pub a1: Pin<PB08, Reset>, pub a2: Pin<PB09, Reset>, pub a3: Pin<PA04, Reset>, pub a4: Pin<PA05, Reset>, pub a5: Pin<PB02, Reset>, pub d0: Pin<PA11, Reset>, pub d1: Pin<PA10, Reset>, pub d2: Pin<PA14, Reset>, pub d3: Pin<PA09, Reset>, pub d4: Pin<PA08, Reset>, pub d5: Pin<PA15, Reset>, pub d6: Pin<PA20, Reset>, pub d7: Pin<PA21, Reset>, pub d8: Pin<PA06, Reset>, pub d9: Pin<PA07, Reset>, pub d10: Pin<PA18, Reset>, pub d11: Pin<PA16, Reset>, pub d12: Pin<PA19, Reset>, pub d13: Pin<PA17, Reset>, pub sda: Pin<PA22, Reset>, pub scl: Pin<PA23, Reset>, pub neopixel: Pin<PA30, Reset>, pub sck: Pin<PB11, Reset>, pub mosi: Pin<PB10, Reset>, pub miso: Pin<PA12, Reset>, pub flash_sck: Pin<PB23, Reset>, pub flash_mosi: Pin<PB22, Reset>, pub flash_miso: Pin<PB03, Reset>, pub flash_cs: Pin<PA13, 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>

Analog pin 0. Can act as a true analog output as it has a DAC (which is not currently supported by this hal) as well as input.

§a1: Pin<PB08, Reset>

Analog Pin 1

§a2: Pin<PB09, Reset>

Analog Pin 2

§a3: Pin<PA04, Reset>

Analog Pin 3

§a4: Pin<PA05, Reset>

Analog Pin 4

§a5: Pin<PB02, Reset>

Analog Pin 5

§d0: Pin<PA11, Reset>

Pin 0, UART RX. Also analog input (A6) This field can also be accessed using the [pin_alias!] macro with the following alternate names:

uart_rx,

§d1: Pin<PA10, Reset>

Pin 1, UART TX. Also analog input (A7) This field can also be accessed using the [pin_alias!] macro with the following alternate names:

uart_tx,

§d2: Pin<PA14, Reset>

Pin 2

§d3: Pin<PA09, Reset>

Pin 3, PWM capable

§d4: Pin<PA08, Reset>

Pin 4, PWM capable. Also analog input (A8)

§d5: Pin<PA15, Reset>

Pin 5, PWM capable. Also analog input (A9)

§d6: Pin<PA20, Reset>

Pin 6, PWM capable

§d7: Pin<PA21, Reset>

Pin 7

§d8: Pin<PA06, Reset>

Pin 8, PWM capable. Also analog input (A10)

§d9: Pin<PA07, Reset>

Pin 9, PWM capable. Also analog input (A11)

§d10: Pin<PA18, Reset>

Pin 10, PWM capable

§d11: Pin<PA16, Reset>

Pin 11, PWM capable

§d12: Pin<PA19, Reset>

Pin 12, PWM capable

§d13: Pin<PA17, Reset>

Digital pin number 13, which is also attached to the red LED. PWM capable. This field can also be accessed using the [pin_alias!] macro with the following alternate names:

red_led,

§sda: Pin<PA22, Reset>

The I2C data line This field can also be accessed using the [pin_alias!] macro with the following alternate names:

sda,

§scl: Pin<PA23, Reset>

The I2C clock line This field can also be accessed using the [pin_alias!] macro with the following alternate names:

scl,

§neopixel: Pin<PA30, Reset>

The data line attached to the neopixel. Is also attached to SWCLK.

§sck: Pin<PB11, Reset>

The SPI SCK attached the to 2x3 header This field can also be accessed using the [pin_alias!] macro with the following alternate names:

sclk,

§mosi: Pin<PB10, Reset>

The SPI MOSI attached the to 2x3 header This field can also be accessed using the [pin_alias!] macro with the following alternate names:

mosi,

§miso: Pin<PA12, Reset>

The SPI MISO attached the to 2x3 header This field can also be accessed using the [pin_alias!] macro with the following alternate names:

miso,

§flash_sck: Pin<PB23, Reset>

The SCK pin attached to the on-board SPI flash This field can also be accessed using the [pin_alias!] macro with the following alternate names:

flash_sclk,

§flash_mosi: Pin<PB22, Reset>

The MOSI pin attached to the on-board SPI flash This field can also be accessed using the [pin_alias!] macro with the following alternate names:

flash_mosi,

§flash_miso: Pin<PB03, Reset>

The MISO pin attached to the on-board SPI flash This field can also be accessed using the [pin_alias!] macro with the following alternate names:

flash_miso,

§flash_cs: Pin<PA13, Reset>

The CS pin attached to the on-board SPI flash This field can also be accessed using the [pin_alias!] macro with the following alternate names:

flash_cs,

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