forked from apache/nuttx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Doc/ioexpand: add descriptions about ioexpander
Signed-off-by: buxiasen <[email protected]>
- Loading branch information
1 parent
f1fc53d
commit e9ea9f3
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |