Hi everybody,
I am thinking about my project with Q2686H/ Q2687. I intend to use matrix keyboard and parallel LCD (which is common and easy to use) to connect to GPIOs. I want to make the Development Kit become a mobile with basic functions like: send sms, call …But now I am confused with the first step: I used GPIO_19 for output, GPIO_21 for input. My idea is when input change from low to high the output must change immediately following. But it seems not easy as I thought. When I change the input by connect/disconnect it from the 3V DC point, nothing happens to the output until I use AT+CFUN=1 command to reset modem after changing the input.
Here my code , firmware C61b, OS 4.11.0
#include "adl_global.h"
const u16 wm_apmCustomStackSize = 1024;
const adl_ioConfig_t MyGpioConfig1[1]={{ADL_IO_Q2686_GPIO_19,0,ADL_IO_OUTPUT,ADL_IO_LOW}};
const adl_ioConfig_t MyGpioConfig2[1]={{ADL_IO_Q2686_GPIO_21,0,ADL_IO_INPUT}};
s32 MyGpioHandle1;
s32 MyGpioHandle2;
void HelloWorld_TimerHandler ( u8 ID )
{
s32 ReadValue;
/* Hello World */
TRACE (( 1, "Embedded : Hello World " ));
MyGpioHandle1=adl_ioSubscribe (1, MyGpioConfig1,0,0,0);
MyGpioHandle2=adl_ioSubscribe (1, MyGpioConfig2,0,0,0);
ReadValue=adl_ioReadSingle (MyGpioHandle2,ADL_IO_Q2686_GPIO_21);
if(ReadValue==1)
{
MyGpioHandle1=adl_ioSubscribe (1, MyGpioConfig1,0,0,0);
adl_ioWriteSingle (MyGpioHandle1,ADL_IO_Q2686_GPIO_19,ADL_IO_HIGH);
}
else if (ReadValue==0)
{
MyGpioHandle1=adl_ioSubscribe (1, MyGpioConfig1,0,0,0);
adl_ioWriteSingle (MyGpioHandle1,ADL_IO_Q2686_GPIO_19,ADL_IO_LOW);
}
adl_ioUnsubscribe (MyGpioHandle2);
}
void adl_main ( adl_InitType_e InitType )
{
TRACE (( 1, "Embedded : Appli Init" ));
/* Set 1s cyclic timer */
adl_tmrSubscribe ( TRUE, 10, ADL_TMR_TYPE_100MS, HelloWorld_TimerHandler );
}
I know that something wrong, I have tried many other ways. But nothing better.
Please help me! Is my project possible? Thanks a lot for all suggestions!