Button and LED control on Gumstix LCD boardsLast Updated on Friday, 23 March 2012 19:50 The Gumstix LCD boards have some additional buttons and LEDs on them that the other expansion boards don't.
ButtonsThe following buttons can be found on the Palo35, Palo43 and Chestnut43 expansion boards. GPIO14 - BTN_0 GPIO23 - BTN_1
The 2.6.36 and greater board file for the Overos registers a platform device "gpio-keys" for these buttons. Older kernels used the gpio sysfs interface for these buttons. You can find some description of that here Gumstix GPIO. This gpio-keys driver registration is conditional based the kernel configuration parameter CONFIG_KEYBOARD_GPIO. If you would rather use these buttons with the /sys/class/gpio interface that older kernels used, then disable this parameter and rebuild your kernel.
The gpio-keys driver does add some benefits for interacting with the buttons from userspace, in particular the transparent handling of debouncing.
Assuming you are using the gpio-keys driver, monitoring the Overo button events is done through the character device interface /dev/input/by-path/platform-gpio-keys-event
If you are interested in how it works, you'll find the character device portion of the driver in your kernel source files /drivers/input/evdev.c
If you would like to see an exhaustive userland example of what you can do with the evdev interface, refer to the evtest project
There is an OE recipe for the evtest package called 'evtest' that you can use to install on your Gumstix image. Steve Sakoman has some more description as well as an example use of the evtest program : How to Use the Buttons on OMAP Development Boards.
I have a small C example btn-watch which handles the specific case of the two Overo buttons and shows how you might integrate the monitoring of these buttons into your own program.
LEDsThe following LEDs can be found on the Palo35, Palo 43 and Chestnut 43 expansion boards. GPIO21 - Red LED GPIO22 - Blue LED The 2.6.36 and greater board file for the Overos registers a platform device "leds-gpio" for these LEDs. Older kernels used the gpio sysfs interface for these buttons. You can find some description of that here Gumstix GPIO. This leds-gpio driver registration is conditional based the kernel configuration parameter CONFIG_LEDS_GPIO. If you want the old behavior back for operating the LEDs through the /sys/class/gpio interface then disable this parameter and rebuild your kernel.
Steve Sakoman has a good explanation of the /sys/class/leds interface How to Customize Use of the LEDs on OMAP Development Boards.
Todo : Add a C example for embedding in a user program.
|
Gumstix Buttons and LEDs