void PlaybackSettings::save() { Settings::self()->saveStopOnExit(stopOnExit->isChecked()); #if (defined Q_OS_LINUX && defined QT_QTDBUS_FOUND) || (defined Q_OS_MAC && defined IOKIT_FOUND) Settings::self()->saveInhibitSuspend(inhibitSuspend->isChecked()); #endif if (MPDConnection::self()->isConnected()) { int crossFade=crossfading->value(); if (crossFade!=MPDStatus::self()->crossFade()) { emit setCrossFade(crossFade); } QString rg=replayGain->itemData(replayGain->currentIndex()).toString(); if (rgSetting!=rg) { rgSetting=rg; emit setReplayGain(rg); } if (outputsView->isVisible()) { for (int i=0; i<outputsView->count(); ++i) { QListWidgetItem *item=outputsView->item(i); bool isEnabled=Qt::Checked==item->checkState(); int id=item->data(Qt::UserRole).toInt(); if (isEnabled && !enabledOutputs.contains(id)) { enabledOutputs.insert(id); emit enableOutput(id, isEnabled); } else if (!isEnabled && enabledOutputs.contains(id)) { enabledOutputs.remove(id); emit enableOutput(id, isEnabled); } } } } }
void Console::attachIODevice(QIODevice *iod) { if(_ioDevice) _ioDevice->disconnect(this); _ioDevice = iod; if(_ioDevice){ connect(_ioDevice, SIGNAL(readyRead()),this, SLOT(printData())); connect(_ioDevice, SIGNAL(readChannelFinished()),this, SLOT(enableOutput())); connect(_ioDevice, SIGNAL(closeDevice()),this, SLOT(aboutToClose())); } }
void __attribute__((__interrupt__, auto_psv)) _T1Interrupt(void) { seconds++; if (seconds > 255) { seconds = 0; } shift(seconds & 0b10000000); shift(seconds & 0b1000000); shift(seconds & 0b100000); shift(seconds & 0b10000); shift(seconds & 0b1000); shift(seconds & 0b100); shift(seconds & 0b10); shift(seconds & 0b1); enableOutput(); IFS0bits.T1IF = 0; }
/////////////////////// // Shift Register /////////////////////// void Distance::setShift(uint8_t val, int micro) { uint8_t high_bit = 1; //Shift values in for(int i=0; i<8; i++){ if(val & high_bit) digitalWrite(SHIFT_SER_PIN, HIGH); else digitalWrite(SHIFT_SER_PIN, LOW); shiftOnce(); high_bit = (high_bit << 1); } //Send it out shiftOnce(); enableOutput(); delayMicroseconds(micro); disableOutput(); }
void Shift::setRegister(uint8_t val) { //Initialize disableOutput(); clearRegister(); uint8_t high_bit = 1; //Shift values in for(int i=0; i<8; i++){ if(val & high_bit) digitalWrite(SR_INPUT_PIN, HIGH); else digitalWrite(SR_INPUT_PIN, LOW); shiftOnce(); high_bit = (high_bit << 1); } //Send it out shiftOnce(); enableOutput(); m_current_val = val; }
void BeagleGooP::enableOutput(char** outNames, int num) { debug(2,"BeagleGooP::enableOutput(names): enabling %i named pins\n", num); if (outNames == NULL || num <= 0 || num >= current) { debug(0,"BeagleGooP::enableOutput(): fail\n"); return; } bool *oe=new bool[current]; for (int i = 0; i < current; i++) oe[i] = false; for (int i = 0; i < num; i++) { if (outNames[i] == NULL) continue; int out = findPinIndex(outNames[i]); oe[out] = true; } for (int i = 0; i < current; i++) enableOutput(i, oe[i]); delete[] oe; }
void BeagleGooP::enableOutput(int* outs, int num) { debug(2,"BeagleGooP::enableOutput(arr): enabling %i pins\n", num); if (outs == NULL || num <= 0 || num>current ) { debug(0,"BeagleGooP::enableOutput(): fail (current=%i, num=%i)\n", current, num); return; } bool *oe=new bool[current]; for (int i = 0; i < current; i++) oe[i] = false; for (int i = 0; i < num; i++) { if (outs[i] < 0 || outs[i] > current) continue; oe[outs[i]] = true; } for (int i = 0; i < current; i++) enableOutput(i, oe[i]); delete[] oe; }
void BeagleGooP::enableOutput(bool enable) { for (int i = 0; i < current; i++) enableOutput(i, enable); }