Skip to content

Commit

Permalink
Doc/ioexpand: add descriptions about ioexpander
Browse files Browse the repository at this point in the history
Signed-off-by: buxiasen <[email protected]>
  • Loading branch information
jasonbu authored and xiaoxiang781216 committed Sep 30, 2024
1 parent f1fc53d commit e9ea9f3
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Documentation/components/drivers/special/ioexpander.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
==========================
IO Expander Device Drivers
==========================

- ``include/nuttx/ioexpander/ioexpander.h`` and ``include/nuttx/ioexpander/gpio.h``.
All structures and APIs needed to work with ioexpander drivers are provided in
this header file.

- ``struct ioexpander_ops_s``. Each ioexpand device driver must implement
an instance of ``struct ioexpander_ops_s``. That structure defines a
call table with the methods, and we also provide macros to help access methods.

- we also provide method ``gpio_lower_half`` to make ioexpander compatible with normal gpio.

- **Binding ioexpander Drivers**. ioexpander drivers are not normally directly
accessed by user code, we should always get lower level drivers, for example I2C,
and map extended gpio feature same asa normal gpio. See for example,
``int nrf52_sx1509_initialize(void)``
in ``boards/arm/nrf52/thingy52/src/nrf52_sx1509.c``. In general, the binding
sequence is:

#. Get an instance of ``struct i2c_master_s`` from the
hardware-specific I2C device driver, and
#. Provide that instance and configurations to the ioexpander initialization method
to get the ``struct ioexpander_dev_s`` ioe device instance.
#. Then use ioe device instance to do ioexpander operations, or use ``gpio_lower_half``
to make ioexpand compatible with normal gpio.


- **Examples**: ``drivers/ioexpander/pca9555.c``,
``drivers/input/aw86225.c``,
``drivers/analog/lmp92001.c``,
``drivers/ioexpander/ioe_rpmsg.c``,
``boards/sim/sim/sim/src/sim_ioexpander.c``,
``boards/arm/nrf52/thingy52/src/nrf52_sx1509.c`` etc.

0 comments on commit e9ea9f3

Please sign in to comment.