EasyManua.ls Logo

Phytec phyFLEX-i.MX 6 - Modifying the Demo Application

Default Icon
85 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
phyFLEX
®
-i.MX 6
22
PHYTEC Messtechnik GmbH 2015 L-781e_7
3.1.3 Modifying the Demo Application
Now we will extend the myHelloWorld application. The extended myHelloWorld application
will write an output to the first serial interface as well as to the standard output.
Open Eclipse if it is not opened yet.
Double-click HelloWorld.c in the myHelloWorld project.
First include the following two additional header files:
#include<unistd.h>
#include<fcntl.h>
Then add the function write_tty(), which writes n bytes to the first serial interface
(which, on the phyFLEX-i.MX6, is connected to the system console /dev/console):
voidwrite_tty(char*buffer,intcount)
{
intout,
out=open("/dev/console",O_RDWR),
write(out,buffer,count),
close(out),
}
Enter the following two lines in the main() function to declare the buffer and call the
write_tty() function:
charbuf[]={"WelcometotheWorldofPHYTEC!(serial)\n"},
write_tty(buf,sizeof(buf)‐1),
In the next screenshot you can see the complete program.

Table of Contents

Other manuals for Phytec phyFLEX-i.MX 6