diff options
author | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-02-16 23:28:14 +0100 |
---|---|---|
committer | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-02-16 23:28:14 +0100 |
commit | c58935b7587980cdf16015da5e21b5896c96678e (patch) | |
tree | 5958596dea1e1aaaeb7c77508cf656a82ab6c101 /qtmips_gui | |
parent | 875c265fa1754cc437a3ba39b4137a5f7af8d708 (diff) | |
download | qtmips-c58935b7587980cdf16015da5e21b5896c96678e.tar.gz qtmips-c58935b7587980cdf16015da5e21b5896c96678e.tar.bz2 qtmips-c58935b7587980cdf16015da5e21b5896c96678e.zip |
Change RGB LEDs signals and slots to unsigned value.
Signed value caused in the conversion incorrect behavior
for some corner cases.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_gui')
-rw-r--r-- | qtmips_gui/peripheralsview.cpp | 10 | ||||
-rw-r--r-- | qtmips_gui/peripheralsview.h | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/qtmips_gui/peripheralsview.cpp b/qtmips_gui/peripheralsview.cpp index 655b101..8ce82fc 100644 --- a/qtmips_gui/peripheralsview.cpp +++ b/qtmips_gui/peripheralsview.cpp @@ -43,8 +43,8 @@ void PeripheralsView::setup(const machine::PeripSpiLed *perip_spi_led) { ui->labelRgb2->setAutoFillBackground(true); connect(perip_spi_led, SIGNAL(led_line_changed(uint)), this, SLOT(led_line_changed(uint))); - connect(perip_spi_led, SIGNAL(led_rgb1_changed(int)), this, SLOT(led_rgb1_changed(int))); - connect(perip_spi_led, SIGNAL(led_rgb2_changed(int)), this, SLOT(led_rgb2_changed(int))); + connect(perip_spi_led, SIGNAL(led_rgb1_changed(uint)), this, SLOT(led_rgb1_changed(uint))); + connect(perip_spi_led, SIGNAL(led_rgb2_changed(uint)), this, SLOT(led_rgb2_changed(uint))); led_line_changed(0); led_rgb1_changed(0); @@ -63,7 +63,7 @@ void PeripheralsView::led_line_changed(uint val) { ui->lineEditBin->setText(t + s); } -static void set_widget_background_color(QWidget *w, int val) { +static void set_widget_background_color(QWidget *w, uint val) { int r = (val >> 16) & 0xff; int g = (val >> 8) & 0xff; int b = (val >> 0) & 0xff; @@ -73,7 +73,7 @@ static void set_widget_background_color(QWidget *w, int val) { w->setPalette(pal); } -void PeripheralsView::led_rgb1_changed(int val) { +void PeripheralsView::led_rgb1_changed(uint val) { QString s, t; s = QString::number(val, 16); t.fill('0', 8 - s.count()); @@ -82,7 +82,7 @@ void PeripheralsView::led_rgb1_changed(int val) { set_widget_background_color(ui->labelRgb1, val); } -void PeripheralsView::led_rgb2_changed(int val) { +void PeripheralsView::led_rgb2_changed(uint val) { QString s, t; s = QString::number(val, 16); t.fill('0', 8 - s.count()); diff --git a/qtmips_gui/peripheralsview.h b/qtmips_gui/peripheralsview.h index 30e85f1..b718d9a 100644 --- a/qtmips_gui/peripheralsview.h +++ b/qtmips_gui/peripheralsview.h @@ -21,8 +21,8 @@ public: public slots: void led_line_changed(uint val); - void led_rgb1_changed(int val); - void led_rgb2_changed(int val); + void led_rgb1_changed(uint val); + void led_rgb2_changed(uint val); private: Ui::PeripheralsView *ui; |