mirror of
https://github.com/italicsjenga/rp-hal-boards.git
synced 2025-01-11 13:01:30 +11:00
Merge pull request #268 from VictorKoenders/default-uart-config
Added `impl Default` for UartConfig
This commit is contained in:
commit
3a0e23c406
|
@ -59,6 +59,17 @@ pub enum Parity {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A struct holding the configuration for an UART device.
|
/// A struct holding the configuration for an UART device.
|
||||||
|
///
|
||||||
|
/// The `Default` implementation implements the following values:
|
||||||
|
/// ```ignore
|
||||||
|
/// # // can't actually create this with the non_exhaustive attribute
|
||||||
|
/// UartConfig {
|
||||||
|
/// baudrate: Baud(115_200),
|
||||||
|
/// data_bits: DataBits::Eight,
|
||||||
|
/// stop_bits: StopBits::One,
|
||||||
|
/// parity: None,
|
||||||
|
///}
|
||||||
|
/// ```
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub struct UartConfig {
|
pub struct UartConfig {
|
||||||
/// The baudrate the uart will run at.
|
/// The baudrate the uart will run at.
|
||||||
|
@ -74,6 +85,17 @@ pub struct UartConfig {
|
||||||
pub parity: Option<Parity>,
|
pub parity: Option<Parity>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for UartConfig {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
baudrate: Baud(115_200),
|
||||||
|
data_bits: DataBits::Eight,
|
||||||
|
stop_bits: StopBits::One,
|
||||||
|
parity: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Same as core::convert::Infallible, but implementing serial::Error
|
/// Same as core::convert::Infallible, but implementing serial::Error
|
||||||
///
|
///
|
||||||
/// For eh 1.0.0-alpha.6, Infallible doesn't implement serial::Error,
|
/// For eh 1.0.0-alpha.6, Infallible doesn't implement serial::Error,
|
||||||
|
|
Loading…
Reference in a new issue