Skip to content

No generic way to create IO pin #349

Open
@jg2562

Description

@jg2562

With the new pin rewrite to mimic the f4 api, I havent found a way to save several generic pins into a struct and use them as IO pins.

Heres an example struct

struct IOBus {
	io0: PA0,
	io1: PB1,
	io2: PC2,
	io3: PD3,
}

But I'm not sure how to make to it generic over the pin types.

At first I tried to use erased pins, but with the latest change, there's no pin mode manipulation for erased pins.

I also found this post on stack overflow describing a similar situation. But from what I can tell, theres no traits to abstract over for the pins nor a way to use the associated types for the pins directly.

My real world use case has over 40 pins in the same struct, so duplication of the struct isn't very feasible or ergonomic.

Im not sure if this is just a shortcoming of my knowledge or if its just not feasible yet, either way help would be greatly appreciated! Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions