Hello,
I am using Q2686 and OS 6.61. I am trying to subscribe GPIO but it is giving following error.
ADL_RET_ERR_ALREADY_SUBSCRIBED.
Please look at the following code:
s32 GPIO19_hdl;
adl_ioConfig_t GpioConfig[2];
-
-
void adl_main ( adl_InitType_e InitType )
{
TRACE (( 1, “Embedded Application : Main” ));
// TO DO : Add your initialization code here
/* This GPIO is not multiplexed*/
GpioConfig[1].eLabel.Q2686_Label = ADL_IO_Q2686_GPIO_26;
GpioConfig[1].eDirection = ADL_IO_INPUT;
GpioConfig[1].eState = ADL_IO_LOW;
In the supplied code example you are trying to subscribe to GPIO26 which is multiplexed with SCL.
Aside from that I find the code hard to read.
If you only want to subscribe to one gpio, don’t use an array like you do.
Also, adl_ioSubscribe in OS6.61 is defined as
s32 adl_ioSubscribe ( u32 GpioNb, adl_ioConfig_t * GpioConfig, u8 PollingTimerType, u32 PollingTime, s32 GpioEventHandle );
GpioNb is the number of GPIO you are trying to allocate and not the size of the struct.
This is also shown in the example in the ADL User Guide. I believe the “basic” API is different in that respect, so if you have previously used that, please read the ADL documentation and examples