uint8 portAccess(uint8 portSelect, uint8 mask, uint8 ddrWrite, uint8 portWrite) { xdata uint8 tempByte = 0x00; switch ( portSelect ) { case 0: updateRegister(IOA, portWrite); updateRegister(OEA, ddrWrite); tempByte = IOA; break; case 1: updateRegister(IOB, portWrite); updateRegister(OEB, ddrWrite); tempByte = IOB; break; case 2: updateRegister(IOC, portWrite); updateRegister(OEC, ddrWrite); tempByte = IOC; break; case 3: updateRegister(IOD, portWrite); updateRegister(OED, ddrWrite); tempByte = IOD; break; case 4: updateRegister(IOE, portWrite); updateRegister(OEE, ddrWrite); tempByte = IOE; break; } return tempByte; }
void RDA5807M::seekDown(bool singleStep) { updateRegister(RDA5807M_R02_CONFIG, (RDA5807M_R02_SEEKUP | RDA5807M_R02_SEEK), RDA5807M_R02_SEEK); if (singleStep) updateRegister(RDA5807M_R02_CONFIG, RDA5807M_R02_SEEK, 0); }
void RDA5807M::band(band_t b) { uint16_t mode_65_50 = RDA5807M_R07_65M_50M_MODE; if (b == B11_50_76) { mode_65_50 = 0; b = B11_65_76; } updateRegister(RDA5807M_R03_TUNING, RDA5807M_R03_BAND_MASK, uint8_t(b) << RDA5807M_R03_BAND_SHIFT); updateRegister(RDA5807M_R07_BLEND, RDA5807M_R07_65M_50M_MODE, mode_65_50); }
void RDA5807M::setFrequency(uint16_t freq) { auto band_space = getRegister(RDA5807M_R03_TUNING) & (RDA5807M_R03_BAND_MASK | RDA5807M_R03_SPACE_MASK); auto space = (band_space & RDA5807M_R03_SPACE_MASK) >> RDA5807M_R03_SPACE_SHIFT; auto band = (band_space & RDA5807M_R03_BAND_MASK) >> RDA5807M_R03_BAND_SHIFT; if (band == 0b11 && !(getRegister(RDA5807M_R07_BLEND) & RDA5807M_R07_65M_50M_MODE)) band += 1; //Lower band limit is 50MHz // f = band + channel * space / 10 // channel = (f - band) * 10 / space uint16_t channel = (freq - pgm_read_word(&RDA5807M_BandLowerLimits[band])) * 10 / pgm_read_byte(&RDA5807M_ChannelSpacings[space]); updateRegister(RDA5807M_R03_TUNING, RDA5807M_R03_CHAN_MASK, channel << RDA5807M_R03_CHAN_SHIFT); }
register_editor_dialog::register_editor_dialog(QWidget *parent, u32 _pc, const std::shared_ptr<cpu_thread>& _cpu, CPUDisAsm* _disasm) : QDialog(parent) , m_pc(_pc) , cpu(_cpu) , m_disasm(_disasm) { setWindowTitle(tr("Edit registers")); setAttribute(Qt::WA_DeleteOnClose); QVBoxLayout* vbox_panel = new QVBoxLayout(); QHBoxLayout* hbox_panel = new QHBoxLayout(); QVBoxLayout* vbox_left_panel = new QVBoxLayout(); QVBoxLayout* vbox_right_panel = new QVBoxLayout(); QHBoxLayout* hbox_button_panel = new QHBoxLayout(); QLabel* t1_text = new QLabel(tr("Register: "), this); QLabel* t2_text = new QLabel(tr("Value (Hex):"), this); QPushButton* button_ok = new QPushButton(tr("&Ok")); QPushButton* button_cancel = new QPushButton(tr("&Cancel")); button_ok->setFixedWidth(80); button_cancel->setFixedWidth(80); m_register_combo = new QComboBox(this); m_value_line = new QLineEdit(this); m_value_line->setFixedWidth(200); // Layouts vbox_left_panel->addWidget(t1_text); vbox_left_panel->addWidget(t2_text); vbox_right_panel->addWidget(m_register_combo); vbox_right_panel->addWidget(m_value_line); hbox_button_panel->addWidget(button_ok); hbox_button_panel->addWidget(button_cancel); hbox_button_panel->setAlignment(Qt::AlignCenter); if (1) { if (_cpu->id_type() == 1) { for (int i = 0; i < 32; i++) m_register_combo->addItem(qstr(fmt::format("GPR[%d]", i))); for (int i = 0; i < 32; i++) m_register_combo->addItem(qstr(fmt::format("FPR[%d]", i))); for (int i = 0; i < 32; i++) m_register_combo->addItem(qstr(fmt::format("VR[%d]", i))); m_register_combo->addItem("CR"); m_register_combo->addItem("LR"); m_register_combo->addItem("CTR"); //m_register_combo->addItem("XER"); //m_register_combo->addItem("FPSCR"); } else { for (int i = 0; i < 128; i++) m_register_combo->addItem(qstr(fmt::format("GPR[%d]", i))); } } // Main Layout hbox_panel->addLayout(vbox_left_panel); hbox_panel->addSpacing(10); hbox_panel->addLayout(vbox_right_panel); vbox_panel->addLayout(hbox_panel); vbox_panel->addSpacing(10); vbox_panel->addLayout(hbox_button_panel); setLayout(vbox_panel); setModal(true); // Events connect(button_ok, &QAbstractButton::pressed, this, [=](){OnOkay(_cpu); accept();}); connect(button_cancel, &QAbstractButton::pressed, this, ®ister_editor_dialog::reject); connect(m_register_combo, &QComboBox::currentTextChanged, this, ®ister_editor_dialog::updateRegister); updateRegister(m_register_combo->currentText()); }
void RDA5807M::seekWrap(bool b) { updateRegister(RDA5807M_R02_CONFIG, RDA5807M_R02_SKMODE, b ? 0 : RDA5807M_R02_SKMODE); }
void RDA5807M::setBassBoost(bool value) { updateRegister(RDA5807M_R02_CONFIG, RDA5807M_R02_BASS, value ? RDA5807M_R02_BASS : 0); }
void RDA5807M::setMono(bool value) { updateRegister(RDA5807M_R02_CONFIG, RDA5807M_R02_MONO, value ? RDA5807M_R02_MONO : 0); }
void RDA5807M::setMute(bool value, bool minVolume) { updateRegister(RDA5807M_R02_CONFIG, RDA5807M_R02_DMUTE, value ? 0 : RDA5807M_R02_DMUTE); if (!value && minVolume) setVolume(1); }
void RDA5807M::setVolume(uint8_t vol) { updateRegister(RDA5807M_R05_VOLUME, RDA5807M_R05_VOLUME_MASK, vol << RDA5807M_R05_VOLUME_SHIFT); }