This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 5fbae0c40151a34b067b2666e46d1226206820eb Author: yangsong8 <[email protected]> AuthorDate: Wed Nov 11 15:21:08 2026 +0800 Documentation: document the GPIOC_TOGGLE ioctl Add GPIOC_TOGGLE to the list of GPIO driver ioctls and describe its argument, the read + write fallback and the -ENOTSUP case of gpio_lower_half. Assisted-by: Kiro:claude-opus-5-5 Signed-off-by: yangsong8 <[email protected]> --- Documentation/os/drivers/character/gpio.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Documentation/os/drivers/character/gpio.rst b/Documentation/os/drivers/character/gpio.rst index 455ee82beb7..a427e0d08f0 100644 --- a/Documentation/os/drivers/character/gpio.rst +++ b/Documentation/os/drivers/character/gpio.rst @@ -46,6 +46,7 @@ are supported: * :c:macro:`GPIOC_SETPINTYPE` * :c:macro:`GPIOC_SETDEBOUNCE` * :c:macro:`GPIOC_IRQ_SETMASK` + * :c:macro:`GPIOC_TOGGLE` .. c:macro:: GPIOC_WRITE @@ -159,6 +160,21 @@ Typical use case: int irq_mask = /* platform-specific mask value */; int ret = ioctl(fd, GPIOC_IRQ_SETMASK, (unsigned long)(uintptr_t)&irq_mask); +.. c:macro:: GPIOC_TOGGLE + +The ``GPIOC_TOGGLE`` command inverts the level of an output GPIO and returns +the new level. The argument is a pointer to a bool value to receive the +result. A lower half with a native toggle register can provide +``go_toggle`` to do this atomically; otherwise the driver reads the pin and +writes back the inverted value. Pins registered through ``gpio_lower_half`` +forward the request to the I/O expander and return ``-ENOTSUP`` if it does +not implement ``ioe_toggle``. Typical use case is: + +.. code-block:: c + + bool value; + int ret = ioctl(fd, GPIOC_TOGGLE, (unsigned long)(uintptr_t)&value); + Application Example ~~~~~~~~~~~~~~~~~~~
