pub struct Config {
pub baudrate: u32,
pub word_length: WordLength,
pub parity: Parity,
pub stop_bits: StopBits,
pub duplex_mode: DuplexMode,
pub sync_mode: SyncMode,
pub dma: DmaConfig,
}Fields§
§baudrate: u32§word_length: WordLength§parity: Parity§stop_bits: StopBits§duplex_mode: DuplexMode§sync_mode: SyncMode§dma: DmaConfigImplementations§
Source§impl Config
impl Config
Sourcepub const fn default() -> Self
pub const fn default() -> 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}pub const fn baudrate(self, baudrate: u32) -> Self
pub const fn word_length(self, word_length: WordLength) -> Self
pub const fn parity(self, parity: Parity) -> Self
pub const fn stop_bits(self, stop_bits: StopBits) -> Self
pub const fn duplex_mode(self, duplex_mode: DuplexMode) -> Self
pub const fn sync_mode(self, sync_mode: SyncMode) -> Self
pub const fn dma(self, dma: DmaConfig) -> Self
Trait Implementations§
impl Copy for Config
impl Eq for Config
impl StructuralPartialEq for Config
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
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