Difference between revisions of "Example io demo UPDATE 2019"
(56 intermediate revisions by the same user not shown) | |||
Line 9: | Line 9: | ||
This demo covers basic GPIO usage for the IPAC single board computer, and 150 and 200 series carrier boards. This demo first cover GPIO manipulation through the Linux terminal and then demonstrates gpio usage in a C program using an io example program. | This demo covers basic GPIO usage for the IPAC single board computer, and 150 and 200 series carrier boards. This demo first cover GPIO manipulation through the Linux terminal and then demonstrates gpio usage in a C program using an io example program. | ||
+ | GPIO control is accomplished through use of the libgpiod driver, as a result only the libgpiod library will be covered in this tutorial. For manipulation of non-GPIO peripherals use sysfs. | ||
+ | |||
+ | |||
===Hardware Requirements=== | ===Hardware Requirements=== | ||
− | |||
To use the '''io demo''' program you will need the following target hardware. | To use the '''io demo''' program you will need the following target hardware. | ||
* An EMAC 150 series carrier board with a compatible SoM <br /> | * An EMAC 150 series carrier board with a compatible SoM <br /> | ||
− | OR <br /> | + | '''OR''' <br /> |
* An EMAC 200 series carrier board with a compatible SoM <br /> | * An EMAC 200 series carrier board with a compatible SoM <br /> | ||
− | OR | + | '''OR''' |
− | * | + | * An IPAC single board computer <br /> |
− | AND | + | '''AND''' |
* additional components to establish to serial and Ethernet connections for your target hardware <br /> | * additional components to establish to serial and Ethernet connections for your target hardware <br /> | ||
Line 33: | Line 35: | ||
== GPIO manipulation through Linux Terminal == | == GPIO manipulation through Linux Terminal == | ||
− | GPIOs can be manipulated directly through the target devices serial terminal. The Libgpiod libary is used for this purpose. Linux terminal commands are defined in the libgpiod github readme and are listed here for convenience: | + | GPIOs can be manipulated directly through the target devices serial terminal. The Libgpiod libary is used for this purpose. Linux terminal commands are defined in the libgpiod github readme (https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/tree) and are listed here for convenience: |
− | |||
− | |||
− | |||
− | |||
− | + | "There are currently six command-line tools available: <br /> | |
− | + | '''gpiodetect''' - list all gpiochips present on the system, their names, labels and number of GPIO lines | |
− | + | '''gpioinfo''' - list all lines of specified gpiochips, their names, consumers, direction, active state and additional flags | |
− | + | '''gpioget''' - read values of specified GPIO lines | |
− | + | '''gpioset''' - set values of specified GPIO lines, potentially keep the lines exported and wait until timeout, user input or signal | |
− | + | '''gpiofind''' - find the gpiochip name and line offset given the line name | |
+ | '''gpiomon''' - wait for events on GPIO lines, specify which events to watch,how many events to process before exiting or if the events should be reported to the console" | ||
+ | In libgpiod ports and pins correspond to gpiochips and lines respectively. GPIO chip numbers are assigned by the kernel, and are hardware depended. | ||
== GPIO manipulation in C == | == GPIO manipulation in C == | ||
A more common manipulation of GPIOs is through a C program. The following example will demonstrated GPIO manipulation using the Libgpiod libary. | A more common manipulation of GPIOs is through a C program. The following example will demonstrated GPIO manipulation using the Libgpiod libary. | ||
− | '''Program Setup''' | + | '''Program Setup''' <br \> |
− | On the target device: | + | |
+ | ''On the target device'': | ||
<cl> | <cl> | ||
− | 1. Login | + | 1. Login, the default username and password is give below: |
− | * Change the file to read write by entering '''oemntrw''' into the device terminal | + | <syntaxhighlight lang="text"> |
− | * Obtain the device IP-address by entering '''ifconfig''' into the terminal. This is needed for device configuration in Qt Creator below. | + | username: root |
+ | password: emac_inc | ||
+ | </syntaxhighlight> | ||
+ | * Change the file to read write by entering '''oemntrw''' into the device terminal. | ||
+ | {{cli | oemntrw | hostname=somimx6ul}} | ||
+ | |||
+ | {{note|This will only change the root filesystem to read-write for the current boot. When the system is rebooted, the root filesystem will once again be mounted read-only.}} | ||
+ | * Obtain the device IP-address by entering '''ifconfig''' into the terminal. This is needed for device configuration in Qt Creator below.<br \> | ||
+ | <syntaxhighlight lang=console highlight=3> | ||
+ | root@emac-oe:~# ifconfig | ||
+ | eth0 Link encap:Ethernet HWaddr 00:50:C2:E6:60:F4 | ||
+ | inet addr:10.0.2.100 Bcast:10.0.255.255 Mask:255.255.0.0 | ||
+ | inet6 addr: fe80::5054:ff:feb1:f83e/64 Scope:Link | ||
+ | UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 | ||
+ | RX packets:1825 errors:0 dropped:0 overruns:0 frame:0 | ||
+ | TX packets:553 errors:0 dropped:0 overruns:0 carrier:0 | ||
+ | collisions:0 txqueuelen:1000 | ||
+ | RX bytes:139124 (135.8 KiB) TX bytes:50603 (49.4 KiB) | ||
+ | Interrupt:25 Base address:0xc000 | ||
+ | |||
+ | lo Link encap:Local Loopback | ||
+ | inet addr:127.0.0.1 Mask:255.0.0.0 | ||
+ | inet6 addr: ::1/128 Scope:Host | ||
+ | UP LOOPBACK RUNNING MTU:16436 Metric:1 | ||
+ | RX packets:0 errors:0 dropped:0 overruns:0 frame:0 | ||
+ | TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 | ||
+ | collisions:0 txqueuelen:0 | ||
+ | RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) | ||
+ | </syntaxhighlight> | ||
</cl> | </cl> | ||
− | < | + | <br /> |
− | On development machine: | + | '''On development machine''': <br /> |
− | + | <ol> | |
− | + | <li>Open Qt Creator</li> <br /> | |
+ | </ol> | ||
+ | '''''Option 1:''''' | ||
+ | |||
+ | <ol start = 2> | ||
+ | <li>Create a qmake project</li> | ||
*select '''+ New Project''' on the 'Welcome' window, the New Project window will appear. | *select '''+ New Project''' on the 'Welcome' window, the New Project window will appear. | ||
*Under Projects select '''Non-Qt Project''', Under the middle window select '''Plain C Application''', Click '''Choose...''', The Location window will appear. | *Under Projects select '''Non-Qt Project''', Under the middle window select '''Plain C Application''', Click '''Choose...''', The Location window will appear. | ||
− | * | + | *Name your project '''LibGPIOd_example''', and choose a Create-in location, Click '''Next >''' to advance to the Build System window. |
− | *On the Build System Window choose | + | *On the Build System Window choose the '''qmake''' option, Click '''Next >''' to advance to the Kits window. |
*On the Kits window check only '''ARM Qt5''', '''Click Next >''' to advance to the Summary window | *On the Kits window check only '''ARM Qt5''', '''Click Next >''' to advance to the Summary window | ||
*The options on the Summary window will default to '''<None>'', Click '''Finish'''. Your Project will now be generated. | *The options on the Summary window will default to '''<None>'', Click '''Finish'''. Your Project will now be generated. | ||
− | + | <li>Modify the qmake the build file ('''project_name.pro''').</li> | |
− | * | + | *Copy and paste the following into your .pro file. |
− | + | <syntaxhighlight lang="text"> | |
− | + | TEMPLATE = app | |
+ | CONFIG += console | ||
+ | CONFIG -= app_bundle | ||
+ | CONFIG -= qt | ||
+ | LIBS += -lgpiod | ||
+ | SOURCES += main.c \ | ||
+ | EMAC_Libgpiod.c | ||
+ | target.path=/home/developer | ||
+ | INSTALLS += target | ||
+ | HEADERS += \ | ||
+ | EMAC_Libgpiod.h | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | <li>Add the EMAC_Libgpiod.h file</li> | ||
*With you project selected, click '''File->New File or Project''', the New File or Project window will appear. | *With you project selected, click '''File->New File or Project''', the New File or Project window will appear. | ||
*Under Files and Classes select General, and in the middle column select '''Empty file''', Click '''Choose...''', The Location window will appear | *Under Files and Classes select General, and in the middle column select '''Empty file''', Click '''Choose...''', The Location window will appear | ||
− | *Name the file ''' | + | *Name the file '''EMAC_Libgpiod.h''' and choose your project location as the path, Click '''Next>''' to advance to the Summary window |
*Click '''Finish''', the file will now open. | *Click '''Finish''', the file will now open. | ||
− | *Copy and paste the | + | *Copy and paste the provided .h file, [http://git.emacinc.com/OE/qt-creator-example-projects/raw/master/libgpiod_io_example/EMAC_Libgpiod.h EMAC_Libgpiod.h] into |
*Save the file, by click '''File->Save All''', the file will now be added to your project under '''Libgpiod_example->Headers''' | *Save the file, by click '''File->Save All''', the file will now be added to your project under '''Libgpiod_example->Headers''' | ||
− | + | <li>Add the EMAC_Libgpiod.c file</li> | |
− | *repeat same steps as for the .h file, but replace the file name enter ''' | + | *repeat same steps as for the .h file, but replace the file name enter '''EMAC_Libgpiod.c''' and Copy and paste the provided [http://git.emacinc.com/OE/qt-creator-example-projects/raw/master/libgpiod_io_example/EMAC_Libgpiod.c EMAC_Libgpiod.c file] |
*select '''File->Save All''' | *select '''File->Save All''' | ||
− | * Open main.c under ''' | + | </ol> |
− | + | '''Option 2:''' | |
+ | <ol start = 2> | ||
+ | <li>Create a cmake project</li> | ||
+ | *select '''+ New Project''' on the 'Welcome' window, the New Project window will appear. | ||
+ | *Under Projects select '''EMAC Project''', Under the middle window select '''EMAC C Project (CMake Build)''', Click '''Choose...''', The Location window will appear. | ||
+ | *Name your project '''LibGPIOd_example''', and choose a Create-in location, Click '''Next >''' to advance to the Summary window. | ||
+ | *The options on the Summary window will default to '''<None>'', Click '''Finish'''. Your Project will now be generated. | ||
+ | *Click on the '''Projects''' tab, select only the '''Arm''' option and click '''Configure Project'''. A CMakeLists.txt file will now be generated under the project. | ||
+ | <li>Add the EMAC_Libgpiod.h file</li> | ||
+ | *Under the project folder right click on '''CMakeLists.txt''' and select '''Show Containing Folder''' to open the project directory. | ||
+ | *Save this [http://git.emacinc.com/OE/qt-creator-example-projects/blob/master/libgpiod_io_example/EMAC_Libgpiod.h EMAC_Libgpiod.h file] to the project directory. Do this in git by right clicking on '''Raw''', selecting '''Save link as...''' and choosing the project directory. | ||
+ | <li>Add the [http://git.emacinc.com/OE/qt-creator-example-projects/blob/master/libgpiod_io_example/EMAC_Libgpiod.c EMAC_Libgpiod.c file] in the same way.</li> | ||
+ | <li>Right click on the project folder and select '''Run CMake''' to add the files to the project.</li> | ||
+ | </ol> | ||
+ | <br /> | ||
+ | |||
+ | '''End of Options, Continuing:'''<br /> | ||
+ | <ol start = 6> | ||
+ | <li>Open main.c under '''LibGPIOd_example->Sources''' and copy and paste the provided [http://git.emacinc.com/OE/qt-creator-example-projects/raw/master/libgpiod_io_example/main.c main.c].</li> | ||
+ | *Note, the program must be configured to run for your target device. In the main.c file select your target device by un-commenting the #define preprocessor directive corresponding to the device '''you're using'''. All other devices should be commented out. For this example we're using a 150ES carrier board so we'll select the '''CARRIER_BOARD_150'''. | ||
+ | |||
+ | <syntaxhighlight lang="c"> | ||
+ | //In main.c | ||
+ | |||
+ | #define CARRIER_BOARD_150 | ||
+ | //#define CARRIER_BOARD_200 | ||
+ | //#define IPAC | ||
+ | |||
+ | </syntaxhighlight> | ||
Similarly, 1 of 4 example programs can be selected to run, example 4 is selected by default, we'll continue with this option. | Similarly, 1 of 4 example programs can be selected to run, example 4 is selected by default, we'll continue with this option. | ||
+ | <syntaxhighlight lang="c"> | ||
+ | //In main.c | ||
+ | |||
+ | //#define EXAMPLE_1 | ||
+ | //#define EXAMPLE_2 | ||
+ | //#define EXAMPLE_3 | ||
+ | #define EXAMPLE_4 | ||
+ | </syntaxhighlight> | ||
+ | |||
*select '''File->Save All''', All necessary files have now been added to the project | *select '''File->Save All''', All necessary files have now been added to the project | ||
− | + | <li>Configure build options</li> | |
*Go to '''Tools->Options...''' to open the options window | *Go to '''Tools->Options...''' to open the options window | ||
*Select Devices in the left hand column to open the Devices tab | *Select Devices in the left hand column to open the Devices tab | ||
Line 109: | Line 193: | ||
|} | |} | ||
− | [[File: | + | [[File:Libgpiod_device_config_12.PNG]] |
<br clear=all> | <br clear=all> | ||
Line 119: | Line 203: | ||
[[File:Device_test.png|600px|left|thumb|Figure 8: Qt Creator Device Test]] | [[File:Device_test.png|600px|left|thumb|Figure 8: Qt Creator Device Test]] | ||
+ | |||
+ | |||
<br clear=all> | <br clear=all> | ||
Line 125: | Line 211: | ||
*Click '''Apply'''. | *Click '''Apply'''. | ||
− | *Now, on the left side of Qt Creator, you will see the project icon, which looks like a monitor. Click this and make sure '''Arm Qt5''' is selected under '''Kit''', '''Release''' is selected under '''Build''', and the project is set to be run on the remote device under '''Run'''. | + | *Click '''OK'''. |
+ | |||
+ | <li>Now, on the left side of Qt Creator, you will see the project icon, which looks like a monitor. Click this and select '''Release''' or '''Debug''' under build.</li> | ||
+ | |||
+ | {{note|If multiple build options were selected three sub-menus will appear ('''Kit, Build''' and '''Run'''). Click this and make sure '''Arm Qt5''' is selected under '''Kit''', '''Release''' is selected under '''Build''', and the project is set to be run on the remote device under '''Run'''. | ||
+ | }} | ||
+ | |||
− | [[File: | + | [[File:Libgpiod_14.PNG|600px|left|thumb]] |
<br clear=all> | <br clear=all> | ||
− | Now, simply press the green play button. The program should run on the target device and yield an output. | + | <li>Now, simply press the green play button. The program should run on the target device and yield an output.</li> |
− | </ | + | </ol> |
+ | == Examples == | ||
+ | As previously stated the main.c program must be configured to run for your target device. In the main.c file select your target device by un-commenting the '''#define''' preprocessor directive corresponding to the device you're using. All other devices should be commented out. | ||
+ | |||
+ | |||
+ | <syntaxhighlight lang="c"> | ||
+ | //In main.c | ||
+ | |||
+ | #define CARRIER_BOARD_150 | ||
+ | //#define CARRIER_BOARD_200 | ||
+ | //#define IPAC | ||
− | + | </syntaxhighlight> | |
− | |||
Similarly, 1 of 4 example programs can be selected to run, un-comment 1 of the "example" '''#define''' preprocessor directives and leave the rest commented out. Changes these options will require rebuilding of the program (Simply press the green play button again, this should automatically rebuild and launch the project on the target device.) | Similarly, 1 of 4 example programs can be selected to run, un-comment 1 of the "example" '''#define''' preprocessor directives and leave the rest commented out. Changes these options will require rebuilding of the program (Simply press the green play button again, this should automatically rebuild and launch the project on the target device.) | ||
+ | <syntaxhighlight lang="c"> | ||
+ | //In main.c | ||
+ | |||
+ | //#define EXAMPLE_1 | ||
+ | //#define EXAMPLE_2 | ||
+ | //#define EXAMPLE_3 | ||
+ | #define EXAMPLE_4 | ||
+ | </syntaxhighlight> | ||
+ | |||
− | All examples use the Libgpiod libary ('''#include <gpiod.h>'''), with example 4 using custom built functions provided in EMAC_Libgpiod.h. <br /> | + | All examples use the Libgpiod libary ('''#include <gpiod.h>'''), with example 4 using custom built functions provided in '''EMAC_Libgpiod.h'''. <br /> |
'''EXAMPLE_1''' demonstrates basic IO configuration using Libgpiod's contextless functions <br /> | '''EXAMPLE_1''' demonstrates basic IO configuration using Libgpiod's contextless functions <br /> |
Latest revision as of 15:28, 19 July 2019
This demo covers basic GPIO usage for the IPAC single board computer, and 150 and 200 series carrier boards. This demo first cover GPIO manipulation through the Linux terminal and then demonstrates gpio usage in a C program using an io example program.
GPIO control is accomplished through use of the libgpiod driver, as a result only the libgpiod library will be covered in this tutorial. For manipulation of non-GPIO peripherals use sysfs.
Contents
Hardware Requirements
To use the io demo program you will need the following target hardware.
- An EMAC 150 series carrier board with a compatible SoM
OR
- An EMAC 200 series carrier board with a compatible SoM
OR
- An IPAC single board computer
AND
- additional components to establish to serial and Ethernet connections for your target hardware
Software Requirments
These tools should already be installed if you installed the EMAC SDK using the automatic installer.
- EMAC OE 5.X SDK
- EMAC Qt Creator
- GNU
make
- CMake
Setup
If you haven't already, please review the EMAC_OE_SDK "getting started" page. EMAC_OE_SDK will need to be installed and serial and network connections will need to be established between the developer machine and the target device.See the Serial Connections or Network Connections page for more information on how to connect to the target EMAC product using a serial port or Ethernet connection.
GPIO manipulation through Linux Terminal
GPIOs can be manipulated directly through the target devices serial terminal. The Libgpiod libary is used for this purpose. Linux terminal commands are defined in the libgpiod github readme (https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/tree) and are listed here for convenience:
"There are currently six command-line tools available:
gpiodetect - list all gpiochips present on the system, their names, labels and number of GPIO lines
gpioinfo - list all lines of specified gpiochips, their names, consumers, direction, active state and additional flags
gpioget - read values of specified GPIO lines
gpioset - set values of specified GPIO lines, potentially keep the lines exported and wait until timeout, user input or signal
gpiofind - find the gpiochip name and line offset given the line name
gpiomon - wait for events on GPIO lines, specify which events to watch,how many events to process before exiting or if the events should be reported to the console"
In libgpiod ports and pins correspond to gpiochips and lines respectively. GPIO chip numbers are assigned by the kernel, and are hardware depended.
GPIO manipulation in C
A more common manipulation of GPIOs is through a C program. The following example will demonstrated GPIO manipulation using the Libgpiod libary.
Program Setup
On the target device:
-
Login, the default username and password is give below:
username: root password: emac_inc
-
Change the file to read write by entering oemntrw into the device terminal.
root
@
somimx6ul
:
~
#
oemntrw
NOTE This will only change the root filesystem to read-write for the current boot. When the system is rebooted, the root filesystem will once again be mounted read-only. -
Obtain the device IP-address by entering ifconfig into the terminal. This is needed for device configuration in Qt Creator below.
root@emac-oe:~# ifconfig eth0 Link encap:Ethernet HWaddr 00:50:C2:E6:60:F4 inet addr:10.0.2.100 Bcast:10.0.255.255 Mask:255.255.0.0 inet6 addr: fe80::5054:ff:feb1:f83e/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1825 errors:0 dropped:0 overruns:0 frame:0 TX packets:553 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:139124 (135.8 KiB) TX bytes:50603 (49.4 KiB) Interrupt:25 Base address:0xc000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
On development machine:
- Open Qt Creator
Option 1:
- Create a qmake project
- select + New Project on the 'Welcome' window, the New Project window will appear.
- Under Projects select Non-Qt Project, Under the middle window select Plain C Application, Click Choose..., The Location window will appear.
- Name your project LibGPIOd_example, and choose a Create-in location, Click Next > to advance to the Build System window.
- On the Build System Window choose the qmake option, Click Next > to advance to the Kits window.
- On the Kits window check only ARM Qt5, Click Next > to advance to the Summary window
- The options on the Summary window will default to <None>, Click Finish'. Your Project will now be generated.
- Modify the qmake the build file (project_name.pro).
- Copy and paste the following into your .pro file.
- Add the EMAC_Libgpiod.h file
- With you project selected, click File->New File or Project, the New File or Project window will appear.
- Under Files and Classes select General, and in the middle column select Empty file, Click Choose..., The Location window will appear
- Name the file EMAC_Libgpiod.h and choose your project location as the path, Click Next> to advance to the Summary window
- Click Finish, the file will now open.
- Copy and paste the provided .h file, EMAC_Libgpiod.h into
- Save the file, by click File->Save All, the file will now be added to your project under Libgpiod_example->Headers
- Add the EMAC_Libgpiod.c file
- repeat same steps as for the .h file, but replace the file name enter EMAC_Libgpiod.c and Copy and paste the provided EMAC_Libgpiod.c file
- select File->Save All
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt
LIBS += -lgpiod
SOURCES += main.c \
EMAC_Libgpiod.c
target.path=/home/developer
INSTALLS += target
HEADERS += \
EMAC_Libgpiod.h
Option 2:
- Create a cmake project
- select + New Project on the 'Welcome' window, the New Project window will appear.
- Under Projects select EMAC Project, Under the middle window select EMAC C Project (CMake Build), Click Choose..., The Location window will appear.
- Name your project LibGPIOd_example, and choose a Create-in location, Click Next > to advance to the Summary window.
- The options on the Summary window will default to <None>, Click Finish'. Your Project will now be generated.
- Click on the Projects tab, select only the Arm option and click Configure Project. A CMakeLists.txt file will now be generated under the project.
- Add the EMAC_Libgpiod.h file
- Under the project folder right click on CMakeLists.txt and select Show Containing Folder to open the project directory.
- Save this EMAC_Libgpiod.h file to the project directory. Do this in git by right clicking on Raw, selecting Save link as... and choosing the project directory.
- Add the EMAC_Libgpiod.c file in the same way.
- Right click on the project folder and select Run CMake to add the files to the project.
End of Options, Continuing:
- Open main.c under LibGPIOd_example->Sources and copy and paste the provided main.c.
- Note, the program must be configured to run for your target device. In the main.c file select your target device by un-commenting the #define preprocessor directive corresponding to the device you're using. All other devices should be commented out. For this example we're using a 150ES carrier board so we'll select the CARRIER_BOARD_150.
- select File->Save All, All necessary files have now been added to the project
- Configure build options
- Go to Tools->Options... to open the options window
- Select Devices in the left hand column to open the Devices tab
- From the Devices tab select Devices sub-tab and Click Add... in the right hand column
- Select Generic Linux Device, then click Start Wizard.
- Type in a name, the IP address, the user name, and the password for the device. Use the credentials below to sign in.
- Click Next.
- Click Finish.
- A connection will be established with the target device.
- Click Close.
- Click Apply.
- Click OK.
- Now, on the left side of Qt Creator, you will see the project icon, which looks like a monitor. Click this and select Release or Debug under build.
- Now, simply press the green play button. The program should run on the target device and yield an output.
//In main.c
#define CARRIER_BOARD_150
//#define CARRIER_BOARD_200
//#define IPAC
Similarly, 1 of 4 example programs can be selected to run, example 4 is selected by default, we'll continue with this option.
//In main.c
//#define EXAMPLE_1
//#define EXAMPLE_2
//#define EXAMPLE_3
#define EXAMPLE_4
Table 4: Default Login Credentials | |
---|---|
Username | Password |
root | emac_inc |
NOTE |
If multiple build options were selected three sub-menus will appear (Kit, Build and Run). Click this and make sure Arm Qt5 is selected under Kit, Release is selected under Build, and the project is set to be run on the remote device under Run. |
Examples
As previously stated the main.c program must be configured to run for your target device. In the main.c file select your target device by un-commenting the #define preprocessor directive corresponding to the device you're using. All other devices should be commented out.
//In main.c
#define CARRIER_BOARD_150
//#define CARRIER_BOARD_200
//#define IPAC
Similarly, 1 of 4 example programs can be selected to run, un-comment 1 of the "example" #define preprocessor directives and leave the rest commented out. Changes these options will require rebuilding of the program (Simply press the green play button again, this should automatically rebuild and launch the project on the target device.)
//In main.c
//#define EXAMPLE_1
//#define EXAMPLE_2
//#define EXAMPLE_3
#define EXAMPLE_4
All examples use the Libgpiod libary (#include <gpiod.h>), with example 4 using custom built functions provided in EMAC_Libgpiod.h.
EXAMPLE_1 demonstrates basic IO configuration using Libgpiod's contextless functions
EXAMPLE_2 demonstrates basic IO configuration without contextless functions
EXAMPLE_3 LED demo using only Libgpiod
EXAMPLE_4 LED demo using custom built Libgpiod-based helper functions