pub struct Config {Show 22 fields
pub baudrate: u32,
pub word_length: WordLength,
pub parity: Parity,
pub stop_bits: StopBits,
pub duplex_mode: DuplexMode,
pub sync_mode: SyncMode,
pub clock_polarity: ClockPolarity,
pub clock_phase: ClockPhase,
pub clock_last_bit: bool,
pub bit_order: BitOrder,
pub data_inversion: bool,
pub tx_inversion: bool,
pub rx_inversion: bool,
pub swap_pins: bool,
pub loopback: bool,
pub tx_break: bool,
pub overwrite: bool,
pub flow_control: FlowControl,
pub rts_mode: RtsMode,
pub modem: ModemConfig,
pub dma: DmaConfig,
pub init_timeout: u32,
}Fields§
§baudrate: u32§word_length: WordLength§parity: Parity§stop_bits: StopBits§duplex_mode: DuplexMode§sync_mode: SyncMode§clock_polarity: ClockPolarity§clock_phase: ClockPhase§clock_last_bit: bool§bit_order: BitOrder§data_inversion: bool§tx_inversion: bool§rx_inversion: bool§swap_pins: bool§loopback: bool§tx_break: bool§overwrite: bool§flow_control: FlowControl§rts_mode: RtsMode§modem: ModemConfig§dma: DmaConfig§init_timeout: u32Implementations§
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()).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}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 clock_polarity(self, polarity: ClockPolarity) -> Self
pub const fn clock_phase(self, phase: ClockPhase) -> Self
pub const fn clock_last_bit(self, enabled: bool) -> Self
pub const fn bit_order(self, bit_order: BitOrder) -> Self
pub const fn data_inversion(self, enabled: bool) -> Self
pub const fn tx_inversion(self, enabled: bool) -> Self
pub const fn rx_inversion(self, enabled: bool) -> Self
pub const fn swap_pins(self, enabled: bool) -> Self
pub const fn loopback(self, enabled: bool) -> Self
pub const fn tx_break(self, enabled: bool) -> Self
pub const fn overwrite(self, enabled: bool) -> Self
pub const fn flow_control(self, flow_control: FlowControl) -> Self
pub const fn rts_mode(self, mode: RtsMode) -> Self
pub const fn modem(self, modem: ModemConfig) -> Self
pub const fn dma(self, dma: DmaConfig) -> Self
pub const fn init_timeout(self, timeout: u32) -> Self
pub const fn validate(&self) -> Result<(), ConfigError>
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