periph / host

Go·Hardware·Lean - Host drivers
https://periph.io
Apache License 2.0
57 stars 32 forks source link

bcm283x: gpio: add bcm2711 specific alt funcs mapping #25

Closed knieriem closed 1 year ago

knieriem commented 1 year ago

The BCM2711 provides more alternate pin functions than the BCM283x. An extra mapping table mapping2711 is added by this change, which gets assigned to the mapping variable conditionally during driverGPIO.Init(). The existing mapping is renamed to mapping283x, and used as default to keep tests working.

This change enables selecting alternate functions at runtime on a BCM2711 that were not supported by the existing BCM283x specific mapping, like GPIO4's UART3_TX; toggling between UART_TX and IN at runtime can be useful e.g. when sharing a single CAN transceiver between a CAN controller and a UART peripheral.

Resolves #24

maruel commented 1 year ago

gohci

maruel commented 1 year ago

Thanks Michael! Sadly my local lab died this weekend, so I can't test locally. This change looks good with the rename I commented on.

xvzf commented 1 year ago

@maruel is there a chance this gets merged anytime soon / more PRs are accepted?

maruel commented 1 year ago

Thanks for the ping. I went out for the holidays and then completely forgot about it. The pin comments should be updated. This can be done in a follow up.