Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4906

General • Re: RP2040: multiple (6) GPIO interrupts

$
0
0
There are a few holes in the sdk documentation like not defining the permissible values of some enums. I had to go to source to find GPIO_FUNC_SIO and another one.
While it's always good to be able to go to source, that one does seem to be in the documentation:

https://www.raspberrypi.com/documentati ... erations66
There seem to be some errors too: in gpio_init() and gpio_init_mask() it says:
Clear the output enable (i.e. set to input).
From the reference manual there are separate bits to enable input and output, it is not one bit which toggles.
Well, there's actually a register (GPIO_OE) with one bit per pin, '1' for output, '0' for input, but then there's additional convenience aliases that set (GPIO_OE_SET), clear (GPIO_OE_CLR), or toggle (GPIO_OE_XOR) the bits written.

The GPIOs are slightly special in having these register aliases created explicitly, because they are part of the SIO for single-cycle access. For all the ordinary registers on the main bus, there is a generic mechanism for set/clear/xor aliases at fixed address offsets, and the SDK provides the macro hw_set_bits() to do the address arithmetic for you.

Statistics: Posted by arg001 — Tue Aug 06, 2024 6:30 pm



Viewing all articles
Browse latest Browse all 4906

Trending Articles