Struct Pins

Source
pub struct Pins<Tx, Rx, Cts, Rts> {
    pub tx: Tx,
    pub rx: Rx,
    pub cts: Cts,
    pub rts: Rts,
}
Expand description

Customizable Uart pinout, allowing you to set the pins individually.

The following pins are valid UART pins:

UARTTXRXCTSRTS
UART00, 12, 16, 281, 13, 17, 292, 14, 183, 15, 19
UART14, 8, 20, 245, 9, 21, 256, 10, 22, 267, 11, 23, 27

Every field can be set to OptionTNone to not configure them.

Note that you can also use tuples (RX, TX) or (RX, TX, CTS, RTS) instead of this type.

This struct can either be filled manually or with a builder pattern:

let pins = Pins::default()
    .tx(gpio_pins.gpio0.into_function())
    .rx(gpio_pins.gpio1.into_function());

fn assert_is_valid_uart0<T: ValidUartPinout<UART0>>(_: T) {}

assert_is_valid_uart0(pins);

Fields§

§tx: Tx§rx: Rx§cts: Cts§rts: Rts

Implementations§

Source§

impl<Tx, Rx, Cts, Rts> Pins<Tx, Rx, Cts, Rts>

Source

pub fn tx<NewTx>(self, tx: NewTx) -> Pins<OptionTSome<NewTx>, Rx, Cts, Rts>

Set the TX pin

Source

pub fn rx<NewRx>(self, rx: NewRx) -> Pins<Tx, OptionTSome<NewRx>, Cts, Rts>

Set the RX pin

Source

pub fn cts<NewCts>(self, cts: NewCts) -> Pins<Tx, Rx, OptionTSome<NewCts>, Rts>

Set the CTS pin

Source

pub fn rts<NewRts>(self, rts: NewRts) -> Pins<Tx, Rx, Cts, OptionTSome<NewRts>>

Set the RTS pin

Trait Implementations§

Source§

impl Default for Pins<OptionTNone, OptionTNone, OptionTNone, OptionTNone>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<Uart, Tx, Rx, Cts, Rts> ValidUartPinout<Uart> for Pins<Tx, Rx, Cts, Rts>
where Uart: UartDevice, Tx: ValidOptionTx<Uart>, Rx: ValidOptionRx<Uart>, Cts: ValidOptionCts<Uart>, Rts: ValidOptionRts<Uart>,

Source§

type Rx = Rx

Source§

type Tx = Tx

Source§

type Cts = Cts

Source§

type Rts = Rts

Auto Trait Implementations§

§

impl<Tx, Rx, Cts, Rts> Freeze for Pins<Tx, Rx, Cts, Rts>
where Tx: Freeze, Rx: Freeze, Cts: Freeze, Rts: Freeze,

§

impl<Tx, Rx, Cts, Rts> RefUnwindSafe for Pins<Tx, Rx, Cts, Rts>

§

impl<Tx, Rx, Cts, Rts> Send for Pins<Tx, Rx, Cts, Rts>
where Tx: Send, Rx: Send, Cts: Send, Rts: Send,

§

impl<Tx, Rx, Cts, Rts> Sync for Pins<Tx, Rx, Cts, Rts>
where Tx: Sync, Rx: Sync, Cts: Sync, Rts: Sync,

§

impl<Tx, Rx, Cts, Rts> Unpin for Pins<Tx, Rx, Cts, Rts>
where Tx: Unpin, Rx: Unpin, Cts: Unpin, Rts: Unpin,

§

impl<Tx, Rx, Cts, Rts> UnwindSafe for Pins<Tx, Rx, Cts, Rts>
where Tx: UnwindSafe, Rx: UnwindSafe, Cts: UnwindSafe, Rts: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Choices> CoproductSubsetter<CNil, HNil> for Choices

Source§

type Remainder = Choices

Source§

fn subset( self, ) -> Result<CNil, <Choices as CoproductSubsetter<CNil, HNil>>::Remainder>

Extract a subset of the possible types in a coproduct (or get the remaining possibilities) 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 T
where 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Is for T
where T: Sealed + Borrow<T> + BorrowMut<T>,

Source§

type Type = T

Source§

impl<T, U, I> LiftInto<U, I> for T
where U: LiftFrom<T, I>,

Source§

fn lift_into(self) -> U

Performs the indexed conversion.
Source§

impl<Source> Sculptor<HNil, HNil> for Source

Source§

type Remainder = Source

Source§

fn sculpt(self) -> (HNil, <Source as Sculptor<HNil, HNil>>::Remainder)

Consumes the current HList and returns an HList with the requested shape. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.