GPIO platform configuration module

ADL, A&D memory, Flash objects, multi-tasking, file system, DOTA.

GPIO platform configuration module

Postby shruthipawar » Sat May 23, 2015 10:35 am

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
shruthipawar
 
Posts: 34
Joined: Mon Mar 09, 2015 10:40 pm
Has thanked: 2 times
Have thanks: 0 time

Re: GPIO platform configuration module

Postby krima919 » Mon May 25, 2015 12:20 pm

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.

Code: Select all
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);


}
krima919
 
Posts: 147
Joined: Mon Dec 03, 2012 11:25 pm
Location: Sweden
Has thanked: 2 times
Have thanks: 33 times

Re: GPIO platform configuration module

Postby awneil » Mon May 25, 2015 5:36 pm

krima919 wrote:I assume that you use Legato

Probably not a good assumption - as this is the Open AT Application Framework section of the forum :!:
When I say "SiWi", that's short for "Sierra Wireless".
User avatar
awneil
 
Posts: 6634
Joined: Mon Dec 03, 2007 1:18 pm
Location: Basingstoke, UK
Has thanked: 54 times
Have thanks: 88 times

Re: GPIO platform configuration module

Postby awneil » Mon May 25, 2015 9:40 pm

I wrote:this is the Open AT Application Framework section of the forum :!:

shruthipawar wrote: WP7104 -G module

But that is not an Open-AT module :!:
When I say "SiWi", that's short for "Sierra Wireless".
User avatar
awneil
 
Posts: 6634
Joined: Mon Dec 03, 2007 1:18 pm
Location: Basingstoke, UK
Has thanked: 54 times
Have thanks: 88 times


Return to Operating system

Who is online

Users browsing this forum: No registered users and 3 guests