pub struct Serial<UART, TXPIN, RXPIN>{ /* private fields */ }Implementations§
Source§impl<UART, TXPIN, RXPIN> Serial<UART, TXPIN, RXPIN>
impl<UART, TXPIN, RXPIN> Serial<UART, TXPIN, RXPIN>
Sourcepub fn new(uart: UART, pins: (TXPIN, RXPIN), config: Config) -> Self
pub fn new(uart: UART, pins: (TXPIN, RXPIN), config: Config) -> Self
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());
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}Sourcepub fn split(self) -> (Tx<UART>, Rx<UART>)
pub fn split(self) -> (Tx<UART>, Rx<UART>)
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());
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}Trait Implementations§
Auto Trait Implementations§
impl<UART, TXPIN, RXPIN> Freeze for Serial<UART, TXPIN, RXPIN>
impl<UART, TXPIN, RXPIN> RefUnwindSafe for Serial<UART, TXPIN, RXPIN>
impl<UART, TXPIN, RXPIN> Send for Serial<UART, TXPIN, RXPIN>
impl<UART, TXPIN, RXPIN> Sync for Serial<UART, TXPIN, RXPIN>
impl<UART, TXPIN, RXPIN> Unpin for Serial<UART, TXPIN, RXPIN>
impl<UART, TXPIN, RXPIN> UnsafeUnpin for Serial<UART, TXPIN, RXPIN>
impl<UART, TXPIN, RXPIN> UnwindSafe for Serial<UART, TXPIN, RXPIN>
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