Skip to content

Commit

Permalink
Use upper camel case for UART's StopBits variants
Browse files Browse the repository at this point in the history
  • Loading branch information
jessebraham committed Dec 3, 2024
1 parent a6a83d3 commit 629c0ed
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions esp-hal/src/uart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,11 +374,11 @@ pub enum Parity {
pub enum StopBits {
/// 1 stop bit.
#[default]
STOP1 = 1,
Stop1 = 1,
/// 1.5 stop bits.
STOP1P5 = 2,
Stop1P5 = 2,
/// 2 stop bits.
STOP2 = 3,
Stop2 = 3,
}

/// UART Configuration
Expand Down Expand Up @@ -461,7 +461,7 @@ impl Config {
_ => 1,
};
length += match self.stop_bits {
StopBits::STOP1 => 1,
StopBits::Stop1 => 1,
_ => 2, // esp-idf also counts 2 bits for settings 1.5 and 2 stop bits
};
length
Expand Down Expand Up @@ -2549,13 +2549,13 @@ impl Info {
#[cfg(esp32)]
{
// workaround for hardware issue, when UART stop bit set as 2-bit mode.
if stop_bits == StopBits::STOP2 {
if stop_bits == StopBits::Stop2 {
self.register_block()
.rs485_conf()
.modify(|_, w| w.dl1_en().bit(stop_bits == StopBits::STOP2));
.modify(|_, w| w.dl1_en().bit(stop_bits == StopBits::Stop2));

self.register_block().conf0().modify(|_, w| {
if stop_bits == StopBits::STOP2 {
if stop_bits == StopBits::Stop2 {
unsafe { w.stop_bit_num().bits(1) }
} else {
unsafe { w.stop_bit_num().bits(stop_bits as u8) }
Expand Down

0 comments on commit 629c0ed

Please sign in to comment.