aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui
diff options
context:
space:
mode:
authorPavel Pisa <pisa@cmp.felk.cvut.cz>2019-02-13 21:59:29 +0100
committerPavel Pisa <pisa@cmp.felk.cvut.cz>2019-02-13 21:59:29 +0100
commit3442b5fdeb4f8dfef38977078c5c6e801dcc2b51 (patch)
tree830a084743461bf4aab21554889f50886507ef7a /qtmips_gui
parentf17eedb8856ae568ebb9b45b367ef6edf1bb7318 (diff)
downloadqtmips-3442b5fdeb4f8dfef38977078c5c6e801dcc2b51.tar.gz
qtmips-3442b5fdeb4f8dfef38977078c5c6e801dcc2b51.tar.bz2
qtmips-3442b5fdeb4f8dfef38977078c5c6e801dcc2b51.zip
Implemented three dials equivalent to MZ_APO RGB dials.
Tested with code compiled by Linux PIC based GCC compiler with calling musl-libc sprintf function. Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_gui')
-rw-r--r--qtmips_gui/mainwindow.cpp1
-rw-r--r--qtmips_gui/peripheralsdock.cpp6
-rw-r--r--qtmips_gui/peripheralsdock.h5
-rw-r--r--qtmips_gui/peripheralsview.cpp27
-rw-r--r--qtmips_gui/peripheralsview.h26
-rw-r--r--qtmips_gui/peripheralsview.ui161
-rw-r--r--qtmips_gui/programdock.h1
-rw-r--r--qtmips_gui/qtmips_gui.pro9
8 files changed, 230 insertions, 6 deletions
diff --git a/qtmips_gui/mainwindow.cpp b/qtmips_gui/mainwindow.cpp
index b77d0d6..3e95a8f 100644
--- a/qtmips_gui/mainwindow.cpp
+++ b/qtmips_gui/mainwindow.cpp
@@ -174,6 +174,7 @@ void MainWindow::create_core(const machine::MachineConfig &config) {
cache_program->setup(machine->cache_program());
cache_data->setup(machine->cache_data());
terminal->setup(machine->serial_port());
+ peripherals->setup(machine->peripheral_spi_led());
// Connect signals for instruction address followup
connect(machine->core(), SIGNAL(fetch_inst_addr_value(std::uint32_t)),
diff --git a/qtmips_gui/peripheralsdock.cpp b/qtmips_gui/peripheralsdock.cpp
index ad423a0..4494948 100644
--- a/qtmips_gui/peripheralsdock.cpp
+++ b/qtmips_gui/peripheralsdock.cpp
@@ -39,11 +39,13 @@ PeripheralsDock::PeripheralsDock(QWidget *parent, QSettings *settings) : QDockWi
top_widget = new QWidget(this);
setWidget(top_widget);
layout_box = new QVBoxLayout(top_widget);
+ periph_view = new PeripheralsView(0);
+ layout_box->addWidget(periph_view);
setObjectName("Peripherals");
setWindowTitle("Peripherals");
}
-void PeripheralsDock::setup(const machine::QtMipsMachine *machine) {
-
+void PeripheralsDock::setup(const machine::PeripSpiLed *perip_spi_led) {
+ periph_view->setup(perip_spi_led);
}
diff --git a/qtmips_gui/peripheralsdock.h b/qtmips_gui/peripheralsdock.h
index b611515..d1f8b47 100644
--- a/qtmips_gui/peripheralsdock.h
+++ b/qtmips_gui/peripheralsdock.h
@@ -39,6 +39,8 @@
#include <QDockWidget>
#include <QLabel>
#include <QFormLayout>
+#include <peripheralsview.h>
+#include "peripspiled.h"
#include "peripheral.h"
#include "qtmipsmachine.h"
@@ -47,12 +49,13 @@ class PeripheralsDock : public QDockWidget {
public:
PeripheralsDock(QWidget *parent, QSettings *settings);
- void setup(const machine::QtMipsMachine *machine);
+ void setup(const machine::PeripSpiLed *perip_spi_led);
private:
QVBoxLayout *layout_box;
QWidget *top_widget, *top_form;
QFormLayout *layout_top_form;
+ PeripheralsView *periph_view;
};
#endif // PERIPHERALSDOCK_H
diff --git a/qtmips_gui/peripheralsview.cpp b/qtmips_gui/peripheralsview.cpp
new file mode 100644
index 0000000..5a8ec70
--- /dev/null
+++ b/qtmips_gui/peripheralsview.cpp
@@ -0,0 +1,27 @@
+#include "peripheralsview.h"
+#include "ui_peripheralsview.h"
+
+PeripheralsView::PeripheralsView(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::PeripheralsView)
+{
+ ui->setupUi(this);
+
+ connect(ui->dialRed, SIGNAL(valueChanged(int)), ui->spinRed, SLOT(setValue(int)));
+ connect(ui->dialGreen, SIGNAL(valueChanged(int)), ui->spinGreen, SLOT(setValue(int)));
+ connect(ui->dialBlue, SIGNAL(valueChanged(int)), ui->spinBlue, SLOT(setValue(int)));
+ connect(ui->spinRed, SIGNAL(valueChanged(int)), ui->dialRed, SLOT(setValue(int)));
+ connect(ui->spinGreen, SIGNAL(valueChanged(int)), ui->dialGreen, SLOT(setValue(int)));
+ connect(ui->spinBlue, SIGNAL(valueChanged(int)), ui->dialBlue, SLOT(setValue(int)));
+}
+
+PeripheralsView::~PeripheralsView()
+{
+ delete ui;
+}
+
+void PeripheralsView::setup(const machine::PeripSpiLed *perip_spi_led) {
+ connect(ui->spinRed, SIGNAL(valueChanged(int)), perip_spi_led, SLOT(red_knob_update(int)));
+ connect(ui->spinGreen, SIGNAL(valueChanged(int)), perip_spi_led, SLOT(green_knob_update(int)));
+ connect(ui->spinBlue, SIGNAL(valueChanged(int)), perip_spi_led, SLOT(blue_knob_update(int)));
+}
diff --git a/qtmips_gui/peripheralsview.h b/qtmips_gui/peripheralsview.h
new file mode 100644
index 0000000..8aaf9b9
--- /dev/null
+++ b/qtmips_gui/peripheralsview.h
@@ -0,0 +1,26 @@
+#ifndef PERIPHERALSVIEW_H
+#define PERIPHERALSVIEW_H
+
+#include <QWidget>
+
+#include "peripspiled.h"
+
+namespace Ui {
+class PeripheralsView;
+}
+
+class PeripheralsView : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit PeripheralsView(QWidget *parent = 0);
+ ~PeripheralsView();
+
+ void setup(const machine::PeripSpiLed *perip_spi_led);
+
+private:
+ Ui::PeripheralsView *ui;
+};
+
+#endif // PERIPHERALSVIEW_H
diff --git a/qtmips_gui/peripheralsview.ui b/qtmips_gui/peripheralsview.ui
new file mode 100644
index 0000000..59a1e4d
--- /dev/null
+++ b/qtmips_gui/peripheralsview.ui
@@ -0,0 +1,161 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PeripheralsView</class>
+ <widget class="QWidget" name="PeripheralsView">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>573</width>
+ <height>484</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetMaximumSize</enum>
+ </property>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetNoConstraint</enum>
+ </property>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QDial" name="dialRed">
+ <property name="maximum">
+ <number>255</number>
+ </property>
+ <property name="wrapping">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="spinRed">
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ <property name="maximum">
+ <number>255</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QDial" name="dialGreen">
+ <property name="maximum">
+ <number>255</number>
+ </property>
+ <property name="wrapping">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="spinGreen">
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ <property name="maximum">
+ <number>255</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <widget class="QDial" name="dialBlue">
+ <property name="maximum">
+ <number>255</number>
+ </property>
+ <property name="wrapping">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="spinBlue">
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ <property name="maximum">
+ <number>255</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QCheckBox" name="checkBox">
+ <property name="text">
+ <string>b31</string>
+ </property>
+ <property name="checkable">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="checkBox_2">
+ <property name="text">
+ <string>b30</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="checkBox_3">
+ <property name="text">
+ <string>b29</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/qtmips_gui/programdock.h b/qtmips_gui/programdock.h
index 529730a..56fb1b7 100644
--- a/qtmips_gui/programdock.h
+++ b/qtmips_gui/programdock.h
@@ -39,6 +39,7 @@
#include <QDockWidget>
#include <QLabel>
#include <QComboBox>
+#include "peripheralsview.h"
#include "qtmipsmachine.h"
class ProgramDock : public QDockWidget {
diff --git a/qtmips_gui/qtmips_gui.pro b/qtmips_gui/qtmips_gui.pro
index fa1cbc6..56e6909 100644
--- a/qtmips_gui/qtmips_gui.pro
+++ b/qtmips_gui/qtmips_gui.pro
@@ -53,7 +53,8 @@ SOURCES += \
programtableview.cpp \
aboutdialog.cpp \
peripheralsdock.cpp \
- terminaldock.cpp
+ terminaldock.cpp \
+ peripheralsview.cpp
HEADERS += \
mainwindow.h \
@@ -87,12 +88,14 @@ HEADERS += \
programtableview.h \
aboutdialog.h \
peripheralsdock.h \
- terminaldock.h
+ terminaldock.h \
+ peripheralsview.h
FORMS += \
NewDialog.ui \
NewDialogCache.ui \
- MainWindow.ui
+ MainWindow.ui \
+ peripheralsview.ui
RESOURCES += \
icons.qrc