While it's always good to be able to go to source, that one does seem to be in the documentation: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.
https://www.raspberrypi.com/documentati ... erations66
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.There seem to be some errors too: in gpio_init() and gpio_init_mask() it says:From the reference manual there are separate bits to enable input and output, it is not one bit which toggles.Clear the output enable (i.e. set to input).
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