Wednesday, April 27, 2016

Ditect User button, STM32f429 + uClinux.

STM32f429 Discovery board has one user button(User button is blue, black is reset), but  the button is not existing source.
Button configurations add to source ~/stm32f429-linux-builder/uclinux/arch/arm/mach-stm32/iomux.c.

You can detect user button state from STM32f429 dicovery board.

Added code:
/* PA01 = USER Button1 */
gpio_dsc.port = 0;
gpio_dsc.pin  = 0;
stm32f2_gpio_config(&gpio_dsc, STM32F2_GPIO_ROLE_IN);


Using example:
# echo 0 > /sys/class/gpio/export
# echo in > /sys/class/gpio/gpio0/direction

# cat /sys/class/gpio/gpio0/value
1 or 0  <-- Button state

No comments:

Post a Comment