I am trying to get GPIO pins to trigger events on the FXT009 (at the moment its a trace saying pin was triggered).
have cut’n’pasted code from in the tutorial chapter 18 but it is not doing what it should… i have wired buttons to the GPIO wires (10k pull-down with button on top) but when i press them the event handler is not called?? vref is wired to the 13v supply, as are the “tops” of the buttons.
//define IO pins on GPIO 21 and 25
adl_ioDefs_t MyGpioConfig[2] = {ADL_IO_GPIO | 21 | ADL_IO_DIR_IN, ADL_IO_GPIO | 25 | ADL_IO_DIR_IN};
void main_task(void) {
//subscribe to IO change events
ioEventHandle = adl_ioEventSubscribe(gpioEventHandler);
//subscribe 2 GPIO, polling every 0.1 seconds and input changes are directed to ioeventhandle
myGpioHandle = adl_ioSubscribe(2, MyGpioConfig, ADL_TMR_TYPE_100MS, 1, ioEventHandle);
}
secondary to that, I want to tell which pin triggered it but the only method I have found is pretty ugly, is there a simpler way?
//event handler when GPIO pins change
void gpioEventHandler ( s32 GpioHandle, adl_ioEvent_e Event, u32 Size, void * Param )
{
if (( ADL_IO_TYPE_MSK & ((adl_ioDefs_t *)Param)[ 0 ] ) && ADL_IO_GPO )
TRACE (( 1, "GPIO %d new value: %d", (((adl_ioDefs_t *)Param)[ 0 ] ) & ADL_IO_NUM_MSK ,
((((adl_ioDefs_t *)Param)[ 0 ]) & ADL_IO_LEV_MSK ) & ADL_IO_LEV_HIGH ));
...
...
the documentation says that adl_ioreadsingle() has been deprecated but suggests no alternative, and adl_ioread says the values are updated in the “GpioArray” parameter but i can’t tell what that is actually referring to because that is the only mention of it anywhere in the entire help file (i searched it).
probably noob questions, sorry about that.