diff --git a/rp2040-hal/src/uart/utils.rs b/rp2040-hal/src/uart/utils.rs index ba6b455..e44011b 100644 --- a/rp2040-hal/src/uart/utils.rs +++ b/rp2040-hal/src/uart/utils.rs @@ -59,6 +59,16 @@ pub enum Parity { } /// 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] pub struct UartConfig { /// The baudrate the uart will run at. @@ -74,6 +84,17 @@ pub struct UartConfig { pub parity: Option, } +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 /// /// For eh 1.0.0-alpha.6, Infallible doesn't implement serial::Error,