Control gpio in c + + Qt creator for arm mini2440

Jeffrey Torres
hello my name is jeffrey  and need to make a graphical interface to control
a digital potentiometer MCP41010 
http://ww1.microchip.com/downloads/en/devicedoc/11195c.pdf

but so far I could not find how to control this port from simple gui
aplication in Qt creator, someone can help me is of the utmost urgency

davef
This is a SPI controlled device.  Getting SPI to work on the mini2440 is a
moderately difficult task.  

Integrating that with a Qt application is probably a bigger job.

Which kernel have you decided to start with?  Do you know how to
cross-compile kernels after you have ticked the right boxes in
kernelconfig?

jeffrey torres
GPIO I HAVE ACTIVATED MY CARD, BUT I NEED TO WORK IN A GRAPHIC INTERFACE
THAT YOU CAN HANDLE ME BUT I HAVE NOT BEEN ABLE TO BUILD. I CAN ONLY BE
HANDLED THROUGH COMMANDS IN TERMINAL UBUNTU .. FOR EXAMPLE ..

[root@FriendlyARM /]#cd sys/class/gpio
[root@FriendlyARM gpio]#echo 160  > export
[root@FriendlyARM gpio]#echo "high" > gpio160/direction
[root@FriendlyARM gpio]#echo "low" > gpio160/direction

AND NO PLACE LIKE THESE COMMANDS IN AN APPLICATION OF QT CREATOR.

Anyone know?

davef
Well, you have to write these userspace commands into a Qt project.  Maybe
this helps

http://mini2440vietnam.blogspot.co.nz/2011/05/programming-application-fo...

specifically this one:

http://mini2440vietnam.blogspot.co.nz/2012/06/control-leds-on-mini2440-b...

davef
Appears he use kernel calls, however there should be other tutorials out
there on doing it from userspace, if you want to.

jeffrey torres
thanks for the links and I have worked and as such the designs and run in
the arm2440 me but what I need is to be able to address in the code. cpp
activation of GPIO ... as for example in this project:

http://qt.electronics.cat/mini6410/mini6410_004.html


the path is: system("./root/Applications/electronics.cat/proves/gpk8_13w 0
0");

davef
Looks like a well-constructed example.

All you have to do is port the code to the mini2440, ie to one of the
available GPIO on the GPIO connector (port G?).

I don't know if this need changing:

#define MAP_SIZE 4096UL
#define MAP_MASK (MAP_SIZE - 1)

Good luck!

jeffrey torres
is there any issue with this code is for a arm6410 and not for arm2440, I
say this because this code handles other different com to com4

davef
Yes, there will be issues ... that is what porting code to another bit of
hardware involves.

Where is com4 mentioned?

As the code is written for cross-compiled for ARM Linux I'd be surprised if
there were references to COM ports.

Juergen Beisert
Jeffrey,

what is the problem to use open(), write(), close() in your Qt application
on the "/sys/class/gpio" file entries? The 'echo' shell command is doing
the same when you run it.

Reggie
https://gitorious.org/mini2440-qt-gpio-library

I have nothing else to say, apart from google is very useful for this kind
of thing.

jeffrey torres
thank you all for your comments, I will try to spread the plication in Qt
with this information.

jeffrey torres
any chance someone has an example like this Qt application?

http://www.youtube.com/watch?v=NxD-PbCk8Pc
http://www.youtube.com/watch?v=4M3W7iTIN_8

Reggie
click on the source tree button in the link I posted, there is a project
setup by the looks of things.  I have zero experience with qt so I can't
advise further.  I'm guessing you've got to compile it as a qt app.  the
build_arm file appears to be a script to do the compilation for you, I'm
guessing you've just got to put those libs/includes in teh right place.

jeffrey torres
ok,thanks Reggie!!