mirror of
https://github.com/italicsjenga/rp-hal-boards.git
synced 2024-12-23 12:41:31 +11:00
Implement UartConfig::new constructor method
This commit is contained in:
parent
71c39a4431
commit
0a86dad34c
|
@ -1,8 +1,7 @@
|
|||
use fugit::HertzU32;
|
||||
|
||||
use crate::pac::{uart0::RegisterBlock, UART0, UART1};
|
||||
use crate::resets::SubsystemReset;
|
||||
use core::ops::Deref;
|
||||
use fugit::HertzU32;
|
||||
|
||||
/// Error type for UART operations.
|
||||
#[derive(Debug)]
|
||||
|
@ -84,6 +83,23 @@ pub struct UartConfig {
|
|||
pub parity: Option<Parity>,
|
||||
}
|
||||
|
||||
impl UartConfig {
|
||||
/// Create a new instance of UartConfig
|
||||
pub fn new(
|
||||
baudrate: HertzU32,
|
||||
data_bits: DataBits,
|
||||
parity: Option<Parity>,
|
||||
stop_bits: StopBits,
|
||||
) -> UartConfig {
|
||||
UartConfig {
|
||||
baudrate,
|
||||
data_bits,
|
||||
stop_bits,
|
||||
parity,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Rx/Tx FIFO Watermark
|
||||
///
|
||||
/// Determine the FIFO level that trigger DMA/Interrupt
|
||||
|
|
Loading…
Reference in a new issue