stm32l4xx-hal
stm32l4xx-hal copied to clipboard
API design parity/uniformity: enabling of a peripheral
Hi all,
Currently, there are two types of API's being used for enabling peripherals: an Ext trait with something similar to an enable function, or a function like HalPeripheralWrapper::peripheralN(peripheralN: PACStruct).
I think it would be good if a single one of these could be picked, at least for expansions to the HAL, to ensure that the API is uniform.
Personally, I'm a bigger fan of the latter method: it's , in my opinion, clearer, and it's not necessary to import an extra trait to get the required functionality.
Perhaps changing the naming convention to HalPeripheralWrapper::from_peripheralN() would be nice, but I think that is a different discussion.
I'm interested to see what others' thoughts are on this, so please let me know below :)
Hi, there is a similar issue open which motivates that we should not have extension traits (and I agree): https://github.com/stm32-rs/stm32l4xx-hal/issues/57