HI,i’m using a Q64 module and i must set up 2 pin, 1 IN / 1 OUT.I have realized this example making reference to Q64/WMP100 signals matching table.
#include "adl_global.h"
#define GPIO_OUTPUT_PIN 19
#define GPIO_INPUT_PIN 21
// GPIO service handle
static s32 MyGPIOHandle_OUT;
static s32 MyGPIOHandle_IN;
s32 ReadValue;
adl_ioDefs_t GpioConfig_OUT = ADL_IO_GPIO | GPIO_OUTPUT_PIN | ADL_IO_DIR_OUT;
adl_ioDefs_t GpioConfig_IN = ADL_IO_GPIO | GPIO_INPUT_PIN | ADL_IO_DIR_IN;
const u16 wm_apmCustomStackSize = 1024*3;
s32 MyGpioEventHandle;
void MyGpioEventHandler ( s32 GpioHandle, adl_ioEvent_e Event, u32 Size, void * Param ){
s32 ReadValue_IN;
s32 ReadValue_OUT;
TRACE (( 1, "EVENT" ));
// Check event
switch ( Event ){
case ADL_IO_EVENT_INPUT_CHANGED :
//...
}
}
// *** MAIN *** //
void adl_main ( adl_InitType_e InitType ){
adl_ioWriteSingle ( MyGPIOHandle_OUT, &GpioConfig_OUT, FALSE );
adl_ioWriteSingle ( MyGPIOHandle_IN, &GpioConfig_IN, TRUE );
ReadValue = adl_ioReadSingle (MyGPIOHandle_IN, &GpioConfig_IN);
TRACE (( 1, "PIN IN : %d",ReadValue ));
MyGpioEventHandle = adl_ioEventSubscribe (MyGpioEventHandler);
MyGPIOHandle_OUT = adl_ioSubscribe ( 1, &GpioConfig_OUT, 0, 0, 0 );
TRACE (( 1, "GPIO (%d): %d", GPIO_OUTPUT_PIN, &GpioConfig_OUT ));
ReadValue = adl_ioReadSingle (MyGPIOHandle_IN, &GpioConfig_IN);
TRACE (( 1, "PIN IN : %d",ReadValue ));
MyGPIOHandle_IN = adl_ioSubscribe ( 1, &GpioConfig_IN, 1, 1, MyGpioEventHandle );
TRACE (( 1, "GPIO (%d): %d", GPIO_INPUT_PIN, &GpioConfig_OUT ));
ReadValue = adl_ioReadSingle (MyGPIOHandle_IN, &GpioConfig_IN);
TRACE (( 1, "PIN IN : %d",ReadValue ));
}
In these conditions ReadValue = -3 (ADL_RET_ERR_UNKNOWN_HDL)…
Instead if use command At+wiom=1, " GPIO19" , 1.1 for example,no problem…
if I try to change pin
#define GPIO_OUTPUT_PIN 3
#define GPIO_INPUT_PIN 16
ReadValue = 0 !!! but i have not more the matching of the pin…
Help
Regards