Skip to main content

Serial

Struct Serial 

Source
pub struct Serial<UART, TXPIN, RXPIN>
where UART: Instance, TXPIN: TxPin<UART>, RXPIN: RxPin<UART>,
{ /* private fields */ }

Implementations§

Source§

impl<UART, TXPIN, RXPIN> Serial<UART, TXPIN, RXPIN>
where UART: Instance, TXPIN: TxPin<UART>, RXPIN: RxPin<UART>,

Source

pub fn new( uart: UART, pins: (TXPIN, RXPIN), config: Config, ) -> Result<Self, InitError<UART, TXPIN, RXPIN>>

Examples found in repository?
examples/serial.rs (line 29)
15pub extern "C" fn main() -> ! {
16    let peripherals = Peripherals::take().unwrap();
17
18    let rcc_config = RCC::default();
19    RCC::init(&rcc_config);
20
21    peripherals
22        .pm
23        .clk_apb_m_set()
24        .modify(|_, w| w.pad_config().enable().pm().enable());
25
26    let rx = Pin08::new().into_serial_port();
27    let tx = Pin09::new().into_serial_port();
28
29    let serial = Serial::new(peripherals.usart_1, (tx, rx), Config::default()).unwrap();
30    let (mut tx, _rx) = serial.split();
31
32    loop {
33        let _ = writeln!(tx, "Hello from MIK32 USART1");
34        delay(MESSAGE_DELAY_SPINS);
35    }
36}
Source

pub fn release(self) -> (UART, (TXPIN, RXPIN))

Source

pub fn split(self) -> (Tx<UART, TXPIN, Owned>, Rx<UART, RXPIN, Borrowed>)

Examples found in repository?
examples/serial.rs (line 30)
15pub extern "C" fn main() -> ! {
16    let peripherals = Peripherals::take().unwrap();
17
18    let rcc_config = RCC::default();
19    RCC::init(&rcc_config);
20
21    peripherals
22        .pm
23        .clk_apb_m_set()
24        .modify(|_, w| w.pad_config().enable().pm().enable());
25
26    let rx = Pin08::new().into_serial_port();
27    let tx = Pin09::new().into_serial_port();
28
29    let serial = Serial::new(peripherals.usart_1, (tx, rx), Config::default()).unwrap();
30    let (mut tx, _rx) = serial.split();
31
32    loop {
33        let _ = writeln!(tx, "Hello from MIK32 USART1");
34        delay(MESSAGE_DELAY_SPINS);
35    }
36}
Source

pub fn reunite( tx: Tx<UART, TXPIN, Owned>, rx: Rx<UART, RXPIN, Borrowed>, ) -> Serial<UART, TXPIN, RXPIN>

Trait Implementations§

Source§

impl<UART, TXPIN, RXPIN> ErrorType for Serial<UART, TXPIN, RXPIN>
where UART: Instance, TXPIN: TxPin<UART>, RXPIN: RxPin<UART>,

Source§

type Error = ErrorKind

Error type

Auto Trait Implementations§

§

impl<UART, TXPIN, RXPIN> Freeze for Serial<UART, TXPIN, RXPIN>
where UART: Freeze, TXPIN: Freeze, RXPIN: Freeze,

§

impl<UART, TXPIN, RXPIN> RefUnwindSafe for Serial<UART, TXPIN, RXPIN>
where UART: RefUnwindSafe, TXPIN: RefUnwindSafe, RXPIN: RefUnwindSafe,

§

impl<UART, TXPIN, RXPIN> Send for Serial<UART, TXPIN, RXPIN>
where UART: Send, TXPIN: Send, RXPIN: Send,

§

impl<UART, TXPIN, RXPIN> Sync for Serial<UART, TXPIN, RXPIN>
where UART: Sync, TXPIN: Sync, RXPIN: Sync,

§

impl<UART, TXPIN, RXPIN> Unpin for Serial<UART, TXPIN, RXPIN>
where UART: Unpin, TXPIN: Unpin, RXPIN: Unpin,

§

impl<UART, TXPIN, RXPIN> UnsafeUnpin for Serial<UART, TXPIN, RXPIN>
where UART: UnsafeUnpin, TXPIN: UnsafeUnpin, RXPIN: UnsafeUnpin,

§

impl<UART, TXPIN, RXPIN> UnwindSafe for Serial<UART, TXPIN, RXPIN>
where UART: UnwindSafe, TXPIN: UnwindSafe, RXPIN: 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.