这篇教程C++ timer_expired函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中timer_expired函数的典型用法代码示例。如果您正苦于以下问题:C++ timer_expired函数的具体用法?C++ timer_expired怎么用?C++ timer_expired使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了timer_expired函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: tty_write_timeout/* * On success return number of bytes sent */int tty_write_timeout(const unsigned char *buf, size_t size, int timeout){ time_t timer; int rc, pos = 0; DEB((D_TTYIO, "tty_write_timeout: want write %d byte(s), timeout = %d", size, timeout)); tty_status = TTY_SUCCESS; timer_set(&timer, timeout); while( pos < size ) { if( timer_expired(timer) ) { break; } else if( (rc = tty_write(buf + pos, size - pos)) < 0 ) { if( rc == TTY_TIMEOUT ) usleep(10000); /* 0.01 sec */ else return rc; } else /* ( rc > 0 ) */ { DEB((D_TTYIO, "tty_write_timeout: written %d byte(s)", rc)); pos += rc; } } return (pos > 0) ? pos : TTY_TIMEOUT;}
开发者ID:askovpen,项目名称:binkleyforce,代码行数:35,
示例2: PROCESS_THREADPROCESS_THREAD(ir_receiver_process, ev, data) { PROCESS_BEGIN(); while(1) { PROCESS_WAIT_EVENT(); if(ev == PROCESS_EVENT_POLL) { if(ir_repeat) { PRINTF("Got repeat signal /n"); ir_repeat = 0; } else { if(*(int32_t*)ir_prev_data != *(int32_t*)ir_last_data || timer_expired(&ir_rep_timer) || to_be_repeated()) { memcpy(ir_prev_data, ir_last_data, 4); timer_restart(&ir_rep_timer); PRINTF("Got new command %d,%d,%d,%d!/n", ir_last_data[0],ir_last_data[1],ir_last_data[2],ir_last_data[3]); broadcast_value(30); } else { timer_restart(&ir_rep_timer); } } } } PROCESS_END();}
开发者ID:stschake,项目名称:hexabus,代码行数:26,
示例3: weather_meter_interrupt_handler/*---------------------------------------------------------------------------*/static voidweather_meter_interrupt_handler(uint8_t port, uint8_t pin){ uint32_t aux; /* Prevent bounce events */ if(!timer_expired(&debouncetimer)) { return; } timer_set(&debouncetimer, DEBOUNCE_DURATION); /* We make a process_post() to check in the pollhandler any specific threshold * value */ if((port == ANEMOMETER_SENSOR_PORT) && (pin == ANEMOMETER_SENSOR_PIN)) { weather_sensors.anemometer.ticks++; process_post(&weather_meter_int_process, anemometer_int_event, NULL); } else if((port == RAIN_GAUGE_SENSOR_PORT) && (pin == RAIN_GAUGE_SENSOR_PIN)) { weather_sensors.rain_gauge.ticks++; aux = weather_sensors.rain_gauge.ticks * WEATHER_METER_AUX_RAIN_MM; aux /= 1000; weather_sensors.rain_gauge.value = (uint16_t)aux; process_post(&weather_meter_int_process, rain_gauge_int_event, NULL); }}
开发者ID:13416795,项目名称:contiki,代码行数:28,
示例4: slipdev_pollvoid SerialIPStack::tick(){ uip_len = slipdev_poll(); if(uip_len > 0) { uip_input(); // If the above function invocation resulted in data that // should be sent out on the network, the global variable // uip_len is set to a value > 0. if (uip_len > 0) slipdev_send(); } else if (timer_expired(&periodic_timer)) { timer_reset(&periodic_timer); for (int i = 0; i < UIP_CONNS; i++) { uip_periodic(i); // If the above function invocation resulted in data that // should be sent out on the network, the global variable // uip_len is set to a value > 0. if (uip_len > 0) slipdev_send(); }#if UIP_UDP for (int i = 0; i < UIP_UDP_CONNS; i++) { uip_udp_periodic(i); // If the above function invocation resulted in data that // should be sent out on the network, the global variable // uip_len is set to a value > 0. */ if (uip_len > 0) slipdev_send(); }#endif /* UIP_UDP */ }}
开发者ID:lstefani006,项目名称:teensy,代码行数:31,
示例5: user_button_value/*---------------------------------------------------------------------------*/static intuser_button_value(int type){ return (GPIO_READ_PIN(USER_BUTTON_PORT_BASE, USER_BUTTON_PIN_MASK) == 0) || !timer_expired(&debouncetimer);}
开发者ID:johangas,项目名称:thesis,代码行数:8,
示例6: igmp_group_periodicstatic void igmp_group_periodic(igmp_group_state_t *s){ switch (s->state) { case NON_MEMBER: case IDLE_MEMBER: break; case PENDING_JOIN: send_membership_report(s); s->flag = 1; s->state = DELAYED_MEMBER; timer_set(&s->timer, UNSOLICITED_REPORT_INTERVAL * CLOCK_SECOND); break; case DELAYED_MEMBER: if (timer_expired(&s->timer)) { send_membership_report(s); s->flag = 1; s->state = IDLE_MEMBER; } break; case PENDING_LEAVE: if (s->flag) send_leave_group(s); s->state = NON_MEMBER; break; } return;}
开发者ID:topiaruss,项目名称:xmostcptests,代码行数:28,
|