stm32-rs / stm32l1xx-hal

[WIP] Peripheral access API for STM32L1 series microcontrollers
Apache License 2.0
9 stars 11 forks source link

Clear error flags on a serial read #4

Open svartalf opened 4 years ago

svartalf commented 4 years ago

According to the "27.6.1 Status register (USART_SR)" of the reference manual in case if error flag bit is set during the read, software needs to clear it by reading SR and DR registers.

Basically it is a copy of the stm32f1xx-hal lib Serial::read implementation: https://github.com/stm32-rs/stm32f1xx-hal/blob/e36195ed3ea4512ffe5fa0683d7cc510e54cc4b5/src/serial.rs#L348-L388 , but since I'm not an expert in an embedded field, it would be nice to check it once again.