These days I've made a project for my FriendlyARM 7" board.
It demonstrates RS232 data transmission/reception and access to the GPIO pins. To test the serial port I used a serial-to-usb cable. The project seems to work as intended so I decided to share it:
It can be used as starting point for learning. The code may be modified and used freely without any waranty.
The whole working folder is included in the archive. Here are the files:
stivlib.pro - the Project file. This is a text file. Source and header files are described in it. If new files have to be added to the project they must be described in this file
stivlib.png - image file used for icone of the desktop launcher
stivlib.desktop - text file. This is the desktop launcher.
stivlib - binary file. Compiled execteable.
In the previous post was described how to upload these files to the board.
serialport.h serialport.cpp - SerialPort class. It allows sending and recieving serial data and also control of RTS,CTS,DSR,DTR,DCD and RI pins.
gpio.h gpio.cpp - GPIO class. Each instance of this class controls one pin of the GPIO header. Refer to the documentation for the pin functions. For example pin 31 controls the buzzer.
MainWindow.ui - xml file generated by Qt Creator. May be modified with text editor.
MainWindow.h MainWindow.cpp - here is defined the class of the main form dialog frmMainWindow. Connection between the SIGNALS and SLOTS are implemented here. These files are automaticaly generated with formuic script. Do not modify them.
MainWindowImp.h MainWindowImp.cpp - In these files frmMainWindowImplementation class inherits frmMainWindow. The functionalyty of the application is implemented in this class.
main.cpp - it contains macroses for generating the application.
formuic - this script runs uic - user interface compiler. This script should be run each time modifications to MainForm.ui are made. New MainWindow.h MainWindow.cpp will be generated
build - this script runs the compiler and bilds the application
Makefile - the Mkefile is automaticaly generated. Do not modify it.
To have access to the GPIO the driver must be included to the linux kernel.
This is a link to compiled image with included drivers for GPIO and SPI. I have not tested the SPI yet. It's for 7" display!
Great thanks to Eric Brombaugh for his page which helped me to compile and upload the kernel.