|
|
Line 1: |
Line 1: |
− | == The linux LED driver class ==
| + | see [[GPIO_LEDS]] |
− | | + | |
− | On recent kernel, linux have a led driver. This led can be driven from /sys/class/leds/ directory.
| + | |
− | | + | |
− | For APF28Dev, the led is configurable under the directory :
| + | |
− | | + | |
− | <pre class="apf">
| + | |
− | # cd /sys/class/leds/apfdev:green:user
| + | |
− | </pre>
| + | |
− | | + | |
− | === Blinking ===
| + | |
− | | + | |
− | The blinking style can be selected with ''trigger'' file. By defaut on APF28Dev, Heartbeat is selected :
| + | |
− | | + | |
− | <pre class="apf">
| + | |
− | # cat /sys/class/leds/apfdev:green:user/trigger
| + | |
− | none nand-disk mmc0 timer [heartbeat] backlight gpio default-on
| + | |
− | </pre>
| + | |
− | | + | |
− | Blinking style can be changed with ''echo'' command :
| + | |
− | | + | |
− | <pre class="apf">
| + | |
− | # echo "nand-disk" > /sys/class/leds/apfdev:green:user/trigger
| + | |
− | # cat /sys/class/leds/apfdev:green:user/trigger
| + | |
− | none [nand-disk] mmc0 timer heartbeat backlight gpio default-on
| + | |
− | </pre>
| + | |
− | | + | |
− | With this "nand-disk" option selected, the led will blink each time nand access occur (try with ''sync'' command to see it blinking).
| + | |
− | | + | |
− | === Switch led with user button ===
| + | |
− | | + | |
− | It is possible to switch led state using the APF28Dev user button. This button is seen as gpio17 (as seen under APF28Dev [[datasheet]]) under Linux, then configure the led trigger as gpio :
| + | |
− | | + | |
− | <pre class="apf">
| + | |
− | # echo "gpio" > /sys/class/leds/apfdev:green:user/trigger
| + | |
− | </pre>
| + | |
− | | + | |
− | New config files are available :
| + | |
− | <pre class="apf">
| + | |
− | # ls /sys/class/leds/apfdev:green:user/
| + | |
− | brightness gpio power uevent
| + | |
− | desired_brightness inverted subsystem
| + | |
− | device max_brightness trigger
| + | |
− | </pre>
| + | |
− | | + | |
− | Then the trigger gpio can be configured with ''gpio'' file :
| + | |
− | | + | |
− | <pre class="apf">
| + | |
− | # echo 17 > gpio
| + | |
− | </pre>
| + | |
− | | + | |
− | Then pushing the user switch will now commute the LED state.
| + | |
− | | + | |
− | === Links ===
| + | |
− | | + | |
− | See the kernel documentation [http://www.mjmwired.net/kernel/Documentation/leds-class.txt Documentation/leds-class.txt] for more information about this driver.
| + | |