Browse Source

寄存器读写按键

master
zhaohe 1 year ago
parent
commit
a2a0fed0d1
  1. 27
      mainwindow.cpp
  2. 40
      mainwindow.ui

27
mainwindow.cpp

@ -150,7 +150,7 @@ void MainWindow::constructUI() {
*******************************************************************************/ *******************************************************************************/
connect(ui->storageConfigKey, &QPushButton::clicked, this, [=](bool check) { // connect(ui->storageConfigKey, &QPushButton::clicked, this, [=](bool check) { //
DO(m_clstc->storageConfigs()); DO(m_clstc->storageConfigs());
ui->informationBrowser->setText("保存配置成功");
ui->informationBrowser->setText("保存配置");
}); });
/******************************************************************************* /*******************************************************************************
@ -158,7 +158,7 @@ void MainWindow::constructUI() {
*******************************************************************************/ *******************************************************************************/
connect(ui->rebootDeviceKey, &QPushButton::clicked, this, [=](bool check) { // connect(ui->rebootDeviceKey, &QPushButton::clicked, this, [=](bool check) { //
DO(m_clstc->reboot()); DO(m_clstc->reboot());
ui->informationBrowser->setText("重启设备成功");
ui->informationBrowser->setText("重启设备");
}); });
/******************************************************************************* /*******************************************************************************
@ -166,7 +166,28 @@ void MainWindow::constructUI() {
*******************************************************************************/ *******************************************************************************/
connect(ui->factoryResetKey, &QPushButton::clicked, this, [=](bool check) { // connect(ui->factoryResetKey, &QPushButton::clicked, this, [=](bool check) { //
DO(m_clstc->factoryReset()); DO(m_clstc->factoryReset());
ui->informationBrowser->setText("恢复出厂设置成功");
ui->informationBrowser->setText("恢复出厂设置");
});
/*******************************************************************************
* *
*******************************************************************************/
connect(ui->regReadKey, &QPushButton::clicked, this, [=](bool check) { //
uint32_t addr = str2int(ui->RegAdd->text());
uint32_t value = 0;
DO(m_clstc->reg_read(addr, value, 100));
ui->regReadbakVal->setText(fmt("0x%08X", value));
ui->informationBrowser->setText(fmt("读0x%04x成功", addr));
});
connect(ui->regWriteKey, &QPushButton::clicked, this, [=](bool check) { //
uint32_t addr = str2int(ui->RegAdd->text());
uint32_t value = str2int(ui->regWriteVal->text());
uint32_t readkbak = 0;
DO(m_clstc->reg_write(addr, value, readkbak, 100));
ui->regReadbakVal->setText(fmt("0x%04x", readkbak));
ui->informationBrowser->setText(fmt("写0x%04x成功", addr));
}); });
} }

40
mainwindow.ui

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1004</width>
<height>723</height>
<width>1055</width>
<height>768</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -378,53 +378,23 @@
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QTextEdit" name="RegAdd">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QLineEdit" name="RegAdd">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
<height>25</height> <height>25</height>
</size> </size>
</property> </property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>25</height>
</size>
</property>
<property name="lineWrapColumnOrWidth">
<number>2</number>
</property>
</widget> </widget>
</item> </item>
<item row="4" column="1"> <item row="4" column="1">
<widget class="QTextEdit" name="regWritebakVal">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QLineEdit" name="regWriteVal">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
<height>25</height> <height>25</height>
</size> </size>
</property> </property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>25</height>
</size>
</property>
<property name="lineWrapColumnOrWidth">
<number>2</number>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -503,7 +473,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1004</width>
<width>1055</width>
<height>23</height> <height>23</height>
</rect> </rect>
</property> </property>

Loading…
Cancel
Save