Search
Project
General
Profile
Sign in
Register
Home
Projects
Redmine shortcuts
Search
:
MitySOM-335x (ARM Cortex-A8 Based Products)
All Projects
Mity CPU Platforms
»
MitySOM-335x (ARM Cortex-A8 Based Products)
Overview
Activity
Documents
Wiki
Forums
Download (776 Bytes)
Building libdaq example applicationslibraries
» mainwindow.cpp
gpiosingle example -
Jonathan Cormier
, 07/08/2021 02:56 PM
#include
"mainwindow.h"
#include
"ui_mainwindow.h"
#define GPIO_TO_PIN(bank, gpio) ((bank)*32 + (gpio))
MainWindow
::
MainWindow
(
QWidget
*
parent
)
:
QMainWindow
(
parent
)
,
ui
(
new
Ui
::
MainWindow
)
,
gpioRedLed
(
GPIO_TO_NUM
(
1
,
12
))
// gpio1_12
{
ui
->
setupUi
(
this
);
gpioRedLed
.
setDirection
(
1
,
0
);
// Set gpio as output low
}
MainWindow
::~
MainWindow
()
{
delete
ui
;
}
void
MainWindow
::
on_pbToggleLed_clicked
()
{
int
ret
;
unsigned
int
value
;
ret
=
gpioRedLed
.
GetValue
(
value
);
if
(
ret
<
0
)
{
qDebug
()
<<
"Error: Failed to get gpio value"
;
return
;
}
ret
=
gpioRedLed
.
SetValue
(
!
value
);
if
(
ret
<
0
)
{
qDebug
()
<<
"Error: Failed to set gpio value"
;
return
;
}
}
« Previous
1
…
3
4
5
Next »
(5-5/5)
Go to top
Loading...