GPIO control dependant


#1

i have a supreme 10 with both GPIO’s hooked up to LEDs
I use the following code below

#include "adl_global.h"

const u16 wm_apmCustomStackSize = 1024;

s32 MyGpioHandle1;
s32 MyGpioHandle2;

adl_ioDefs_t MyGpioConfig1 [ 1 ] = { ADL_IO_GPIO | 21 | ADL_IO_DIR_OUT };
adl_ioDefs_t MyGpioConfig2 [ 1 ] = { ADL_IO_GPIO | 25 | ADL_IO_DIR_OUT };
adl_ioDefs_t Gpio_to_write1 = ADL_IO_GPIO | 21 ;
adl_ioDefs_t Gpio_to_write2 = ADL_IO_GPIO | 25 ;

void adl_main(adl_InitType_e adlInitType)
{

    MyGpioHandle1 = adl_ioSubscribe ( 1, MyGpioConfig1, 0, 0, 0 );
    MyGpioHandle2 = adl_ioSubscribe ( 1, MyGpioConfig2, 0, 0, 0 );
    
    adl_ioWriteSingle ( MyGpioHandle2, &Gpio_to_write2, 0);
    adl_ioWriteSingle ( MyGpioHandle2, &Gpio_to_write2, 1);

    adl_ioWriteSingle ( MyGpioHandle1, &Gpio_to_write1, 0);
    adl_ioWriteSingle ( MyGpioHandle1, &Gpio_to_write1, 1);   
}

The LEDs are all high when i run the program…however if i comment out this only

adl_ioWriteSingle ( MyGpioHandle1, &Gpio_to_write1, 0);
adl_ioWriteSingle ( MyGpioHandle1, &Gpio_to_write1, 1);

Then one of the LEDs turn low (the other stays high), and if i comment out this only

adl_ioWriteSingle ( MyGpioHandle2, &Gpio_to_write2, 0);
adl_ioWriteSingle ( MyGpioHandle2, &Gpio_to_write2, 1);

Then the other LED turns low, (the other stays high).

Is it possible to turn both outputs low?


#2

I think the code is behaving exactly as you have written it!

Sets the GPIO to zero, and then immediately sets it to ‘1’; this will be far too quick for you to see on a LED, so you might just as well have written:

Which clearly leaves both the GPIOs at ‘1’ 8)


#3

well nope, it seems that when i power on the modem the LEDs are on by default

So if i set them to 0 or 1 at start, it doesnt work

I have to do this, in order to drive the pins low

adl_ioWriteSingle ( MyGpioHandle2, &Gpio_to_write2, 0);
    adl_ioWriteSingle ( MyGpioHandle2, &Gpio_to_write2, 1);