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:
| UART | TX | RX | CTS (or TX in Aux mode) | RTS (or RX in Aux mode) |
|---|---|---|---|---|
| UART0 | 0, 12, 16, 28 | 1, 13, 17, 29 | 2, 14, 18 | 3, 15, 19 |
| UART1 | 4, 8, 20, 24 | 5, 9, 21, 25 | 6, 10, 22, 26 | 7, 11, 23, 27 |
The RP235x allows you to use CTS pins as TX pins by using the
FunctionUartAux pin function (instead of FunctionUart). The same goes
for using RTS pins as RX pins.
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: RtsImplementations§
Source§impl<Tx, Rx, Cts, Rts> Pins<Tx, Rx, Cts, Rts>
impl<Tx, Rx, Cts, Rts> Pins<Tx, Rx, Cts, Rts>
Sourcepub fn tx<NewTx>(self, tx: NewTx) -> Pins<OptionTSome<NewTx>, Rx, Cts, Rts>
pub fn tx<NewTx>(self, tx: NewTx) -> Pins<OptionTSome<NewTx>, Rx, Cts, Rts>
Set the TX pin
Sourcepub fn rx<NewRx>(self, rx: NewRx) -> Pins<Tx, OptionTSome<NewRx>, Cts, Rts>
pub fn rx<NewRx>(self, rx: NewRx) -> Pins<Tx, OptionTSome<NewRx>, Cts, Rts>
Set the RX pin
Sourcepub fn cts<NewCts>(self, cts: NewCts) -> Pins<Tx, Rx, OptionTSome<NewCts>, Rts>
pub fn cts<NewCts>(self, cts: NewCts) -> Pins<Tx, Rx, OptionTSome<NewCts>, Rts>
Set the CTS pin
Sourcepub fn rts<NewRts>(self, rts: NewRts) -> Pins<Tx, Rx, Cts, OptionTSome<NewRts>>
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>
impl Default for Pins<OptionTNone, OptionTNone, OptionTNone, OptionTNone>
Source§fn default() -> Pins<OptionTNone, OptionTNone, OptionTNone, OptionTNone>
fn default() -> Pins<OptionTNone, OptionTNone, OptionTNone, OptionTNone>
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>,
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>,
Auto Trait Implementations§
impl<Tx, Rx, Cts, Rts> Freeze for Pins<Tx, Rx, Cts, Rts>
impl<Tx, Rx, Cts, Rts> RefUnwindSafe for Pins<Tx, Rx, Cts, Rts>
impl<Tx, Rx, Cts, Rts> Send for Pins<Tx, Rx, Cts, Rts>
impl<Tx, Rx, Cts, Rts> Sync for Pins<Tx, Rx, Cts, Rts>
impl<Tx, Rx, Cts, Rts> Unpin for Pins<Tx, Rx, Cts, Rts>
impl<Tx, Rx, Cts, Rts> UnwindSafe for Pins<Tx, Rx, Cts, Rts>
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
Source§impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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