Fix IO read value in IOSwitches
MODIFY
src/io/ioswitches.cpp
src/io/ioswitches.cpp
@@ -193,8 +193,12 @@ void IOSwitches::updateSwitches() {
emit regMapChanged();
}
-uint32_t IOSwitches::ioRead(uint32_t offset, unsigned size) {
- return (m_values >> (offset % 4)) & generateBitmask(size * 8);
+uint32_t IOSwitches::ioRead(uint32_t, unsigned) {
+ uint32_t value = 0;
+ for (const auto& sw : m_switches) {
+ value |= (sw.second.second->isChecked()) << sw.first;
+ }
+ return value;
}
void IOSwitches::ioWrite(uint32_t, uint32_t, unsigned) {

MODIFY
src/io/ioswitches.h
src/io/ioswitches.h
@@ -82,7 +82,6 @@ private:
void updateSwitches();
uint32_t regRead(uint32_t offset) const;
- uint32_t m_values;
std::map<int, std::pair<QLabel*, ToggleButton*>> m_switches;
QGridLayout* m_switchLayout;
std::vector<RegDesc> m_regDescs;

Fix IO read value in IOSwitches