Serial

Struct Serial 

Source
pub struct Serial<UART, TX, RX, RTS, CTS> { /* private fields */ }
Expand description

Serial abstraction

Implementations§

Source§

impl<TX, RX, RTS, CTS> Serial<UART0, TX, RX, RTS, CTS>

Source

pub fn uart0( uart: UART0, tx_pin: TX, rx_pin: RX, rts_pin: RTS, cts_pin: CTS, baud_rate: Bps, nl_mode: NewlineMode, clocks: &Clocks, pc: &PowerControl, ) -> Self
where TX: TxPin<UART0>, RX: RxPin<UART0>, CTS: CtsPin<UART0>, RTS: RtsPin<UART0>,

Configures a UART peripheral to provide serial communication

Source

pub fn change_baud_rate(&mut self, baud_rate: Bps, clocks: &Clocks)

Change the current baud rate for the UART. We need the clocks object in order to calculate the magic baud rate register values.

Source

pub fn split(self) -> (Tx<UART0, TX, RTS>, Rx<UART0, RX, CTS>)

Splits the Serial abstraction into a transmitter and a receiver half. If you do this you can transmit and receive in different threads.

Source

pub fn write_all<I>(&mut self, data: &I)
where I: AsRef<[u8]> + ?Sized,

Write a complete string to the UART.

Source

pub fn combine( tx: Tx<UART0, TX, RTS>, rx: Rx<UART0, RX, CTS>, ) -> Serial<UART0, TX, RX, RTS, CTS>

Re-combine a split UART

Source

pub fn free(self) -> (UART0, TX, RX, RTS, CTS)

Releases the UART peripheral and associated pins

Source§

impl<TX, RX, RTS, CTS> Serial<UART1, TX, RX, RTS, CTS>

Source

pub fn uart1( uart: UART1, tx_pin: TX, rx_pin: RX, rts_pin: RTS, cts_pin: CTS, baud_rate: Bps, nl_mode: NewlineMode, clocks: &Clocks, pc: &PowerControl, ) -> Self
where TX: TxPin<UART1>, RX: RxPin<UART1>, CTS: CtsPin<UART1>, RTS: RtsPin<UART1>,

Configures a UART peripheral to provide serial communication

Source

pub fn change_baud_rate(&mut self, baud_rate: Bps, clocks: &Clocks)

Change the current baud rate for the UART. We need the clocks object in order to calculate the magic baud rate register values.

Source

pub fn split(self) -> (Tx<UART1, TX, RTS>, Rx<UART1, RX, CTS>)

Splits the Serial abstraction into a transmitter and a receiver half. If you do this you can transmit and receive in different threads.

Source

pub fn write_all<I>(&mut self, data: &I)
where I: AsRef<[u8]> + ?Sized,

Write a complete string to the UART.

Source

pub fn combine( tx: Tx<UART1, TX, RTS>, rx: Rx<UART1, RX, CTS>, ) -> Serial<UART1, TX, RX, RTS, CTS>

Re-combine a split UART

Source

pub fn free(self) -> (UART1, TX, RX, RTS, CTS)

Releases the UART peripheral and associated pins

Source§

impl<TX, RX, RTS, CTS> Serial<UART2, TX, RX, RTS, CTS>

Source

pub fn uart2( uart: UART2, tx_pin: TX, rx_pin: RX, rts_pin: RTS, cts_pin: CTS, baud_rate: Bps, nl_mode: NewlineMode, clocks: &Clocks, pc: &PowerControl, ) -> Self
where TX: TxPin<UART2>, RX: RxPin<UART2>, CTS: CtsPin<UART2>, RTS: RtsPin<UART2>,

Configures a UART peripheral to provide serial communication

Source

pub fn change_baud_rate(&mut self, baud_rate: Bps, clocks: &Clocks)

Change the current baud rate for the UART. We need the clocks object in order to calculate the magic baud rate register values.

Source

pub fn split(self) -> (Tx<UART2, TX, RTS>, Rx<UART2, RX, CTS>)

Splits the Serial abstraction into a transmitter and a receiver half. If you do this you can transmit and receive in different threads.

Source

pub fn write_all<I>(&mut self, data: &I)
where I: AsRef<[u8]> + ?Sized,

Write a complete string to the UART.

Source

pub fn combine( tx: Tx<UART2, TX, RTS>, rx: Rx<UART2, RX, CTS>, ) -> Serial<UART2, TX, RX, RTS, CTS>

Re-combine a split UART

Source

pub fn free(self) -> (UART2, TX, RX, RTS, CTS)

Releases the UART peripheral and associated pins

Source§

impl<TX, RX, RTS, CTS> Serial<UART3, TX, RX, RTS, CTS>

Source

pub fn uart3( uart: UART3, tx_pin: TX, rx_pin: RX, rts_pin: RTS, cts_pin: CTS, baud_rate: Bps, nl_mode: NewlineMode, clocks: &Clocks, pc: &PowerControl, ) -> Self
where TX: TxPin<UART3>, RX: RxPin<UART3>, CTS: CtsPin<UART3>, RTS: RtsPin<UART3>,

Configures a UART peripheral to provide serial communication

Source

pub fn change_baud_rate(&mut self, baud_rate: Bps, clocks: &Clocks)

Change the current baud rate for the UART. We need the clocks object in order to calculate the magic baud rate register values.

Source

pub fn split(self) -> (Tx<UART3, TX, RTS>, Rx<UART3, RX, CTS>)

Splits the Serial abstraction into a transmitter and a receiver half. If you do this you can transmit and receive in different threads.

Source

pub fn write_all<I>(&mut self, data: &I)
where I: AsRef<[u8]> + ?Sized,

Write a complete string to the UART.

Source

pub fn combine( tx: Tx<UART3, TX, RTS>, rx: Rx<UART3, RX, CTS>, ) -> Serial<UART3, TX, RX, RTS, CTS>

Re-combine a split UART

Source

pub fn free(self) -> (UART3, TX, RX, RTS, CTS)

Releases the UART peripheral and associated pins

Source§

impl<TX, RX, RTS, CTS> Serial<UART4, TX, RX, RTS, CTS>

Source

pub fn uart4( uart: UART4, tx_pin: TX, rx_pin: RX, rts_pin: RTS, cts_pin: CTS, baud_rate: Bps, nl_mode: NewlineMode, clocks: &Clocks, pc: &PowerControl, ) -> Self
where TX: TxPin<UART4>, RX: RxPin<UART4>, CTS: CtsPin<UART4>, RTS: RtsPin<UART4>,

Configures a UART peripheral to provide serial communication

Source

pub fn change_baud_rate(&mut self, baud_rate: Bps, clocks: &Clocks)

Change the current baud rate for the UART. We need the clocks object in order to calculate the magic baud rate register values.

Source

pub fn split(self) -> (Tx<UART4, TX, RTS>, Rx<UART4, RX, CTS>)

Splits the Serial abstraction into a transmitter and a receiver half. If you do this you can transmit and receive in different threads.

Source

pub fn write_all<I>(&mut self, data: &I)
where I: AsRef<[u8]> + ?Sized,

Write a complete string to the UART.

Source

pub fn combine( tx: Tx<UART4, TX, RTS>, rx: Rx<UART4, RX, CTS>, ) -> Serial<UART4, TX, RX, RTS, CTS>

Re-combine a split UART

Source

pub fn free(self) -> (UART4, TX, RX, RTS, CTS)

Releases the UART peripheral and associated pins

Source§

impl<TX, RX, RTS, CTS> Serial<UART5, TX, RX, RTS, CTS>

Source

pub fn uart5( uart: UART5, tx_pin: TX, rx_pin: RX, rts_pin: RTS, cts_pin: CTS, baud_rate: Bps, nl_mode: NewlineMode, clocks: &Clocks, pc: &PowerControl, ) -> Self
where TX: TxPin<UART5>, RX: RxPin<UART5>, CTS: CtsPin<UART5>, RTS: RtsPin<UART5>,

Configures a UART peripheral to provide serial communication

Source

pub fn change_baud_rate(&mut self, baud_rate: Bps, clocks: &Clocks)

Change the current baud rate for the UART. We need the clocks object in order to calculate the magic baud rate register values.

Source

pub fn split(self) -> (Tx<UART5, TX, RTS>, Rx<UART5, RX, CTS>)

Splits the Serial abstraction into a transmitter and a receiver half. If you do this you can transmit and receive in different threads.

Source

pub fn write_all<I>(&mut self, data: &I)
where I: AsRef<[u8]> + ?Sized,

Write a complete string to the UART.

Source

pub fn combine( tx: Tx<UART5, TX, RTS>, rx: Rx<UART5, RX, CTS>, ) -> Serial<UART5, TX, RX, RTS, CTS>

Re-combine a split UART

Source

pub fn free(self) -> (UART5, TX, RX, RTS, CTS)

Releases the UART peripheral and associated pins

Source§

impl<TX, RX, RTS, CTS> Serial<UART6, TX, RX, RTS, CTS>

Source

pub fn uart6( uart: UART6, tx_pin: TX, rx_pin: RX, rts_pin: RTS, cts_pin: CTS, baud_rate: Bps, nl_mode: NewlineMode, clocks: &Clocks, pc: &PowerControl, ) -> Self
where TX: TxPin<UART6>, RX: RxPin<UART6>, CTS: CtsPin<UART6>, RTS: RtsPin<UART6>,

Configures a UART peripheral to provide serial communication

Source

pub fn change_baud_rate(&mut self, baud_rate: Bps, clocks: &Clocks)

Change the current baud rate for the UART. We need the clocks object in order to calculate the magic baud rate register values.

Source

pub fn split(self) -> (Tx<UART6, TX, RTS>, Rx<UART6, RX, CTS>)

Splits the Serial abstraction into a transmitter and a receiver half. If you do this you can transmit and receive in different threads.

Source

pub fn write_all<I>(&mut self, data: &I)
where I: AsRef<[u8]> + ?Sized,

Write a complete string to the UART.

Source

pub fn combine( tx: Tx<UART6, TX, RTS>, rx: Rx<UART6, RX, CTS>, ) -> Serial<UART6, TX, RX, RTS, CTS>

Re-combine a split UART

Source

pub fn free(self) -> (UART6, TX, RX, RTS, CTS)

Releases the UART peripheral and associated pins

Source§

impl<TX, RX, RTS, CTS> Serial<UART7, TX, RX, RTS, CTS>

Source

pub fn uart7( uart: UART7, tx_pin: TX, rx_pin: RX, rts_pin: RTS, cts_pin: CTS, baud_rate: Bps, nl_mode: NewlineMode, clocks: &Clocks, pc: &PowerControl, ) -> Self
where TX: TxPin<UART7>, RX: RxPin<UART7>, CTS: CtsPin<UART7>, RTS: RtsPin<UART7>,

Configures a UART peripheral to provide serial communication

Source

pub fn change_baud_rate(&mut self, baud_rate: Bps, clocks: &Clocks)

Change the current baud rate for the UART. We need the clocks object in order to calculate the magic baud rate register values.

Source

pub fn split(self) -> (Tx<UART7, TX, RTS>, Rx<UART7, RX, CTS>)

Splits the Serial abstraction into a transmitter and a receiver half. If you do this you can transmit and receive in different threads.

Source

pub fn write_all<I>(&mut self, data: &I)
where I: AsRef<[u8]> + ?Sized,

Write a complete string to the UART.

Source

pub fn combine( tx: Tx<UART7, TX, RTS>, rx: Rx<UART7, RX, CTS>, ) -> Serial<UART7, TX, RX, RTS, CTS>

Re-combine a split UART

Source

pub fn free(self) -> (UART7, TX, RX, RTS, CTS)

Releases the UART peripheral and associated pins

Trait Implementations§

Source§

impl<TX, RX, RTS, CTS> Write for Serial<UART0, TX, RX, RTS, CTS>

Allows the Uart to be passed to ‘write!()’ and friends.

Source§

fn write_str(&mut self, s: &str) -> Result

Writes a string slice into this writer, returning whether the write succeeded. Read more
1.1.0 · Source§

fn write_char(&mut self, c: char) -> Result<(), Error>

Writes a char into this writer, returning whether the write succeeded. Read more
1.0.0 · Source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the write! macro with implementors of this trait. Read more
Source§

impl<TX, RX, RTS, CTS> Write for Serial<UART1, TX, RX, RTS, CTS>

Allows the Uart to be passed to ‘write!()’ and friends.

Source§

fn write_str(&mut self, s: &str) -> Result

Writes a string slice into this writer, returning whether the write succeeded. Read more
1.1.0 · Source§

fn write_char(&mut self, c: char) -> Result<(), Error>

Writes a char into this writer, returning whether the write succeeded. Read more
1.0.0 · Source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the write! macro with implementors of this trait. Read more
Source§

impl<TX, RX, RTS, CTS> Write for Serial<UART2, TX, RX, RTS, CTS>

Allows the Uart to be passed to ‘write!()’ and friends.

Source§

fn write_str(&mut self, s: &str) -> Result

Writes a string slice into this writer, returning whether the write succeeded. Read more
1.1.0 · Source§

fn write_char(&mut self, c: char) -> Result<(), Error>

Writes a char into this writer, returning whether the write succeeded. Read more
1.0.0 · Source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the write! macro with implementors of this trait. Read more
Source§

impl<TX, RX, RTS, CTS> Write for Serial<UART3, TX, RX, RTS, CTS>

Allows the Uart to be passed to ‘write!()’ and friends.

Source§

fn write_str(&mut self, s: &str) -> Result

Writes a string slice into this writer, returning whether the write succeeded. Read more
1.1.0 · Source§

fn write_char(&mut self, c: char) -> Result<(), Error>

Writes a char into this writer, returning whether the write succeeded. Read more
1.0.0 · Source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the write! macro with implementors of this trait. Read more
Source§

impl<TX, RX, RTS, CTS> Write for Serial<UART4, TX, RX, RTS, CTS>

Allows the Uart to be passed to ‘write!()’ and friends.

Source§

fn write_str(&mut self, s: &str) -> Result

Writes a string slice into this writer, returning whether the write succeeded. Read more
1.1.0 · Source§

fn write_char(&mut self, c: char) -> Result<(), Error>

Writes a char into this writer, returning whether the write succeeded. Read more
1.0.0 · Source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the write! macro with implementors of this trait. Read more
Source§

impl<TX, RX, RTS, CTS> Write for Serial<UART5, TX, RX, RTS, CTS>

Allows the Uart to be passed to ‘write!()’ and friends.

Source§

fn write_str(&mut self, s: &str) -> Result

Writes a string slice into this writer, returning whether the write succeeded. Read more
1.1.0 · Source§

fn write_char(&mut self, c: char) -> Result<(), Error>

Writes a char into this writer, returning whether the write succeeded. Read more
1.0.0 · Source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the write! macro with implementors of this trait. Read more
Source§

impl<TX, RX, RTS, CTS> Write for Serial<UART6, TX, RX, RTS, CTS>

Allows the Uart to be passed to ‘write!()’ and friends.

Source§

fn write_str(&mut self, s: &str) -> Result

Writes a string slice into this writer, returning whether the write succeeded. Read more
1.1.0 · Source§

fn write_char(&mut self, c: char) -> Result<(), Error>

Writes a char into this writer, returning whether the write succeeded. Read more
1.0.0 · Source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the write! macro with implementors of this trait. Read more
Source§

impl<TX, RX, RTS, CTS> Write for Serial<UART7, TX, RX, RTS, CTS>

Allows the Uart to be passed to ‘write!()’ and friends.

Source§

fn write_str(&mut self, s: &str) -> Result

Writes a string slice into this writer, returning whether the write succeeded. Read more
1.1.0 · Source§

fn write_char(&mut self, c: char) -> Result<(), Error>

Writes a char into this writer, returning whether the write succeeded. Read more
1.0.0 · Source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the write! macro with implementors of this trait. Read more
Source§

impl<TX, RX, RTS, CTS> Read<u8> for Serial<UART0, TX, RX, RTS, CTS>

Source§

type Error = Void

Read error
Source§

fn read(&mut self) -> Result<u8, Self::Error>

Reads a single word from the serial interface
Source§

impl<TX, RX, RTS, CTS> Read<u8> for Serial<UART1, TX, RX, RTS, CTS>

Source§

type Error = Void

Read error
Source§

fn read(&mut self) -> Result<u8, Self::Error>

Reads a single word from the serial interface
Source§

impl<TX, RX, RTS, CTS> Read<u8> for Serial<UART2, TX, RX, RTS, CTS>

Source§

type Error = Void

Read error
Source§

fn read(&mut self) -> Result<u8, Self::Error>

Reads a single word from the serial interface
Source§

impl<TX, RX, RTS, CTS> Read<u8> for Serial<UART3, TX, RX, RTS, CTS>

Source§

type Error = Void

Read error
Source§

fn read(&mut self) -> Result<u8, Self::Error>

Reads a single word from the serial interface
Source§

impl<TX, RX, RTS, CTS> Read<u8> for Serial<UART4, TX, RX, RTS, CTS>

Source§

type Error = Void

Read error
Source§

fn read(&mut self) -> Result<u8, Self::Error>

Reads a single word from the serial interface
Source§

impl<TX, RX, RTS, CTS> Read<u8> for Serial<UART5, TX, RX, RTS, CTS>

Source§

type Error = Void

Read error
Source§

fn read(&mut self) -> Result<u8, Self::Error>

Reads a single word from the serial interface
Source§

impl<TX, RX, RTS, CTS> Read<u8> for Serial<UART6, TX, RX, RTS, CTS>

Source§

type Error = Void

Read error
Source§

fn read(&mut self) -> Result<u8, Self::Error>

Reads a single word from the serial interface
Source§

impl<TX, RX, RTS, CTS> Read<u8> for Serial<UART7, TX, RX, RTS, CTS>

Source§

type Error = Void

Read error
Source§

fn read(&mut self) -> Result<u8, Self::Error>

Reads a single word from the serial interface
Source§

impl<TX, RX, RTS, CTS> Write<u8> for Serial<UART0, TX, RX, RTS, CTS>

Source§

type Error = Void

Write error
Source§

fn flush(&mut self) -> Result<(), Void>

Ensures that none of the previously written words are still buffered
Source§

fn write(&mut self, byte: u8) -> Result<(), Void>

Writes a single word to the serial interface
Source§

impl<TX, RX, RTS, CTS> Write<u8> for Serial<UART1, TX, RX, RTS, CTS>

Source§

type Error = Void

Write error
Source§

fn flush(&mut self) -> Result<(), Void>

Ensures that none of the previously written words are still buffered
Source§

fn write(&mut self, byte: u8) -> Result<(), Void>

Writes a single word to the serial interface
Source§

impl<TX, RX, RTS, CTS> Write<u8> for Serial<UART2, TX, RX, RTS, CTS>

Source§

type Error = Void

Write error
Source§

fn flush(&mut self) -> Result<(), Void>

Ensures that none of the previously written words are still buffered
Source§

fn write(&mut self, byte: u8) -> Result<(), Void>

Writes a single word to the serial interface
Source§

impl<TX, RX, RTS, CTS> Write<u8> for Serial<UART3, TX, RX, RTS, CTS>

Source§

type Error = Void

Write error
Source§

fn flush(&mut self) -> Result<(), Void>

Ensures that none of the previously written words are still buffered
Source§

fn write(&mut self, byte: u8) -> Result<(), Void>

Writes a single word to the serial interface
Source§

impl<TX, RX, RTS, CTS> Write<u8> for Serial<UART4, TX, RX, RTS, CTS>

Source§

type Error = Void

Write error
Source§

fn flush(&mut self) -> Result<(), Void>

Ensures that none of the previously written words are still buffered
Source§

fn write(&mut self, byte: u8) -> Result<(), Void>

Writes a single word to the serial interface
Source§

impl<TX, RX, RTS, CTS> Write<u8> for Serial<UART5, TX, RX, RTS, CTS>

Source§

type Error = Void

Write error
Source§

fn flush(&mut self) -> Result<(), Void>

Ensures that none of the previously written words are still buffered
Source§

fn write(&mut self, byte: u8) -> Result<(), Void>

Writes a single word to the serial interface
Source§

impl<TX, RX, RTS, CTS> Write<u8> for Serial<UART6, TX, RX, RTS, CTS>

Source§

type Error = Void

Write error
Source§

fn flush(&mut self) -> Result<(), Void>

Ensures that none of the previously written words are still buffered
Source§

fn write(&mut self, byte: u8) -> Result<(), Void>

Writes a single word to the serial interface
Source§

impl<TX, RX, RTS, CTS> Write<u8> for Serial<UART7, TX, RX, RTS, CTS>

Source§

type Error = Void

Write error
Source§

fn flush(&mut self) -> Result<(), Void>

Ensures that none of the previously written words are still buffered
Source§

fn write(&mut self, byte: u8) -> Result<(), Void>

Writes a single word to the serial interface

Auto Trait Implementations§

§

impl<UART, TX, RX, RTS, CTS> Freeze for Serial<UART, TX, RX, RTS, CTS>
where UART: Freeze, TX: Freeze, RX: Freeze, RTS: Freeze, CTS: Freeze,

§

impl<UART, TX, RX, RTS, CTS> RefUnwindSafe for Serial<UART, TX, RX, RTS, CTS>

§

impl<UART, TX, RX, RTS, CTS> Send for Serial<UART, TX, RX, RTS, CTS>
where UART: Send, TX: Send, RX: Send, RTS: Send, CTS: Send,

§

impl<UART, TX, RX, RTS, CTS> Sync for Serial<UART, TX, RX, RTS, CTS>
where UART: Sync, TX: Sync, RX: Sync, RTS: Sync, CTS: Sync,

§

impl<UART, TX, RX, RTS, CTS> Unpin for Serial<UART, TX, RX, RTS, CTS>
where UART: Unpin, TX: Unpin, RX: Unpin, RTS: Unpin, CTS: Unpin,

§

impl<UART, TX, RX, RTS, CTS> UnwindSafe for Serial<UART, TX, RX, RTS, CTS>
where UART: UnwindSafe, TX: UnwindSafe, RX: UnwindSafe, RTS: UnwindSafe, CTS: 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<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, 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.