Re: GPIO FRDM_K64F
The frdm_k64f board supports the Zephyr gpio.h interface with 5 instances of the gpio_mcux.c device driver, which correspond to the 5 gpio ports on the k64 SoC (GPIOA, GPIOB, …, GPIOE). So, first you need to use the board schematic to determine which port and pin you want to use. For example, on frdm_k64f the SW2/INT1 button is routed to the PTC6 SoC pin, which is PORTC/GPIOC pin 6. There are some helper macros in boards/arm/frdm_k64f/board.h for the buttons and LEDs:
/* Push button switch 2 */
#define SW2_GPIO_NAME CONFIG_GPIO_MCUX_PORTC_NAME
#define SW2_GPIO_PIN 6
A good example to start with is samples/basic/button, which uses a falling edge gpio interrupt. The gpio driver also supports rising edge and both edges.
Another more complicated example that uses a sensor interrupt is samples/sensor/fxos8700 (and consequently drivers/sensors/fxos8700/fxos8700_trigger.c, which does all the gpio setup and handling).
You should also take a look at boards/arm/frdm_k64f/pinmux.c to check if the pin you want to use has been muxed as a gpio. If not, you’ll need to add it there or somewhere in your application.
From: zephyr-devel-bounces@... [mailto:zephyr-devel-bounces@...] On Behalf Of Tomasz Bursztyka
Sent: Wednesday, July 05, 2017 3:51 AM
Subject: Re: [Zephyr-devel] GPIO FRDM_K64F