Skip to content

Commit

Permalink
Hardware flow control for serial interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
rtvd committed Oct 3, 2023
1 parent b497dde commit b3c5d3d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ where
// Enable DMA
usart.cr3.write(|w| w.dmat().enabled().dmar().enabled());

// Configure hardware flow control
usart.cr3.write(|w| w.ctse().bit(config.cts_enabled).rtse().bit(config.rts_enabled));

Serial { usart, pins }
}

Expand Down Expand Up @@ -438,7 +441,8 @@ pub struct Config {
pub sysclock: bool,
pub parity: Parity,
pub data_bits: DataBits,

pub cts_enabled: bool,
pub rts_enabled: bool,
}

pub enum Oversampling {
Expand Down Expand Up @@ -479,6 +483,8 @@ impl Default for Config {
sysclock: false,
parity: Parity::ParityNone,
data_bits: DataBits::Bits8,
cts_enabled: false,
rts_enabled: false,
}
}
}
Expand Down

0 comments on commit b3c5d3d

Please sign in to comment.