Description
Most of the implementations for peripherals are created using macros which results in a number of specialized impls that don't indicate they have shared functionality. Because there are no traits for these impls the functions defined inside cannot be used with generics. By just adding the impls inside the macros to a trait instead it would allow for peripherals to be used with generics.
For example right now you can't do something like this because all of the impls are specialized:
fn serial_stuff<USART>(serial: serial::Serial<USART>) {
serial.configure(...);
...
}
However if the following:
macro_rules! usart {
...
impl Serial<$USARTX> {
...
was given a trait like:
macro_rules! usart {
...
impl SerialTrait for Serial<$USARTX> {
...
it would be very convenient to use with generics using a where serial::Serial<USART>: SerialTrait
Not sure how common of a use case this is but at least for my use case it would be very helpful as it is communicating very similar data between multiples of the same peripheral on different buses.
I'd be happy to add these traits to the relevant modules if this is a good/useful solution.