I've added some code to the i2s_interrupt_record_playback example, to read from the USER GPIO pin.
Unfortunately, it always reads 0.
The gpio_led_output example works fine, after modifying the code to use the USER GPIO pin.
Code attached, here are the modifications to the end of main() :
gpio_pin_config_t usr_gpio_config = {
kGPIO_DigitalInput,
0,
};
GPIO_PinInit(GPIO, BOARD_SW3_GPIO_PORT, BOARD_SW3_GPIO_PIN, &usr_gpio_config);
PRINTF("Press USER button to print message\r\n");
int pinState = GPIO_PinRead(GPIO, BOARD_SW3_GPIO_PORT, BOARD_SW3_GPIO_PIN);
PRINTF("pinState: %x\r\n",pinState);
while (1)
{
pinState = GPIO_PinRead(GPIO, BOARD_SW3_GPIO_PORT, BOARD_SW3_GPIO_PIN);
if (pinState) {
pinState = GPIO_PinRead(GPIO, BOARD_SW3_GPIO_PORT, BOARD_SW3_GPIO_PIN);
PRINTF("pinState: %x\r\n",pinState);
}
}
I'm guessing that I need to add some additional initialization code but I'm running out of things to try.
If anyone knows how to get the GPIO working then I'd appreciate the suggestions.
Thanks very much and best regards,
John
It turns out the solution is easy when you find it ;-)
The GPIO issue was the port mapping.
Once I mapped PIO_5 to GPIO, in the pin config tool (In MCUXpresso), then USER (GPIO3) worked fine.
There's clearly a lot I need to learn :-)
John