Hi!
How to change settings (input or output) of one gpio, based on some event
This is why im asking this:
s8 GpioHandle;
u8 gpio18=0;
//-----------------------------------------------------------
void gpioTmrHandler ( u8 ID ){
adl_ioWriteSingle(GpioHandle, ADL_IO_Q2686_GPIO_18, ADL_IO_HIGH);
}
void setGpioInput (void){
TRACE (( 3, "GPIO = INPUT" ));
GpioHandle = adl_ioSubscribe (ADL_IO_Q2686_GPIO_18,1,0,0,(adl_ioHdlr_f)NULL); // input
adl_tmrSubscribe ( TRUE, 10, ADL_TMR_TYPE_100MS, gpioTmrHandler );
}
void setGpioOutput (void){
TRACE (( 3, "GPIO = OUTPUT" ));
GpioHandle = adl_ioSubscribe (ADL_IO_Q2686_GPIO_18,0,0,0,(adl_ioHdlr_f)NULL); // output
adl_tmrSubscribe ( TRUE, 10, ADL_TMR_TYPE_100MS, gpioTmrHandler );
}
If the hangup event is called i call setGpioOutput and if ring voice is detected then im calling setGpioInput.
My “problem” is that im using the same pin to change the state of the pin but as output a get bunch of weird things.
This is the output from emulator ( not from trace ):
dü˙˙˙ţ˙˙˙äĄ!ż!{ŕiď7!ŕiÔC˙ţýe{ŕiď7!ŕiÔCď7&e
{ŕiď7!ŕiÔC…@%ď7!@%â€Fď7!Single Write %d : %dü˙˙˙ţ˙˙˙äĄ!ż!d ţ’%dü˙˙˙ţ˙˙˙äĄ!ż!Si7@%ď7!@%ÔC˙ţ5DL] Gpio Single Write %d : %dü˙˙˙ţ˙˙˙äĄ!ż!Si7ÔC oŹĄ!ż!Si7{@%ď7!@%ÔC˙ţ5Single Write %d : %dü˙˙˙ţ˙˙˙äĄ!ż!ď7 ˙˙äĄ!ż!4Xa
and from trace :
Trace 4 GPIO = OUTPUT
Trace 23 [ADL] Gpio Single Write -2 : -2
Trace 23 [ADL] Gpio Single Write -2 : -2
Trace 23 [ADL] Gpio Single Write -2 : -2
Trace 20 [ADL] tmr unsubs ; id 9 ; hdlr 002102A5 (rem. time : 3)
Trace 1 Unable to find the string of the remote trace in the file (ID = 870172)
Trace 23 [ADL] Gpio subs 20 0 : -4
Trace 20 [ADL] tmr subs ; id 10 ; hdlr 002101A5 ; val 10 ; cycl 1
Trace 4 GPIO = INPUT
Trace 26 SMS send : -2
Trace 23 [ADL] Gpio Single Write -4 : -2
Trace 23 [ADL] Gpio Single Write -4 : -2
Trace 23 [ADL] Gpio Single Write -4 : -2
Trace 23 [ADL] Gpio Single Write -4 : -2
OK. Wrong declaration and already subscribed.
I dont know, maybe i have set the wrong declaration but it looks ok to me.
Beside this, im using pin 18 and this pin is not multiplexed.
How would you declare or call the same gpio setting, to get the same effect?