Closed smeenka closed 2 years ago
@dotcypress, if it is under struct PwmPin
then we cannot use it in generic functions.
Currently we can do:
fn set_mode<P: PwmPinMode>(pin: P) {
p.set_compare_mode(OutputCompareMode::Frozen);
}
The name for the trait PwmPinMode is too specific. What is needed is a trait for all functions not specified in the hal trait. This requirement is not only for this device but very generic. So I propose to have a DeviceIoCtl or IoCtl trait for each device, containing the device specific api functions not in the hal. A bit like the ioctl function in the posix interface
@andresv yeah, make sense!
@smeenka I think DeviceIoCtl or IoCtl is too abstract, let stick with PwmPinMode
then. Could you fix formatting issue and we good to merge this PR
No change after cargo fmt in my feature branch, so can you tell me the formatting issue?
@smeenka cargo fmt sometimes isn't working inside a macro. I will fix formatting manually. Thant you!
Do we really want a new trait
PwmPinMode
here? Maybe we can moveset_compare_mode
toPwmPin<$TIMX, $CH>
implementation?@andresv any thoughts on this?