fix(stm32): disable transmitter during half-duplex read

This commit is contained in:
Badr Bouslikhin 2024-08-30 18:52:23 +02:00
parent f0a8607051
commit f6d92b7611
No known key found for this signature in database

View File

@ -526,9 +526,12 @@ fn blocking_flush(info: &Info) -> Result<(), Error> {
let r = info.regs;
while !sr(r).read().tc() {}
// Enable Receiver after transmission complete for Half-Duplex mode
// Disable Transmitter and enable receiver after transmission complete for Half-Duplex mode
if r.cr3().read().hdsel() {
r.cr1().modify(|reg| reg.set_re(true));
r.cr1().modify(|reg| {
reg.set_te(false);
reg.set_re(true);
});
}
Ok(())