本文整理汇总了C++中pulse函数的典型用法代码示例。如果您正苦于以下问题:C++ pulse函数的具体用法?C++ pulse怎么用?C++ pulse使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pulse函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TLC5940_SetGS_And_GS_PWM
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++;
}
}
示例2: pulse
void Skin::timerEvent(QTimerEvent* event)
{
pulse(Pulse1, m_pulseDirection);
auto invert = pulse(Pulse2, m_pulseDirection);
if (invert)
m_pulseDirection = !m_pulseDirection;
}
示例3: pulsesequence
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();
}
示例4: switch
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;
}
示例5: setup
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);
}
示例6: pulse
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);
}
示例7: W_CLK
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);
}
示例8: pinMode
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);
}
示例9: pinMode
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;
}
示例10: digitalWrite
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);
}
示例11: set_rows
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);
}
}
示例12: pulse
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() );
}
示例13: pulsesequence
pulsesequence()
{
/* equilibrium period */
status(A);
hsdelay(d1);
/* --- tau delay --- */
status(B);
pulse(p1, zero);
hsdelay(d2);
/* --- observe period --- */
status(C);
pulse(pw,oph);
}
示例14: pulsesequence
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();
}
示例15: protocol_send
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;
}