Skip to content

Commit 3ae43d6

Browse files
committed
listen CTS
1 parent 4a09898 commit 3ae43d6

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

CHANGELOG.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
99

1010
### Added
1111

12-
- Serial flow control enable
12+
- Serial flow control enable [#775]
1313
- `i2c_scanner` example [#758]
1414
- Enable `sdio` for stm32f446
1515
- port LTDC implementation and example from stm32f7xx-hal [#731]
@@ -31,6 +31,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
3131
[#758]: https://github.com/stm32-rs/stm32f4xx-hal/pull/758
3232
[#725]: https://github.com/stm32-rs/stm32f4xx-hal/pull/725
3333

34+
[#775]: https://github.com/stm32-rs/stm32f4xx-hal/pull/775
35+
3436
## [v0.21.0] - 2024-05-30
3537

3638
### Changed

src/serial/uart_impls.rs

+13
Original file line numberDiff line numberDiff line change
@@ -272,15 +272,22 @@ macro_rules! uartCommon {
272272
pub trait RBFlowControlImpl {
273273
fn enable_rts(&self, state: bool);
274274
fn enable_cts(&self, state: bool);
275+
fn listen_cts(&self, state: bool);
275276
}
276277

277278
impl RBFlowControlImpl for RegisterBlockUsart {
279+
#[inline(always)]
278280
fn enable_rts(&self, state: bool) {
279281
self.cr3().modify(|_, w| w.rtse().bit(state));
280282
}
283+
#[inline(always)]
281284
fn enable_cts(&self, state: bool) {
282285
self.cr3().modify(|_, w| w.ctse().bit(state));
283286
}
287+
#[inline(always)]
288+
fn listen_cts(&self, state: bool) {
289+
self.cr3().modify(|_, w| w.ctsie().bit(state))
290+
}
284291
}
285292

286293
impl RegisterBlockImpl for RegisterBlockUsart {
@@ -573,6 +580,12 @@ where
573580
pub fn disable_clear_to_send(&mut self) {
574581
self.tx.usart.enable_cts(false);
575582
}
583+
pub fn listen_clear_to_send(&mut self) {
584+
self.tx.usart.listen_cts(true)
585+
}
586+
pub fn unlisten_clear_to_send(&mut self) {
587+
self.tx.usart.listen_cts(false)
588+
}
576589
}
577590

578591
impl<UART: Instance, WORD> RxISR for Serial<UART, WORD>

0 commit comments

Comments
 (0)