Repository navigation
Expand file tree
/
Copy pathmain.cpp
More file actions
92 lines (74 loc) · 2.95 KB
/
Copy pathmain.cpp
File metadata and controls
92 lines (74 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#include "mainwindow.h"
#include <QApplication>
#include <QSplashScreen>
#include <QThread>
#include "settingdialog.h"
#include "statusdialog.h"
#include "logdialog.h"
#include "informationdialog.h"
#include "keyboard.h"
#include <QTranslator>
#include "spi.h"
int main(int argc, char *argv[])
{
//QApplication::setSetuidAllowed(true);
QApplication app(argc, argv);
QTranslator translator;
translator.load(":/erc_demo_cn_zh.qm");
app.installTranslator(&translator);
MainWindow mainPage;
SettingDialog settingDialog;
StatusDialog statusDialog;
LogDialog logDialog;
InformationDialog informationDialog;
KeyBoard keyBoard;
SPI spi;
/*
QSplashScreen *splash = new QSplashScreen;
splash->setPixmap(QPixmap(":/buttonphotos/Meanwell_2.png"));
splash->show();
Qt::Alignment bottomCenter = Qt::AlignBottom | Qt::AlignCenter;
splash->showMessage(QObject::tr("Starting the ERC program..."),bottomCenter, Qt::white);
//QThread::msleep(2000);
//splash->hide();
*/
app.setOverrideCursor(QCursor(Qt::BlankCursor));
mainPage.setWindowFlags(Qt::Window|Qt::FramelessWindowHint);
settingDialog.setWindowFlags(Qt::Window|Qt::FramelessWindowHint);
statusDialog.setWindowFlags(Qt::Window|Qt::FramelessWindowHint);
logDialog.setWindowFlags(Qt::Window|Qt::FramelessWindowHint);
informationDialog.setWindowFlags(Qt::Window|Qt::FramelessWindowHint);
mainPage.showFullScreen();
QObject::connect(&mainPage, SIGNAL(showSettingDialog()),&settingDialog,SLOT(receiveShow()));
QObject::connect(&settingDialog, SIGNAL(showMainPage()),&mainPage,SLOT(receiveShow()));
QObject::connect(&mainPage, SIGNAL(showStatusDialog()),&statusDialog,SLOT(receiveShow()));
QObject::connect(&statusDialog, SIGNAL(showMainPage()),&mainPage,SLOT(receiveShow()));
QObject::connect(&mainPage, SIGNAL(showLogDialog()),&logDialog,SLOT(receiveShow()));
QObject::connect(&logDialog, SIGNAL(showMainPage()),&mainPage,SLOT(receiveShow()));
QObject::connect(&mainPage, SIGNAL(showInformationDialog()),&informationDialog,SLOT(receiveShow()));
QObject::connect(&informationDialog, SIGNAL(showMainPage()),&mainPage,SLOT(receiveShow()));
QObject::connect(&mainPage, SIGNAL(showKeyBoard()),&keyBoard,SLOT(receiveShow()));
QObject::connect(&keyBoard, SIGNAL(sendInputValue(QString)),&mainPage,SLOT(receiveInputValue(QString)));
//
for (qint16 temp=0;temp<7;++temp)
{
//spi.writeBufferTest(temp);
//spi.readByte(MCP_RXB0CTRL+6);
spi.delay(50000);
}
//
//spi.writeTxBtoCAN(0);
//spi.writeByte(MCP_RXB0CTRL,0x60);
//spi.delay(50000);
//spi.readSPIConfig();
spi.readByte(MCP_CANINTE);
spi.readByte(MCP_CANINTF);
spi.readByte(MCP_RXB1SIDH+1);
spi.readByte(MCP_CANINTF);
spi.readRXBuffer(MCP_READ_RX0, 14);
spi.readByte(MCP_CANINTF);
//spi.clearReadRXBuffer();
spi.StartCANbusComm();
mainPage.show();
return app.exec();
}