Skip to content

Type-erased peripherals #4442

@FeldrinH

Description

@FeldrinH

Currently there seems to be no way to obtain type-erased peripherals. Consider for example that I have Qei<'d, TIM1>, Qei<'d, TIM2> and Qei<'d, TIM3>. I would now like to put them all in an array. However, for this I need them all to have the same type.

It would be nice to have someting like AnyTIM, where I could call TIM1.erase(), TIM2.erase(), etc to turn them all into AnyTIM and then have an array of Qei<'d, AnyTIM>.

PS: I think AnyTIM is better than AnyQei because it's more flexible. If I write code that is generic over T in Qei<'d, T>, then that would work with both concrete TIMx types as well as AnyTIM. With AnyQei there is no easy way to write code that is generic over both Qei and AnyQei. Also, I think AnyTIM is just a nicer abstraction, because conceptually there aren't two different Qei types, there is one Qei type that works for either a specific timer or any timer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions