stm32h7xx-hal icon indicating copy to clipboard operation
stm32h7xx-hal copied to clipboard

Unused trait in Serial?

Open hargoniX opened this issue 5 years ago • 2 comments

So I was just reading through our UART/USART implementation in serial.rs and there we define the trait pub trait PinCk<USART> {} in line 155. It's only ever used again in the macro that implements it en mass for all the pins that are valid clock pins for USART. However I believe the correct intention should be to implement the Pin trait for a (TX, RX, CK) triple for all USART constructors right? Otherwise the trait doesn't bring any additional safety guarantees as far as I can see (feel free to correct me on that).

hargoniX avatar Jun 20 '20 12:06 hargoniX

Pinging @richardeoin as he implemented it

hargoniX avatar Jun 20 '20 12:06 hargoniX

You're right, the PinCk trait doesn't do anything here. It's really there for future use, in case we implement one of the synchronous modes in the HAL.

It's also publicly available as a trait bound, which is possibly useful in other crates.

richardeoin avatar Jun 20 '20 16:06 richardeoin