IO handler problem


#1

Hello!
I have a problem with GPIO handler.
It works only once?!
I use GPIO24 as input.
Here is my code:

[b]#define GPIO_COUNT_AC 1

const adl_ioConfig_t MyGpioConfig[GPIO_COUNT_AC]=
{{ADL_IO_Q2686_GPIO_24, 0, ADL_IO_INPUT}};

//Event handle
s32 MyGpioEventHandle;

//Gpio handles
s32 MyGpioHandle;
s32 MyGpioHandle2;

//Gpio event handler
void MyGpioEventHandler(s32 GpioHandle, adl_ioEvent_e Event, u32 Size, void * Param)
{
switch(Event)
{
case ADL_IO_EVENT_INPUT_CHANGED:
{
adl_atSendResponsePort(ADL_AT_RSP, ADL_PORT_UART1, “\r\n+INPUT CHANGE\r\n”);
((adl_ioRead_t *)Param)[0].eLabel;
((adl_ioRead_t *)Param)[0].eState;
adl_ioReadSingle(GpioHandle, ADL_IO_Q2686_GPIO_24);
}
break;
}
}

//Main function
//Subscribe to GPIO event service
MyGpioEventHandle=adl_ioEventSubscribe(MyGpioEventHandler);
MyGpioHandle2=adl_ioSubscribe(GPIO_COUNT_AC, MyGpioConfig, ADL_TMR_TYPE_100MS, 1, MyGpioEventHandle);[/b]
Thank you!


#2

i have the same problem .


#3

ok it works.i read bad label.


#4

hi, the code shown below is getting terminated while running in RTE mode…
in target mode its not going to the handler itself.
is there anything wrong in this code.

#include “adl_global.h”
const u16 wm_apmCustomStackSize = 1024;

// Gpio Event Handle
s32 MyGpioEventHandle;

// Gpio Handles
s32 MyGpioHandle1;

u8 ReadValue;
u32 My_Gpio_Label1 [ 1 ] = { 30 };

adl_ioDefs_t MyGpioConfig1[1] = { ADL_IO_GPIO | 30 | ADL_IO_DIR_IN | ADL_IO_LEV_HIGH };

void MyGpioEventHandler ( s32 GpioHandle, adl_ioEvent_e Event, u32 Size, void * Param )
{
TRACE (( 1, " In MyGpioEventHandler" ));
switch ( Event )
{
case ADL_IO_EVENT_INPUT_CHANGED :
{
TRACE (( 1, “ADL_IO_EVENT_INPUT_CHANGED” ));
ReadValue = adl_ioReadSingle (MyGpioHandle1, ADL_IO_GPIO | My_Gpio_Label1 [ 0 ] );
TRACE (( 1, “%d”, ReadValue));
//ReadValue = adl_ioRead (MyGpioHandle1, 1, ADL_IO_GPIO | 30 | ADL_IO_LEV_HIGH );
//TRACE (( 1, “%d”, ReadValue));
}
break;
}
}

void adl_main ( adl_InitType_e InitType )
{
TRACE (( 1, “Embedded Application : Main” ));
MyGpioEventHandle = adl_ioEventSubscribe( MyGpioEventHandler );
MyGpioHandle1 = adl_ioSubscribe ( 1, MyGpioConfig1, ADL_TMR_TYPE_100MS, 1, MyGpioEventHandle );
}

thank you
Aghil


#5

hi,
in the eg program in adl_gpio.h there is a mistake, in adl_ioReadSingle func.
its given as adl_ioReadSingle (MyGpioHandle1, ADL_IO_GPIO | My_Gpio_Label1 [ 1 ] );
but the 2nd argument is a pointer, this will u error.

Instead use this,

adl_ioDefs_t MyGpioConfig1[1] = { ADL_IO_GPIO | 30 | ADL_IO_DIR_IN | ADL_IO_LEV_HIGH };

// In the MyGpioEventHandler
adl_ioReadSingle (MyGpioHandle1, &MyGpioConfig1 );

This will definetly work fine.

Thank You
Aghil