[PATCH] Proposal for new GPIO API and example implementation for STM32F4 BSP

Duc Doan dtbpkmte at gmail.com
Fri Jun 24 14:28:30 UTC 2022


Hello Christian,

On Thu, 2022-06-23 at 18:30 +0200, oss at c-mauderer.de wrote:
> Another tricky part can be how to handle pins or pin groups. At the 
> moment I just used an "unsigned" for a single pin. That wouldn't be
> able 
> to handle a pin group. Maybe a pin group needs it's own type or some 
> kind of extensible type. For the usual controller with <= 32 bit a
> mask 
> in a uint32_t would be great. For other controllers maybe a longer
> mask 
> is necessary. That's a bit tricky.

Thank you for the pseudocode, I think your method is better than mine.
I am currently rewriting the code. However, I am not clear about pin
groups: Is a "pin group" same as a "port"? Or does a group mean pins
from that group can come from different ports/GPIO controllers?

Also, I am thinking that maybe I can create an opaque type for pin mask
that BSPs will implement, instead of a specific type like
uint32_t. That type could be used as a long mask or just a pin number,
depending on the BSP.

Best,

Duc Doan


More information about the devel mailing list