void TLC5940_SetGS_And_GS_PWM(void) { uint8_t firstCycleFlag = 0; if (outputState(VPRG_PORT, VPRG_PIN)) { setLow(VPRG_PORT, VPRG_PIN); firstCycleFlag = 1; } uint16_t GSCLK_Counter = 0; uint8_t Data_Counter = 0; setLow(BLANK_PORT, BLANK_PIN); for (;;) { if (GSCLK_Counter > 4095) { setHigh(BLANK_PORT, BLANK_PIN); pulse(XLAT_PORT, XLAT_PIN); if (firstCycleFlag) { pulse(SCLK_PORT, SCLK_PIN); firstCycleFlag = 0; } break; } else { if (!(Data_Counter > TLC5940_N * 192 - 1)) { if (gsData[Data_Counter]) setHigh(SIN_PORT, SIN_PIN); else setLow(SIN_PORT, SIN_PIN); pulse(SCLK_PORT, SCLK_PIN); Data_Counter++; } } pulse(GSCLK_PORT, GSCLK_PIN); GSCLK_Counter++; } }
void Skin::timerEvent(QTimerEvent* event) { pulse(Pulse1, m_pulseDirection); auto invert = pulse(Pulse2, m_pulseDirection); if (invert) m_pulseDirection = !m_pulseDirection; }
void pulsesequence() { double tro; char gread,gphase,gslice; char grdname[MAXSTR]; gread = 'z'; if (getorientation(&gread,&gphase,&gslice,"orient") < 0) abort_message("illegal value in orient parameter"); gro = getval("gro"); tro = getval("tro"); getstr("gname",grdname); /* equilibrium period */ status(A); hsdelay(d1); /* --- tau delay --- */ status(B); pulse(p1, zero); hsdelay(d2); /* --- observe period --- */ status(C); pulse(pw,oph); delay(0.0001); shapedgradient(grdname,tro,gro,gread,1,1); hsdelay(d2); startacq(alfa); acquire(np,1.0/sw); endacq(); }
float WaspSensorGas::readValue(uint16_t sensor) { uint16_t aux=0; switch( sensor ) { case SENS_TEMPERATURE : aux=analogRead(ANALOG1); break; case SENS_HUMIDITY : aux=analogRead(ANALOG4); break; case SENS_PRESSURE : aux=analogRead(ANALOG5); break; case SENS_CO2 : aux=analogRead(ANALOG3); break; case SENS_O2 : aux=analogRead(ANALOG3); break; case SENS_SOCKET2A : aux=analogRead(ANALOG2); break; case SENS_SOCKET2B : aux=analogRead(ANALOG2); break; case SENS_SOCKET3A : aux=analogRead(ANALOG7); break; case SENS_SOCKET3B : aux=pulse(SENS_SOCKET3B); break; case SENS_SOCKET3C : aux=pulse(SENS_SOCKET3C); break; case SENS_SOCKET4A : aux=analogRead(ANALOG6); break; case SENS_SOCKET4B : aux=pulse(SENS_SOCKET4B); break; case SENS_SOCKET4C : aux=pulse(SENS_SOCKET4C); break; } return (aux*3.3)/1023; }
void setup() { Serial.begin(19200); pinMode(LED_PMODE, OUTPUT); pulse(LED_PMODE, 2); pinMode(LED_ERR, OUTPUT); pulse(LED_ERR, 2); pinMode(LED_HB, OUTPUT); pulse(LED_HB, 2); }
void AD9850::down() { pulse(FQ_UD); uint8_t p = 0x04; for (int i = 0; i < 8; i++, p >>= 1) { digitalWrite(D7, p & (uint8_t)0x01); pulse(W_CLK); } pulse(FQ_UD); }
AD9850::AD9850(char w_clk, char fq_ud, char d7) : W_CLK(w_clk), FQ_UD(fq_ud), D7(d7) { frequency = 0; phase = 0; pinMode(W_CLK, OUTPUT); pinMode(FQ_UD, OUTPUT); pinMode(D7, OUTPUT); pulse(W_CLK); pulse(FQ_UD); }
void AD9850::begin_priv() { pinMode(W_CLK, OUTPUT); pinMode(FQ_UD, OUTPUT); pinMode(DATA, OUTPUT); pinMode(RESET, OUTPUT); pulse(RESET); pulse(W_CLK); pulse(FQ_UD); }
DHT11Result DHT11::read() { pinMode(_pin, OUTPUT); digitalWrite(_pin, LOW); delay(20); uint32_t cycles[80]; noInterrupts(); { pinMode(_pin, INPUT_PULLUP); if (pulseIn(_pin, HIGH) == 0) { return prepareErrorResult("Timeout waiting for start signal LOW pulse"); } for (int i = 0; i < 80; i+= 2) { cycles[i] = pulse(LOW, 150); cycles[i + 1] = pulse(HIGH, 150); } interrupts(); } uint32_t data[5]; data[0] = data[1] = data[2] = data[3] = data[4] = 0; for (int i = 0; i < 40; ++i) { uint32_t lowCycles = cycles[2 * i]; uint32_t highCycles = cycles[2 * i + 1]; data[i/8] <<= 1; if (highCycles > lowCycles) { data[i/8] |= 1; } } uint32_t calculatedParity = (data[0] + data[1] + data[2] + data[3]) & 0xFF; if (data[4] != calculatedParity) { return prepareErrorResult("Parity check failed"); } DHT11Result result; result.hasError = false; result.errorMessage = ""; result.humidity = data[0]; result.temperatureC = data[2]; return result; }
void AD9850::update() { uint32_t f = frequency; for (int i = 0; i < 32; i++, f >>= 1) { digitalWrite(D7, f & (uint32_t)0x00000001); pulse(W_CLK); } uint8_t p = phase; for (int i = 0; i < 8; i++, p >>= 1) { digitalWrite(D7, p & (uint8_t)0x01); pulse(W_CLK); } pulse(FQ_UD); }
void set_rows(uint16_t data, uint8_t direction) { for(uint8_t i=0; i<ROWS; i++) { if(((data & (1<<i))>>i) == 1) { if(direction == 1) { set_row(i,((data & (1<<i))>>i)); pulse(); set_row(i,0); } else { clear_row(i,((data & (1<<i))>>i)); pulse(); clear_row(i,0); } }
void Varilabel::mouseMoveEvent( QMouseEvent *e ) { static int previous_y; // 1 pulse every 10 pixels if ( e->y() > previous_y + 10 || e->y() < previous_y - 10) { if ( e->y() > previous_y ) emit pulse( -1 ); else emit pulse( 1 ); previous_y = e->y(); } // 1 pulse every pixel emit y( e->y() ); }
pulsesequence() { /* equilibrium period */ status(A); hsdelay(d1); /* --- tau delay --- */ status(B); pulse(p1, zero); hsdelay(d2); /* --- observe period --- */ status(C); pulse(pw,oph); }
pulsesequence() { char lkflg[MAXSTR]; getstr("lkflg",lkflg); status(A); dec3blank(); if (lkflg[A]=='y') lk_sample(); hsdelay(d1); status(B); pulse(p1, zero); hsdelay(d2); status(C); pulse(pw,oph); if (lkflg[A]=='y') lk_hold(); dec3unblank(); }
bool protocol_send(uint16_t address, uint16_t command, sent_cb_t* cb) { // gpiote0 (toggles gpio) NRF_GPIOTE->POWER = GPIOTE_POWER_POWER_Enabled << GPIOTE_POWER_POWER_Pos; nrf_gpiote_task_config(0, context.led_pin, NRF_GPIOTE_POLARITY_TOGGLE, NRF_GPIOTE_INITIAL_VALUE_LOW); if (context.state != PROTOCOL_STATE_IDLE) { return false; } context.state = PROTOCOL_STATE_PREAMBLE_DONE; context.address = address; context.command = command; context.cb = cb; NRF_POWER->TASKS_CONSTLAT = 1; // PAN 11 "HFCLK: Base current with HFCLK running is too high" NRF_RTC1->TASKS_STOP = 1; NRF_RTC1->TASKS_CLEAR = 1; NRF_RTC1->PRESCALER = ROUNDED_DIV(LFCLK_FREQUENCY, ROUNDED_DIV(1000000, context.protocol->preamble.leader + context.protocol->preamble.pause - RTC_TASK_JITTER )) - 1; NRF_RTC1->CC[0] = 1; NRF_RTC1->TASKS_START = 1; pulse(ROUNDED_DIV(context.protocol->preamble.leader, context.protocol->pulse_width)); return true; }
void LiquidCrystal::send(uint8 cmd, bool mode) { set_pin(rs_pin, mode); etk::Bits<uint8> b(cmd); for (int i = 4; i < 8; i++) set_pin(data_pins[i-4], b.read_bit(i)); pulse(); for (int i = 0; i < 4; i++) set_pin(data_pins[i], b.read_bit(i)); pulse(); busy_wait(); }
void inputParameters::parseFieldInfo(boost::property_tree::ptree &IP) { if (jobtype_ == JOBTYPE::ADIABATIC) { // Import parameters initial_intensity_ = IP.get<double>("Field.initial_intensity",1.0e8); final_intensity_ = IP.get<double>("Field.final_intensity",1.0e12); intensity_increment_ = IP.get<double>("Field.intensity_increment",10.0); add_increment_ = IP.get<bool>("Field.add_increment",false); // Change to atomic units initial_intensity_ /= CONSTANTS::LASERINTEN; final_intensity_ /= CONSTANTS::LASERINTEN; if (add_increment_) intensity_increment_ /= CONSTANTS::LASERINTEN; } else if (jobtype_ == JOBTYPE::NONADIABATIC) { double FWHMFactor = 2.0*sqrt(2.0*log(2.0)); for (auto &p : IP.get_child("Field.pulses")) { double sig = p.second.get<double>("pulse_fwhm",100.0)*CONSTANTS::AUperFS/ FWHMFactor; pulses_.push_back( pulse( p.second.get<double>("pulse_max_intensity",1.0e12)/CONSTANTS::LASERINTEN, sig, p.second.get<double>("pulse_center",10.0)*CONSTANTS::AUperFS)); } } }
pulsesequence() { double pp; pp = getval("pp"); /* calculate phases */ mod2(ct,v1); /* 0101 */ dbl(v1,v1); /* 0202 */ hlv(ct,v2); /* 0011 2233 */ mod2(v2,v2); /* 0011 0011 */ add(v1,v2,v1); /* 0213 0213*/ assign(v1,oph); status(A); hsdelay(d1); status(B); pulse(pw, v1); delay(d2); if (declvlonoff) declvlon(); /* sets power to pplvl */ else decpower(pplvl); simpulse(p1, pp, v1, v1, rof1, rof1); if (declvlonoff) declvloff(); else decpower(dpwr); delay(d2); status(C); }
void SR04::read() { if (millis() - pulseTime > 100) { pulse(); return; } if (!pulsed) { return; } long now = micros(); if (now - time < 500) { return; } else { if (now - time > 3000) { calibrate(3000); return; } else { if (digitalRead(_echo) == 0) { calibrate(now - time); return; } else { return; } } } }
void pulsesequence() { double gzlvl1,gt1; char gradaxis[MAXSTR]; getstrnwarn("gradaxis",gradaxis); if (( gradaxis[0] != 'x') && ( gradaxis[0] != 'y') && ( gradaxis[0] != 'z') ) strcpy(gradaxis,"z"); gzlvl1 = getval("gzlvl1"); gt1 = getval("gt1"); status(A); read_in_eddys(gradaxis[0]); delay(d1); status(B); rgradient(gradaxis[0],0.0); send_eddys(gradaxis[0],0.00005); delay(2e-3); shgradpulse(gzlvl1,gt1); delay(d2); status(C); pulse(pw,oph); }
pulsesequence() { double gzlvl1; double td; char gradaxis[MAXSTR]; dbl(oph,v1); mod4(v1,v1); hlv(v1,v1); hlv(ct,v2); hlv(v2,v2); mod4(v2,v2); dbl(v2,v2); add(v1,v2,v1); getstrnwarn("gradaxis",gradaxis); if (( gradaxis[0] != 'x') && ( gradaxis[0] != 'y') && ( gradaxis[0] != 'z') ) strcpy(gradaxis,"z"); gzlvl1 = getval("gzlvl1"); at = getval("at"); status(A); delay(d1); status(B); td = (d2-at/2.0)/2.0; if (td < 0.0) td = 0.0; rgpulse(p1,oph,rof1,rof2); delay(td); rgradient(gradaxis[0],gzlvl1); delay(at/2.0); rgradient(gradaxis[0],0.0); delay(td); status(C); pulse(pw,v1); delay(d2-at/2.0); rgradient(gradaxis[0],gzlvl1); delay(0.0001); /* let gradient stabilize */ /* rely on psg safety to turn off gradient */ }
static inline void shift_bit(shiftbrite* sb, uint16_t val) { if (val) { P1OUT |= sb->data_pin; } else { P1OUT &= ~(sb->data_pin); } pulse(sb->clock_pin); }
void LiquidCrystal::write_bits(uint8 value) { etk::Bits<uint8> b(value); for (int i = 0; i < 4; i++) set_pin(data_pins[i], b.read_bit(i)); pulse(); }
void AD9850::update() { for (int i=0; i<4; i++, deltaphase>>=8) { shiftOut(DATA, W_CLK, LSBFIRST, deltaphase & 0xFF); } shiftOut(DATA, W_CLK, LSBFIRST, phase & 0xFF); pulse(FQ_UD); }
static void clock_bit_position(uint16_t data) { uint8_t bit = (data & (1 << context.bit_position)) > 0; struct ir_protocol_logical *logical = (bit ^ context.invert) ? &context.protocol->one : &context.protocol->zero; NRF_RTC1->CC[0] += logical->ticks; pulse(logical->pulses); }
void Scanner::take_reading(const int heading) { //the servo is already in the right position when this method is //called so we just need to bang the sonar, get the measurement //and then save it to the scan long dur = pulse(); int cm = us_to_cm(dur); scan.update_by_heading(heading, cm); }
void Player::autoHideTimeout() { if (m_autoHideDuration > 0) { m_autoHideDuration -= m_timerAutoHide.interval(); emit pulse(tick() - m_pauseStart + m_lastSubtitles.at(0)->msseStart()); } else { emit autoHide(); m_timerAutoHide.stop(); } }
void IndexServer::_StartWatchingAddOns() { AddHandler(&fAddOnMonitorHandler); BMessage pulse(B_PULSE); fPulseRunner = new BMessageRunner(&fAddOnMonitorHandler, &pulse, 1000000LL); // the monitor handler needs a pulse to check if add-ons are ready &fAddOnMonitorHandler->AddAddOnDirectories("index_server"); }
void TLC5940_ClockInDC(void) { setHigh(DCPRG_PORT, DCPRG_PIN); setHigh(VPRG_PORT, VPRG_PIN); uint8_t Counter = 0; for (;;) { if (Counter > TLC5940_N * 96 - 1) { pulse(XLAT_PORT, XLAT_PIN); break; } else { if (dcData[Counter]) setHigh(SIN_PORT, SIN_PIN); else setLow(SIN_PORT, SIN_PIN); pulse(SCLK_PORT, SCLK_PIN); Counter++; } } }
/* * Class: edu_wpi_first_wpilibj_hal_DIOJNI * Method: pulse * Signature: (JD)V */ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_DIOJNI_pulse (JNIEnv *env, jclass, jlong id, jdouble value) { DIOJNI_LOG(logDEBUG) << "Calling DIOJNI pulse (RR upd)"; //DIOJNI_LOG(logDEBUG) << "Port Ptr = " << (void*)id; //DIOJNI_LOG(logDEBUG) << "Value = " << value; int32_t status = 0; pulse((void*)id, value, &status); DIOJNI_LOG(logDEBUG) << "Did it work? Status = " << status; CheckStatus(env, status); }