mirror of
https://github.com/italicsjenga/rp-hal-boards.git
synced 2024-12-24 05:01:31 +11:00
Added impl Default
for UartConfig
This commit is contained in:
parent
bae3f2c9bc
commit
9e75cec551
|
@ -59,6 +59,16 @@ 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:
|
||||||
|
/// ```
|
||||||
|
/// UartConfig {
|
||||||
|
/// baudrate: Baud(0),
|
||||||
|
/// 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 +84,17 @@ pub struct UartConfig {
|
||||||
pub parity: Option<Parity>,
|
pub parity: Option<Parity>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for UartConfig {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
baudrate: Baud(0),
|
||||||
|
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