stm32-rs / stm32g0xx-hal

Peripheral access API for STM32G0 series microcontrollers
Apache License 2.0
74 stars 51 forks source link

USART: Add methods to check rxne and txe bits #60

Closed ijager closed 3 years ago

ijager commented 3 years ago

When USART is split into Rx/Tx objects.

Inspired by f4xx-hal

Usage:

if self.rx.is_rxne() {
    match self.rx.read() {
        Ok(byte) => {
            // do stuff
        },
        Err(_err) => {
             // handle uart read error
        }
    };
}
andresv commented 3 years ago

LGTM