« Return to Thread: GPIO programming and Interrupts

GPIO programming and Interrupts

by cruizbugs :: Rate this Message:

Reply to Author | View in Thread

Hi, I have a few questions.

I have a task to make my gumstix to control a switch.

So, I am using a GPIO 28 to control the external device.
I understand that I can use
# echo "GPIO out set" > /proc/gpio/GPIO28
# echo "GPIO out clear" > /proc/gpio/GPIO28
to control the pin output manually, but what I have to do is to make an automatic on-off.
meaning,
I will have to read from a .txt file that contains all the day and time to on/off.
this text file will turn on-off the switch every few minutes, i.e.
Monday 01:00 am ON
Monday 01:02 am OFF
Monday 01:05 am ON
Monday 01:59 am OFF
etc..

So, regarding this task and since i'm still new to linux,
1. i was thinking what programming language I should use? C or C++ ? which one easier?

2. i found this http://docwiki.gumstix.org/index.php/Sample_code/C/gpregs
how to run this file ? does this work for verdex pro XL6P ? i'm using GPIO on consoleLCD16

3. Is there any idea on how to do this effectively?
I was being told to try to use interrupt, for example, for every minute i will receive an interrupt, then i will read the list of the timing and check out if I have to on or off the switch.
but the problem is, how to set this kind of interrupt? i heard about kernel programming, but i'm still quite lost here.
or is there any other better way to do this task?
I saw http://docwiki.gumstix.org/GPIO_event , but i dont think this is related to what I have to do, right ??

sorry I ask alot.
Thanks you in advance



 « Return to Thread: GPIO programming and Interrupts