GPIO platform configuration module

Hello All,.

I am trying to connect an LED to the GPIO pins for a simple blinking operation .
. I went through the code for the GPIO configuration .

I wanted to know as what all the changes has to be done in platform specific .
How it should be done.

Can anyone post a sample code for platform adaptation layer for WP7104 -G module .

Regards
Shru

I assume that you use Legato. Since Legato is running Linux you could use normal file operations for handling the different GPIO:s. Below you can find an example that export the GPIO6 and set direction to output. Note that if you use a the dev kit for WP7104 there is a mismatch between the labels for the pins on the board and the actual GPIO name.
GPIO6 of the WP7104 is actuallt labelled GPIO11 on the dev kit, see PTS for WP7104 and dev kit.

void init_gpio()
{
	LE_INFO("Enter init_gpio");
	if (le_dir_IsDir("/sys/class/gpio/gpio6"))
	{
		LE_DEBUG("Gpio already initialized");
		return;
	}
	int fd = open("/sys/class/gpio/export", O_WRONLY);
	if (fd < 0)
	{
		LE_DEBUG("Failed to open gpio export\n");
		return;
	}
	else
	{
		LE_DEBUG("gpio export opened\n");
	}
	write(fd, "6",1);
	close(fd);

	fd = open("/sys/class/gpio/gpio6/direction", O_WRONLY);
	if (fd < 0)
	{
		LE_DEBUG("Failed to open gpio6 direction\n");
		return;
	}
	else
	{
		LE_DEBUG("gpio6 direction opened\n");
	}
	write(fd, "out",3);
	close(fd);


}

Probably not a good assumption - as this is the Open AT Application Framework section of the forum :exclamation:

But that is not an Open-AT module :exclamation: