Skip to content

Commit b865df4

Browse files
committed
Hardware flow control for serial interfaces
1 parent 21b5785 commit b865df4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/serial.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ where
192192
// Enable DMA
193193
usart.cr3.write(|w| w.dmat().enabled().dmar().enabled());
194194

195+
// Configure hardware flow control
196+
usart.cr3.write(|w| w.ctse().bit(config.cts_enabled).rtse().bit(config.rts_enabled));
197+
195198
Serial { usart, pins }
196199
}
197200

@@ -438,7 +441,8 @@ pub struct Config {
438441
pub sysclock: bool,
439442
pub parity: Parity,
440443
pub data_bits: DataBits,
441-
444+
pub cts_enabled: bool,
445+
pub rts_enabled: bool,
442446
}
443447

444448
pub enum Oversampling {
@@ -479,6 +483,8 @@ impl Default for Config {
479483
sysclock: false,
480484
parity: Parity::ParityNone,
481485
data_bits: DataBits::Bits8,
486+
cts_enabled: false,
487+
rts_enabled: false,
482488
}
483489
}
484490
}

0 commit comments

Comments
 (0)