| README for Brillo GPIO sample |
| |
| This GPIO sample demonstrates how to set up GPIO and write/read to GPIO pins. |
| Specifically this app does the following. |
| |
| - Export an input and output GPIO pins |
| - Set output e.g. pin 24 direction to "out" and value to 1 |
| - Set input e.g. pin 28 direction to "in" and edge to "both" |
| - Read input pin by polling |
| - Once input pin is triggered to input value 1, set output value to 0 |
| |
| Once built, you can find the binary inside your tree at: |
| |
| out/target/product/dragonboard/symbols/system/bin/gpio_playground |
| |
| Do the following to deploy the sample: |
| - adb root |
| - adb remount |
| - adb sync |
| |
| Hardware setup: |
| - You need to connect a GPIO pin as output to an LED |
| - You need to connect a GPIO pin as input to a push button switch |
| |
| Do the following to run the sample on Dragonboard and check logs for info: |
| - Open a shell window and run: adb logcat |
| - Open another shell window and run: |
| - Default input pin 28 and output pin 24 |
| - adb shell '/system/bin/gpio_playground &' |
| - Choose your own output and input pins |
| - adb shell '/system/bin/gpio_playground --gin=<input> --gout=<output> &' |
| - For example, adb shell '/system/bin/gpio_playground --gin=28 --gout=24 &' |
| - Observe the logging info from the first window |
| - Observe that the LED of pin 24 is turned on |
| - Now push the switch of pin 28 and see that the LED gets turned off |
| |
| Notes: |
| - There is a GPIO port offset defined by const kDefaultGpioOffset that depends |
| on what kind of boards you use. For Dragonboard it is 902. This offset can |
| also be configured by a commandline parameter. |
| - There is an output pin and input pin defined by const kDefaultGpioOut and |
| kDefaultGpioIn respectively. They can both be configured by commandline |
| parameters. |