2 ******************************************************************************
5 * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2017.
6 * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
7 * @addtogroup GCSPlugins GCS Plugins
9 * @addtogroup Uploader Serial and USB Uploader Plugin
11 * @brief The USB and Serial protocol uploader plugin
12 *****************************************************************************/
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 #include "../../../libs/qextserialport/src/qextserialport.h"
34 #include <QtCore/QCoreApplication>
38 #define MAX_PACKET_DATA_LEN 255
39 #define MAX_PACKET_BUF_SIZE (1 + 1 + 255 + 2)
41 int main(int argc
, char *argv
[])
43 uint8_t sspTxBuf
[MAX_PACKET_BUF_SIZE
];
44 uint8_t sspRxBuf
[MAX_PACKET_BUF_SIZE
];
47 PortSettings settings
;
49 settings
.BaudRate
= BAUD57600
;
50 settings
.DataBits
= DATA_8
;
51 settings
.FlowControl
= FLOW_OFF
;
52 settings
.Parity
= PAR_NONE
;
53 settings
.StopBits
= STOP_1
;
54 settings
.Timeout_Millisec
= 5000;
56 info
= new port(settings
, "COM3");
57 info
->rxBuf
= sspRxBuf
;
58 info
->rxBufSize
= MAX_PACKET_DATA_LEN
;
59 info
->txBuf
= sspTxBuf
;
60 info
->txBufSize
= 255;
62 info
->timeoutLen
= 5000;
66 QCoreApplication
a(argc
, argv
);
67 while (!bb
.ssp_Synchronise()) {
68 qDebug() << "trying sync";
71 qDebug() << "sync complete";
76 if (bb
.sendData(buf
, 63)) {
77 qDebug() << "send OK";
80 // qDebug()<<"send NOK";
81 ////bb.ssp_SendData(buf,63);
84 if (bb
.packets_Available() > 0) {
86 qDebug() << "receive=" << (int)buf
[0] << (int)buf
[1] << (int)buf
[2];
90 // bb.ssp_SendData(buf,63);
93 // bb.ssp_ReceiveProcess();
94 // bb.ssp_SendProcess();