Gpios and adc

Hello, I am using OAT 3.02 O.S:6.51 and adl library. And as a begineer I am very puzzled about GPIOS and I have not found anything about ADC management. I am working with the Developers Kit and it has being very difficult to me to find the corresponding GPIO on the board according to the GPIO Mask mentioned on the documentation, the same goes for ADC pins.

I would be very pleased if someone can help on this and better yet if there are documents or examples I can refer to.

Thanks in advance,

Camilo Moreno

Hi Camilo,

First, you have to find a GPIO which is not used for something else.
I’m using a Q2686 and I choose the GPIO19 in my example.
If you want to change the state of the GPIO19 pin, you must know the name of this GPIO in the ADL library (see GPIO service in ADL User Guide) : ADL_IO_Q2686_GPIO_19

The code bellow changes the state of the GPIO19 pin every second.

/* handles */
s32		GpioHandle; 

adl_ioConfig_t Gpio19Config [1] = {{ ADL_IO_Q2686_GPIO_19, 0, ADL_IO_OUTPUT, ADL_IO_HIGH }};
u8		Gpio19=0;

void Gpio19_TimerHandler ( u8 ID )
{
	/*
	s32 adl_ioWriteSingle ( s32 GpioHandle,
	u32 Gpio,
	u32 State );
	*/
	if(Gpio19 == 0)
	{
		TRACE (( 3, "PIN 19 HIGH" ));
		adl_ioWriteSingle(GpioHandle, ADL_IO_Q2686_GPIO_19, ADL_IO_HIGH);
		Gpio19=1;
	}else{
		TRACE (( 3, "PIN 19 LOW" ));
		Gpio19 = 0;
		adl_ioWriteSingle(GpioHandle, ADL_IO_Q2686_GPIO_19, ADL_IO_LOW);
	}
}

void ConfigureGpio (void)
{
	/*
	s32 adl_ioSubscribe ( u32 GpioNb,
adl_ioConfig_t * GpioConfig,
u8 PollingTimerType,
u32 PollingTime,
s32 GpioEventHandle );
	*/
	GpioHandle = adl_ioSubscribe ( 1, Gpio19Config, 0, 0,	0 );

	adl_tmrSubscribe ( TRUE, 10, ADL_TMR_TYPE_100MS, Gpio19_TimerHandler );

}

For your ADC, I think you must use AT+ADC command to get the values.
See Analog digital converters measurements +ADC in the at_commands_interface for more information.

I hope that it helps you

Regards,

gdt

Thanks a lot gdt.

I also want to know if there is something in the API I can use to control the ADC, how many are they?.

Thanks in advance,

Camilo.

Hi Camilo,

I think that there isn’t api for adc. If you want one, you must write them :wink:

Regards,

gdt