Initial commit for IOPeripheralTab
MODIFY
src/io/ioledmatrix.cpp
src/io/ioledmatrix.cpp
@@ -21,10 +21,10 @@ IOLedMatrix::IOLedMatrix(QWidget* parent, uint32_t startAddr) : IOBase(parent, s
QString IOLedMatrix::description() const {
QStringList desc;
- desc << "A word-addressable LED matrix.";
- desc
- << "Each LED maps to a 24-bit register storing an RGB color value, with B stored in the least significant byte";
- desc << "The byte offset of each LED is calculated as '(rowIdx + colIdx*width) * 4'.";
+ desc << "Each LED maps to a 24-bit register storing an RGB color value, with B stored in the least significant "
+ "byte.";
+ desc << "The byte offset of the LED at coordinates (x, y) is:";
+ desc << " offset = (y + x*N_LEDS_ROW) * 4";
return desc.join('\n');
}

ADD
src/ioperipheraltab.cpp
+#include "ioperipheraltab.h"
+#include "ui_ioperipheraltab.h"
+
+#include "io/iobase.h"
+
+namespace Ripes {
+
+IOPeripheralTab::IOPeripheralTab(QWidget* parent, IOBase* peripheral)
+ : QWidget(parent), m_peripheral(peripheral), m_ui(new Ui::IOPeripheralTab) {
+ m_ui->setupUi(this);
+
+ m_ui->description->setText(m_peripheral->description());
+}
+
+IOPeripheralTab::~IOPeripheralTab() {
+ delete m_ui;
+}
+
+} // namespace Ripes

ADD
src/ioperipheraltab.h
+#pragma once
+#include <QWidget>
+
+namespace Ripes {
+class IOBase;
+
+namespace Ui {
+class IOPeripheralTab;
+}
+
+class IOPeripheralTab : public QWidget {
+ Q_OBJECT
+
+public:
+ IOPeripheralTab(QWidget* parent, IOBase* peripheral);
+ ~IOPeripheralTab();
+
+private:
+ Ui::IOPeripheralTab* m_ui;
+
+ IOBase* m_peripheral = nullptr;
+};
+
+} // namespace Ripes

ADD
src/ioperipheraltab.ui
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Ripes::IOPeripheralTab</class>
+ <widget class="QWidget" name="Ripes::IOPeripheralTab">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>329</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">
+ <item>
+ <widget class="QLabel" name="description">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string>Parameters</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_4">
+ <item row="0" column="0">
+ <widget class="QTableView" name="parameterView"/>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Register map</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
+ <widget class="QTableView" name="registerMapView"/>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_3">
+ <property name="title">
+ <string>Code example</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="0" column="0">
+ <widget class="QPlainTextEdit" name="codeExample">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

MODIFY
src/iotab.cpp
src/iotab.cpp
#include "processorhandler.h"
+#include "ioperipheraltab.h"
+
namespace Ripes {
IOTab::IOTab(QToolBar* toolbar, QWidget* parent) : RipesTab(toolbar, parent), m_ui(new Ui::IOTab) {
@@ -68,18 +70,10 @@ uint32_t nextAddress() {
return 0x10000;
}
-class PeripheralTab : public QWidget {
-public:
- PeripheralTab(QWidget* parent, IOBase* peripheral) : QWidget(parent), m_peripheral(peripheral) {}
-
-private:
- IOBase* m_peripheral;
-};
-
void IOTab::createPeripheral(IOType type) {
auto* peripheral = IOFactories.at(type)(this, nextAddress());
// Create tab for peripheral
- auto* peripheralTab = new PeripheralTab(this, peripheral);
+ auto* peripheralTab = new IOPeripheralTab(this, peripheral);
m_ui->peripheralsTab->addTab(peripheralTab, peripheral->name());
m_ioTabs[peripheral] = peripheralTab;

Initial commit for IOPeripheralTab