Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
4b2663b5
Commit
4b2663b5
authored
Apr 23, 2011
by
lm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added baudrate 921600, made uart in basic mode operational
parent
7f76516b
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
231 additions
and
296 deletions
+231
-296
qgroundcontrol.pro
qgroundcontrol.pro
+1
-2
SerialInterface.h
src/comm/SerialInterface.h
+0
-62
SerialLink.cc
src/comm/SerialLink.cc
+171
-214
SerialLink.h
src/comm/SerialLink.h
+11
-12
SerialConfigurationWindow.cc
src/ui/SerialConfigurationWindow.cc
+41
-3
qportsettings.h
thirdParty/qserialport/include/QtSerialPort/qportsettings.h
+7
-3
No files found.
qgroundcontrol.pro
View file @
4b2663b5
...
...
@@ -127,7 +127,7 @@ INCLUDEPATH += . \
thirdParty
/
qserialport
/
src
#
Include
serial
port
library
include
(
src
/
lib
/
qextserialport
/
qextserialport
.
pri
)
#
include
(
src
/
lib
/
qextserialport
/
qextserialport
.
pri
)
#
include
qserial
library
include
(
thirdParty
/
qserialport
/
qgroundcontrol
-
qserialport
.
pri
)
...
...
@@ -207,7 +207,6 @@ HEADERS += src/MG.h \
src
/
comm
/
LinkManager
.
h
\
src
/
comm
/
LinkInterface
.
h
\
src
/
comm
/
SerialLinkInterface
.
h
\
src
/
comm
/
SerialInterface
.
h
\
src
/
comm
/
SerialLink
.
h
\
src
/
comm
/
SerialSimulationLink
.
h
\
src
/
comm
/
ProtocolInterface
.
h
\
...
...
src/comm/SerialInterface.h
View file @
4b2663b5
...
...
@@ -33,7 +33,6 @@ This file is part of the QGROUNDCONTROL project
#define SERIALINTERFACE_H
#include <QIODevice>
#include "qextserialport.h"
#include <QtSerialPort/QSerialPort>
#include <iostream>
...
...
@@ -138,67 +137,6 @@ public:
virtual
void
setFlow
(
flowType
flow
)
=
0
;
};
class
SerialQextserial
:
public
SerialInterface
{
Q_OBJECT
private:
QextSerialPort
*
_port
;
signals:
void
aboutToClose
();
public:
SerialQextserial
(
QString
porthandle
,
QextSerialPort
::
QueryMode
mode
)
:
_port
(
NULL
)
{
_port
=
new
QextSerialPort
(
porthandle
,
QextSerialPort
::
Polling
);
QObject
::
connect
(
_port
,
SIGNAL
(
aboutToClose
()),
this
,
SIGNAL
(
aboutToClose
()));
}
~
SerialQextserial
()
{
delete
_port
;
_port
=
NULL
;
}
virtual
bool
isOpen
()
{
return
_port
->
isOpen
();
}
virtual
bool
isWritable
()
{
return
_port
->
isWritable
();
}
virtual
qint64
bytesAvailable
()
{
return
_port
->
bytesAvailable
();
}
virtual
int
write
(
const
char
*
data
,
qint64
size
)
{
return
_port
->
write
(
data
,
size
);
}
virtual
void
read
(
char
*
data
,
qint64
numBytes
)
{
_port
->
read
(
data
,
numBytes
);
}
virtual
void
flush
()
{
_port
->
flush
();
}
virtual
void
close
()
{
_port
->
close
();
}
virtual
void
open
(
QIODevice
::
OpenModeFlag
flag
)
{
_port
->
open
(
flag
);
}
virtual
void
setBaudRate
(
SerialInterface
::
baudRateType
baudrate
)
{
_port
->
setBaudRate
((
BaudRateType
)
baudrate
);
}
virtual
void
setParity
(
SerialInterface
::
parityType
parity
)
{
_port
->
setParity
((
ParityType
)
parity
);
}
virtual
void
setStopBits
(
SerialInterface
::
stopBitsType
stopBits
)
{
_port
->
setStopBits
((
StopBitsType
)
stopBits
);
}
virtual
void
setDataBits
(
SerialInterface
::
dataBitsType
dataBits
)
{
_port
->
setDataBits
((
DataBitsType
)
dataBits
);
}
virtual
void
setTimeout
(
qint64
timeout
)
{
_port
->
setTimeout
(
timeout
);
}
virtual
void
setFlow
(
SerialInterface
::
flowType
flow
)
{
// TODO implement
_port
->
setFlowControl
((
FlowType
)
flow
);
}
};
using
namespace
TNX
;
class
SerialQserial
:
public
SerialInterface
...
...
src/comm/SerialLink.cc
View file @
4b2663b5
This diff is collapsed.
Click to expand it.
src/comm/SerialLink.h
View file @
4b2663b5
...
...
@@ -36,7 +36,7 @@ This file is part of the QGROUNDCONTROL project
#include <QThread>
#include <QMutex>
#include <QString>
#include "
SerialInterface
.h"
#include "
qserialport
.h"
#include <configuration.h>
#include "SerialLinkInterface.h"
#ifdef _WIN32
...
...
@@ -59,11 +59,11 @@ class SerialLink : public SerialLinkInterface
public:
SerialLink
(
QString
portname
=
""
,
SerialInterface
::
baudRateType
baudrate
=
SerialInterface
::
BAUD
57600
,
SerialInterface
::
flowType
flow
=
SerialInterface
::
FLOW_OFF
,
SerialInterface
::
parityType
parity
=
SerialInterface
::
PAR_NONE
,
SerialInterface
::
dataBitsType
dataBits
=
SerialInterface
::
DATA_
8
,
SerialInterface
::
stopBitsType
stopBits
=
SerialInterface
::
STOP_
1
);
int
baudrate
=
57600
,
bool
flow
=
false
,
bool
parity
=
false
,
int
dataBits
=
8
,
int
stopBits
=
1
);
~
SerialLink
();
static
const
int
poll_interval
=
SERIAL_POLL_INTERVAL
;
///< Polling interval, defined in configuration.h
...
...
@@ -116,6 +116,9 @@ public slots:
bool
setDataBits
(
int
dataBits
);
bool
setStopBits
(
int
stopBits
);
// Set string rate
bool
setBaudRateString
(
const
QString
&
rate
);
// Set ENUM values
bool
setBaudRateType
(
int
rateIndex
);
bool
setFlowType
(
int
flow
);
...
...
@@ -138,18 +141,14 @@ protected slots:
void
checkForBytes
();
protected:
SerialInterface
*
port
;
TNX
::
QSerialPort
*
port
;
TNX
::
QPortSettings
portSettings
;
#ifdef _WIN32
HANDLE
winPort
;
DCB
winPortSettings
;
#endif
QString
porthandle
;
QString
name
;
SerialInterface
::
baudRateType
baudrate
;
SerialInterface
::
flowType
flow
;
SerialInterface
::
parityType
parity
;
SerialInterface
::
dataBitsType
dataBits
;
SerialInterface
::
stopBitsType
stopBits
;
int
timeout
;
int
id
;
...
...
src/ui/SerialConfigurationWindow.cc
View file @
4b2663b5
...
...
@@ -243,6 +243,44 @@ SerialConfigurationWindow::SerialConfigurationWindow(LinkInterface* link, QWidge
setupPortList
();
// Set up baud rates
ui
.
baudRate
->
addItem
(
"115200"
,
115200
);
ui
.
baudRate
->
clear
();
ui
.
baudRate
->
addItem
(
"50"
,
50
);
ui
.
baudRate
->
addItem
(
"70"
,
70
);
ui
.
baudRate
->
addItem
(
"110"
,
110
);
ui
.
baudRate
->
addItem
(
"134"
,
134
);
ui
.
baudRate
->
addItem
(
"150"
,
150
);
ui
.
baudRate
->
addItem
(
"200"
,
200
);
ui
.
baudRate
->
addItem
(
"300"
,
300
);
ui
.
baudRate
->
addItem
(
"600"
,
600
);
ui
.
baudRate
->
addItem
(
"1200"
,
1200
);
ui
.
baudRate
->
addItem
(
"1800"
,
1800
);
ui
.
baudRate
->
addItem
(
"2400"
,
2400
);
ui
.
baudRate
->
addItem
(
"4800"
,
4800
);
ui
.
baudRate
->
addItem
(
"9600"
,
9600
);
#ifdef Q_OS_WIN
ui
.
baudRate
->
addItem
(
"14400"
,
14400
);
#endif
ui
.
baudRate
->
addItem
(
"19200"
,
19200
);
ui
.
baudRate
->
addItem
(
"34800"
,
34800
);
#ifdef Q_OS_WIN
ui
.
baudRate
->
addItem
(
"56000"
,
56000
);
#endif
ui
.
baudRate
->
addItem
(
"57600"
,
57600
);
#ifdef Q_OS_WIN
ui
.
baudRate
->
addItem
(
"76800"
,
76800
);
#endif
ui
.
baudRate
->
addItem
(
"115200"
,
115200
);
#ifdef Q_OS_WIN
ui
.
baudRate
->
addItem
(
"128000"
,
128000
);
ui
.
baudRate
->
addItem
(
"230400"
,
230400
);
ui
.
baudRate
->
addItem
(
"256000"
,
256000
);
ui
.
baudRate
->
addItem
(
"460800"
,
460800
);
#endif
ui
.
baudRate
->
addItem
(
"921600"
,
921600
);
connect
(
action
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
configureCommunication
()));
// Make sure that a change in the link name will be reflected in the UI
...
...
@@ -251,7 +289,7 @@ SerialConfigurationWindow::SerialConfigurationWindow(LinkInterface* link, QWidge
// Connect the individual user interface inputs
connect
(
ui
.
portName
,
SIGNAL
(
editTextChanged
(
QString
)),
this
,
SLOT
(
setPortName
(
QString
)));
connect
(
ui
.
portName
,
SIGNAL
(
currentIndexChanged
(
QString
)),
this
,
SLOT
(
setPortName
(
QString
)));
connect
(
ui
.
baudRate
,
SIGNAL
(
activated
(
int
)),
this
->
link
,
SLOT
(
setBaudRateType
(
int
)));
connect
(
ui
.
baudRate
,
SIGNAL
(
activated
(
QString
)),
this
->
link
,
SLOT
(
setBaudRateString
(
QString
)));
connect
(
ui
.
flowControlCheckBox
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
enableFlowControl
(
bool
)));
connect
(
ui
.
parNone
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
setParityNone
(
bool
)));
connect
(
ui
.
parOdd
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
setParityOdd
(
bool
)));
...
...
@@ -292,7 +330,7 @@ SerialConfigurationWindow::SerialConfigurationWindow(LinkInterface* link, QWidge
enableFlowControl
(
false
);
}
ui
.
baudRate
->
setCurrentIndex
(
this
->
link
->
getBaudRateType
(
));
ui
.
baudRate
->
setCurrentIndex
(
ui
.
baudRate
->
findText
(
QString
(
"%1"
).
arg
(
this
->
link
->
getBaudRate
())
));
ui
.
dataBitsSpinBox
->
setValue
(
this
->
link
->
getDataBits
());
ui
.
stopBitsSpinBox
->
setValue
(
this
->
link
->
getStopBits
());
...
...
@@ -466,7 +504,7 @@ void SerialConfigurationWindow::setParityEven(bool accept)
void
SerialConfigurationWindow
::
setPortName
(
QString
port
)
{
#ifdef
_WIN32
#ifdef
Q_OS_WIN
port
=
port
.
split
(
"-"
).
first
();
#endif
port
=
port
.
remove
(
" "
);
...
...
thirdParty/qserialport/include/QtSerialPort/qportsettings.h
View file @
4b2663b5
...
...
@@ -99,13 +99,14 @@ public:
BAUDR_460800
,
BAUDR_500000
,
BAUDR_576000
,
BAUDR_921600
,
#endif
#ifdef TNX_WINDOWS_SERIAL_PORT
BAUDR_14400
,
BAUDR_56000
,
BAUDR_128000
,
BAUDR_230400
,
BAUDR_256000
,
BAUDR_460800
,
#endif
// baud rates supported by all OSs
BAUDR_110
,
...
...
@@ -118,7 +119,8 @@ public:
BAUDR_19200
,
BAUDR_38400
,
BAUDR_57600
,
BAUDR_115200
BAUDR_115200
,
BAUDR_921600
};
enum
DataBits
{
...
...
@@ -184,13 +186,14 @@ public:
case
BAUDR_56000
:
baudRateInt_
=
56000
;
break
;
case
BAUDR_128000
:
baudRateInt_
=
128000
;
break
;
case
BAUDR_256000
:
baudRateInt_
=
256000
;
break
;
case
BAUDR_230400
:
baudRateInt_
=
230400
;
break
;
case
BAUDR_460800
:
baudRateInt_
=
460800
;
break
;
#endif
#if defined(Q_OS_LINUX)
case
BAUDR_230400
:
baudRateInt_
=
230400
;
break
;
case
BAUDR_460800
:
baudRateInt_
=
460800
;
break
;
case
BAUDR_500000
:
baudRateInt_
=
500000
;
break
;
case
BAUDR_576000
:
baudRateInt_
=
576000
;
break
;
case
BAUDR_921600
:
baudRateInt_
=
921600
;
break
;
#endif
// baud rates supported by all platforms
case
BAUDR_110
:
baudRateInt_
=
110
;
break
;
...
...
@@ -204,6 +207,7 @@ public:
case
BAUDR_38400
:
baudRateInt_
=
38400
;
break
;
case
BAUDR_57600
:
baudRateInt_
=
57600
;
break
;
case
BAUDR_115200
:
baudRateInt_
=
115200
;
break
;
case
BAUDR_921600
:
baudRateInt_
=
921600
;
break
;
default:
baudRateInt_
=
0
;
// unknown baudrate
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment