atsams-rs / atsamx7x-rust

Rust HAL, PACs, and examples for the Microship SAM E70/S70/V70/V71
Apache License 2.0
24 stars 11 forks source link

USART: Missing events #29

Open tmplt opened 1 year ago

tmplt commented 1 year ago

Copied from the internal issue tracker. By @martinmortsell:

The current implementation of the USART peripheral only supports at subset of the available interrupt sources.

pub enum Event {
    RxReady,
    TxReady,
    Overrun,
    TxEmpty,
}

The HAL should support more (all?) Event sources. In particular, I was going to trigger an interrupt on NSSE in SPI mode.

tmplt commented 1 year ago

I think we'll need to replace the usart::Event with one that takes usart::{spi,uart}::Events:

pub enum Event {
Spi(spi::Event),
Uart(uart::Event),
}

and derive strum::FromRepr on the latter. The generics::events::EventHandler implementation will probably have to query the hardware in order to return the correct usart::Event member.