本文整理汇总了C++中PROCESS_YIELD_UNTIL函数的典型用法代码示例。如果您正苦于以下问题:C++ PROCESS_YIELD_UNTIL函数的具体用法?C++ PROCESS_YIELD_UNTIL怎么用?C++ PROCESS_YIELD_UNTIL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PROCESS_YIELD_UNTIL函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: PROCESS_THREAD
PROCESS_THREAD(onboard_flash_test_process, ev, data)
{
PROCESS_BEGIN();
etimer_set(&et, CLOCK_SECOND * 5);
PROCESS_YIELD_UNTIL(etimer_expired(&et));
while(RUNNING) {
printf("Starting test...\n");
int ret = coffee_file_test();
printf("Test finished with %d\n", ret);
printf("Result: ");
if( ret == 0 ) {
printf("SUCCESS\n");
RUNNING = 0;
} else {
printf("FAILURE\n");
printf("Formatting Flash...");
fflush(stdout);
cfs_coffee_format();
printf("OK\n");
}
etimer_set(&et, CLOCK_SECOND * 60);
PROCESS_YIELD_UNTIL(etimer_expired(&et));
}
PROCESS_END();
}
开发者ID:DrMcCoy,项目名称:contiki-inga,代码行数:31,代码来源:onboard-flash.c
示例2: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(rd_client_process, ev, data)
{
static struct etimer et;
static coap_packet_t request[1]; /* This way the packet can be treated as pointer as usual. */
static char query_buffer[200];
static char rd_client_name[64];
PROCESS_BEGIN();
PROCESS_PAUSE();
PRINTF("RD client started\n");
sprintf(rd_client_name, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
uip_lladdr.addr[0], uip_lladdr.addr[1], uip_lladdr.addr[2], uip_lladdr.addr[3],
uip_lladdr.addr[4], uip_lladdr.addr[5], uip_lladdr.addr[6], uip_lladdr.addr[7]);
while(1) {
new_address = 0;
while(!registered) {
while(uip_is_addr_unspecified(&rd_server_ipaddr)) {
status = RD_CLIENT_UNCONFIGURED;
PROCESS_YIELD();
}
status = RD_CLIENT_REGISTERING;
etimer_set(&et, CLOCK_SECOND);
PROCESS_YIELD_UNTIL(etimer_expired(&et));
PRINTF("Registering to ");
PRINT6ADDR(&rd_server_ipaddr);
PRINTF(" %d with %s\n", rd_server_port, resources_list);
coap_init_message(request, COAP_TYPE_CON, COAP_POST, 0);
coap_set_header_uri_path(request, "rd");
sprintf(query_buffer, "ep=%s&b=U<=%d", rd_client_name, RD_CLIENT_LIFETIME);
coap_set_header_uri_query(request, query_buffer);
coap_set_payload(request, (uint8_t *) resources_list, resources_list_size);
COAP_BLOCKING_REQUEST_BLOCK_RESPONSE(coap_default_context, &rd_server_ipaddr, UIP_HTONS(rd_server_port), request, client_registration_request_handler, client_registration_response_handler);
}
status = RD_CLIENT_REGISTERED;
etimer_set(&et, RD_CLIENT_LIFETIME * CLOCK_SECOND / 10 * 9);
PROCESS_YIELD_UNTIL(etimer_expired(&et) || new_address);
registered = 0;
if(!new_address) {
PRINTF("Update endpoint %s\n", registration_name);
coap_init_message(request, COAP_TYPE_CON, COAP_PUT, 0);
coap_set_header_uri_path(request, registration_name);
sprintf(query_buffer, "b=U<=%d", RD_CLIENT_LIFETIME);
coap_set_header_uri_query(request, query_buffer);
COAP_BLOCKING_REQUEST(coap_default_context, &rd_server_ipaddr, UIP_HTONS(rd_server_port), request, client_update_response_handler);
}
}
PROCESS_END();
}
开发者ID:Scypho,项目名称:6lbr,代码行数:53,代码来源:rd-client.c
示例3: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(cc1101_process, ev, data)
{
PROCESS_POLLHANDLER(pollhandler());
PROCESS_BEGIN();
#if 0
while(1) {
static struct etimer et;
uint8_t rxbytes, txbytes;
etimer_set(&et, CLOCK_SECOND * 4);
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
// cc1101_rx_interrupt();
burst_read(CC1101_RXBYTES, &rxbytes, 1);
burst_read(CC1101_TXBYTES, &txbytes, 1);
printf("state 0x%02x rxbytes 0x%02x txbytes 0x%02x\n",
state(), rxbytes, txbytes);
on();
}
#endif /* 0 */
PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_EXIT);
PROCESS_END();
}
开发者ID:ADVANSEE,项目名称:mist,代码行数:27,代码来源:cc1101.c
示例4: PROCESS_THREAD
/* Process to handle input packets
* Receive interrupts cause this process to be polled
* It calls the core MAC layer which calls rf230_read to get the packet
*/
PROCESS_THREAD(nrf24l01_process, ev, data)
{
PROCESS_BEGIN();
while(1)
{
PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL);
#if RF230_TIMETABLE_PROFILING
TIMETABLE_TIMESTAMP(rf230_timetable, "poll");
#endif /* RF230_TIMETABLE_PROFILING */
if(receiver_callback != NULL)
{
receiver_callback(&nrf24l01_driver);
#if RF230_TIMETABLE_PROFILING
TIMETABLE_TIMESTAMP(rf230_timetable, "end");
timetable_aggregate_compute_detailed(&aggregate_time,
&rf230_timetable);
timetable_clear(&rf230_timetable);
#endif /* RF230_TIMETABLE_PROFILING */
}
else
{
PRINTF("nrf24l01_process not receiving function\n");
//flushrx();
}
}
PROCESS_END();
}
开发者ID:arbraham,项目名称:hummingbird,代码行数:36,代码来源:nrf24l01.c
示例5: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(uz2400_process, ev, data)
{
int len;
PROCESS_BEGIN();
PRINTF("uz2400_process: started\n");
while(1) {
PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL);
//#if UZ2400_TIMETABLE_PROFILING
// TIMETABLE_TIMESTAMP(uz2400_timetable, "poll");
//#endif /* UZ2400_TIMETABLE_PROFILING */
PRINTF("uz2400_process: calling receiver callback\n");
packetbuf_clear();
packetbuf_set_attr(PACKETBUF_ATTR_TIMESTAMP, last_packet_timestamp);
len = uz2400_read(packetbuf_dataptr(), PACKETBUF_SIZE);
packetbuf_set_datalen(len);
NETSTACK_RDC.input();
/* flushrx(); */
//#if UZ2400_TIMETABLE_PROFILING
// TIMETABLE_TIMESTAMP(uz2400_timetable, "end");
// timetable_aggregate_compute_detailed(&aggregate_time,
// &uz2400_timetable);
// timetable_clear(&uz2400_timetable);
//#endif /* UZ2400_TIMETABLE_PROFILING */
//EXTI4_ClearBit();
}
PROCESS_END();
}
开发者ID:Simonliang0928,项目名称:Contiki-BORDER,代码行数:35,代码来源:uz2400.c
示例6: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(cc2420_process, ev, data)
{
PROCESS_BEGIN();
PRINTF("cc2420_process: started\n");
while(1) {
PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL);
#if CC2420_TIMETABLE_PROFILING
TIMETABLE_TIMESTAMP(cc2420_timetable, "poll");
#endif /* CC2420_TIMETABLE_PROFILING */
if(receiver_callback != NULL) {
PRINTF("cc2420_process: calling receiver callback\n");
receiver_callback(&cc2420_driver);
#if CC2420_TIMETABLE_PROFILING
TIMETABLE_TIMESTAMP(cc2420_timetable, "end");
timetable_aggregate_compute_detailed(&aggregate_time,
&cc2420_timetable);
timetable_clear(&cc2420_timetable);
#endif /* CC2420_TIMETABLE_PROFILING */
} else {
PRINTF("cc2420_process not receiving function\n");
flushrx();
}
}
PROCESS_END();
}
开发者ID:kincki,项目名称:contiki,代码行数:30,代码来源:cc2420.c
示例7: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(etimer_test_process, ev, data)
{
PROCESS_BEGIN();
TEST_BEGIN("etimer-test");
static int idx;
for(idx = 0; idx < TEST_CONF_ETIMERS; idx++) {
etimer_set(&et[idx], times[idx]);
}
idx = 0;
while(running) {
PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_TIMER);
printf("event arrived from\n", data);
// check if events arrive in the same order we placed them
TEST_EQUALS((struct etimer*) data - &et[0], evt_orders[idx++]);
if (idx == TEST_CONF_ETIMERS) {
TESTS_DONE();
}
}
TEST_END();
PROCESS_END();
}
开发者ID:ibr-cm,项目名称:contiki-inga,代码行数:33,代码来源:etimer-test.c
示例8: PROCESS_THREAD
PROCESS_THREAD(cloudcomm_test, ev, data) {
// lets us know that we can keep transmitting
PROCESS_BEGIN();
uint8_t i = 0;
cloudcomm_set_packet_length(sizeof(opo_data_t));
simplestore_clear_flash_chip();
m.dest = &murl[0];
m.dest_len = 34;
cloudcomm_set_metainfo(&m);
cctestvtimer = get_vtimer(vcallback);
schedule_vtimer(&cctestvtimer, VTIMER_SECOND * 10);
PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL);
request_cloudcomm_data(CLOUDCOMM_REQ_TIME);
leds_on(LEDS_GREEN);
for(i=0;i<24;i++) {
test[i].version_num = 0xaabb;
test[i].rx_id = i;
test[i].tx_id = 0x02;
test[i].range_dt = 0xbbccddee;
test[i].ul_dt = 0x00;
test[i].m_unixtime = 0;
test[i].m_time_confidence = 1;
test[i].failed_rx_count = 2;
test[i].tx_unixtime = 3;
test[i].tx_time_confidence = 4;
test[i].ul_rf_dt = 5;
cloudcomm_store(&test[i]);
}
cloudcomm_on(woot, 30000);
PROCESS_END();
}
开发者ID:lab11,项目名称:opo,代码行数:35,代码来源:cloudcomm-test.c
示例9: PROCESS_THREAD
PROCESS_THREAD(ctimer_process, ev, data)
{
struct ctimer *c;
PROCESS_BEGIN();
for(c = list_head(ctimer_list); c != NULL; c = c->next) {
etimer_set(&c->etimer, c->etimer.tmr.interval);
}
initialized = 1;
while(1) {
PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_TIMER);
for(c = list_head(ctimer_list); c != NULL; c = c->next) {
if(&c->etimer == data) {
list_remove(ctimer_list, c);
PROCESS_CONTEXT_BEGIN(c->p);
if(c->f != NULL) {
c->f(c->ptr);
}
PROCESS_CONTEXT_END(c->p);
break;
}
}
}
PROCESS_END();
}
开发者ID:ajwlucas,项目名称:lib_xtcp,代码行数:26,代码来源:ctimer.c
示例10: PROCESS_THREAD
PROCESS_THREAD(tcp_process, ev, data)
{
static char incoming[10];
static struct psock ps;
PROCESS_BEGIN();
uart0_set_br(1000000);
tcp_listen(UIP_HTONS(2020));
while(1) {
PROCESS_YIELD();
}
{
/* wait for tcp connection */
PROCESS_WAIT_EVENT_UNTIL(ev==tcpip_event && uip_connected());
/* start estimator process and init psock connection handler */
process_start(&ahrs_process, NULL);
PSOCK_INIT(&ps,incoming,sizeof(incoming));
/* loop until connection is closed */
while (!(uip_aborted() || uip_closed() || uip_timedout())) {
PROCESS_YIELD_UNTIL(ev==tcpip_event);
handle_connection(&ps);
}
/* stop ahrs process */
process_exit(&ahrs_process);
}
PROCESS_END();
}
开发者ID:cloud-hot,项目名称:Jennisense,代码行数:35,代码来源:ahrs_estimate.c
示例11: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(rx_data_process, ev, data)
{
PROCESS_BEGIN();
/* Process is polled whenever data is available from uart isr */
uint8_t c;
while(1) {
PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL);
/* Read RX ringbuffer. ASCII chars Output when LF is seen.
If overflowed, strings are skipped */
do {
if (get_ringbuf(&c) == -1) {
break; /* No more rx char's in ringbuffer */
} else {
if (rx_buf_index == RX_BUFFER_SIZE) { /* Skip current content if buffer full */
rx_buf_index = 0;
}
rx_buf[rx_buf_index++] = c;
if ((c == '\n')||(c == '\r')) {
rx_buf[rx_buf_index] = '\0';
printf("RX on UART1: %s", rx_buf);
/* Signal event to coap clients.
Demo assumes data is consumed before new data comes in */
event_coap_rx_uart1_handler();
rx_buf_index = 0;
}
}
} while (1);
}
PROCESS_END();
}
开发者ID:1847123212,项目名称:ampm_contiki_wisun,代码行数:33,代码来源:uart1-test-node.c
示例12: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(stm32w_radio_process, ev, data)
{
int len;
PROCESS_BEGIN();
PRINTF("stm32w_radio_process: started\r\n");
while(1) {
PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL);
PRINTF("stm32w_radio_process: calling receiver callback\r\n");
#if DEBUG > 1
for(uint8_t c = 1; c <= RCVD_PACKET_LEN; c++) {
PRINTF("%x", stm32w_rxbuf[c]);
}
PRINTF("\r\n");
#endif
packetbuf_clear();
len = stm32w_radio_read(packetbuf_dataptr(), PACKETBUF_SIZE);
if(len > 0) {
packetbuf_set_datalen(len);
NETSTACK_RDC.input();
}
if(!RXBUFS_EMPTY()) {
/*
* Some data packet still in rx buffer (this happens because process_poll
* doesn't queue requests), so stm32w_radio_process needs to be called
* again.
*/
process_poll(&stm32w_radio_process);
}
}
PROCESS_END();
}
开发者ID:1uk3,项目名称:contiki,代码行数:35,代码来源:stm32w-radio.c
示例13: PROCESS_THREAD
/**
* \brief Radio RF233 process, infinitely awaits a poll, then checks radio
* state and handles received data.
*/
PROCESS_THREAD(rf233_radio_process, ev, data)
{
int len;
PROCESS_BEGIN();
PRINTF("RF233: started.\r\n");
while(1) {
PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL);
PRINTF("RF233: polled.\r\n");
if(interrupt_callback_wants_poll) {
rf233_interrupt_poll();
}
packetbuf_clear();
// packetbuf_set_attr(PACKETBUF_ATTR_TIMESTAMP, last_packet_timestamp);
len = rf233_read(packetbuf_dataptr(), PACKETBUF_SIZE);
if(len > 0) {
packetbuf_set_datalen(len);
NETSTACK_RDC.input();
} else {
PRINTF("RF233: error while reading: %d\r\n", len);
}
}
PROCESS_END();
}
开发者ID:songjw0820,项目名称:contiki_atmel,代码行数:30,代码来源:rf233.c
示例14: PROCESS_THREAD
PROCESS_THREAD(sync_master, ev, data)
{
static int i=0;
static struct uip_udp_conn *udp;
PROCESS_BEGIN();
udp = udp_new(NULL, UIP_HTONS(10000), NULL);
uip_udp_bind(udp, UIP_HTONS(10000));
uart0_init(1000000);
while(1)
{
PROCESS_YIELD_UNTIL(ev == tcpip_event);
int i;
for (i = 0; i < 16; i++)
uart0_writeb(UDP_HDR->srcipaddr.u8[i]);
for (i = 0; i < uip_datalen(); i++)
{
uart0_writeb(((uint8_t*)uip_appdata)[i]);
}
}
PROCESS_END();
}
开发者ID:cloud-hot,项目名称:Jennisense,代码行数:25,代码来源:main.c
示例15: PROCESS_THREAD
/* The main TSCH process */
PROCESS_THREAD(tsch_process, ev, data)
{
static struct pt scan_pt;
PROCESS_BEGIN();
while(1) {
while(!tsch_is_associated) {
if(tsch_is_coordinator) {
/* We are coordinator, start operating now */
tsch_start_coordinator();
} else {
/* Start scanning, will attempt to join when receiving an EB */
PROCESS_PT_SPAWN(&scan_pt, tsch_scan(&scan_pt));
}
}
/* We are part of a TSCH network, start slot operation */
tsch_slot_operation_start();
/* Yield our main process. Slot operation will re-schedule itself
* as long as we are associated */
PROCESS_YIELD_UNTIL(!tsch_is_associated);
/* Will need to re-synchronize */
tsch_reset();
}
PROCESS_END();
}
开发者ID:1847123212,项目名称:ampm_contiki_wisun,代码行数:32,代码来源:tsch.c
示例16: PROCESS_THREAD
PROCESS_THREAD(opo8001rxtx, ev, data) {
PROCESS_BEGIN();
register_opo_rx_callback((opo_rx_callback_t) opo_rx_callback);
register_opo_tx_callback(opo_tx_callback);
tx_delay = get_vtimer(tx_delay_callback);
process_start(&opo8001rx, NULL);
process_start(&opo8001tx, NULL);
process_start(&opo8001ccon, NULL);
cc_metadata.dest = &murl[0];
cc_metadata.dest_len = 34;
cloudcomm_set_packet_length(sizeof(opo_data_t));
cloudcomm_set_metainfo(&cc_metadata);
char buffer[50];
snprintf(buffer, 50, "Opo Data Size: %u", sizeof(opo_data_t));
send_rf_debug_msg(buffer);
cloudcomm_clear_data();
cloudcomm_request_data(CLOUDCOMM_REQ_TIME);
cloudcomm_on(init_callback, 0);
PROCESS_YIELD_UNTIL(ev==PROCESS_EVENT_POLL);
unsigned short randtime = generate_rand_tx();
schedule_vtimer(&tx_delay, VTIMER_SECOND + (VTIMER_SECOND/1000 * randtime));
enable_opo_rx();
PROCESS_END();
}
开发者ID:lab11,项目名称:opo,代码行数:25,代码来源:opo8001rxtx.c
示例17: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(cc2420_process, ev, data)
{
int len;
PROCESS_BEGIN();
PRINTF("cc2420_process: started\n");
while(1) {
PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL);
#if CC2420_TIMETABLE_PROFILING
TIMETABLE_TIMESTAMP(cc2420_timetable, "poll");
#endif /* CC2420_TIMETABLE_PROFILING */
PRINTF("cc2420_process: calling receiver callback\n");
packetbuf_clear();
packetbuf_set_attr(PACKETBUF_ATTR_TIMESTAMP, last_packet_timestamp);
len = cc2420_read(packetbuf_dataptr(), PACKETBUF_SIZE);
packetbuf_set_datalen(len);
NETSTACK_RDC.input();
#if CC2420_TIMETABLE_PROFILING
TIMETABLE_TIMESTAMP(cc2420_timetable, "end");
timetable_aggregate_compute_detailed(&aggregate_time,
&cc2420_timetable);
timetable_clear(&cc2420_timetable);
#endif /* CC2420_TIMETABLE_PROFILING */
}
PROCESS_END();
}
开发者ID:leoqin,项目名称:Contiki-leo,代码行数:33,代码来源:cc2420.c
示例18: PROCESS_THREAD
PROCESS_THREAD(uwb_process, ev, data)
{
int len;
PROCESS_BEGIN();
UWBPROCESSFLAG(01);
while(1) {
PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL);
UWBPROCESSFLAG(02);
if (uwb_fsm != UWB_STATE_RX_PROCESS_POLLED)
PRINTF("uwb: wrong state in process: %u\n",uwb_fsm);
packetbuf_clear();
len = ram_rx_buffer[2];
if ((len > 0) && (len < PACKETBUF_SIZE))
{
memcpy(packetbuf_dataptr(),&ram_rx_buffer[3],len);
packetbuf_set_datalen(len);
UWBPROCESSFLAG(03);
NETSTACK_RDC.input();
}
/* switch back to listen-state */
PRINTF("uwb: enabling rx-mode\r\n");
enable_rx_mode();
PRINTF("uwb: read: %u bytes\n",len);
UWBPROCESSFLAG(04);
}
PROCESS_END();
}
开发者ID:bearxiong99,项目名称:tdma_demo,代码行数:35,代码来源:uwb.c
示例19: PROCESS_THREAD
PROCESS_THREAD(ledtest_process, ev, data)
{
static struct etimer timer;
static u8_t i;
PROCESS_BEGIN();
for (i=0; i<sizeof(leds); i++) {
etimer_set(&timer, 500);
PROCESS_YIELD_UNTIL(ev==PROCESS_EVENT_TIMER);
leds_on(leds[i]);
}
etimer_set(&timer, 500);
PROCESS_YIELD_UNTIL(ev==PROCESS_EVENT_TIMER);
leds_off(LEDS_ALL);
PROCESS_END();
}
开发者ID:hopfgarten,项目名称:contiki-jn51xx,代码行数:17,代码来源:contiki-main.c
示例20: PROCESS_THREAD
PROCESS_THREAD(glossy_print_stats_process, ev, data)
{
PROCESS_BEGIN();
while(1) {
PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL);
// Print statistics only if Glossy is not still bootstrapping.
if (!GLOSSY_IS_BOOTSTRAPPING()) {
if (get_rx_cnt()) { // Packet received at least once.
// Increment number of successfully received packets.
packets_received++;
// Compute latency during last Glossy phase.
rtimer_clock_t lat = get_t_first_rx_l() - get_t_ref_l();
// Add last latency to sum of latencies.
sum_latency += lat;
// Convert latency to microseconds.
latency = (unsigned long)(lat) * 1e6 / RTIMER_SECOND;
// Print information about last packet and related latency.
printf("Glossy received %u time%s: seq_no %lu, latency %lu.%03lu ms\n",
get_rx_cnt(), (get_rx_cnt() > 1) ? "s" : "", glossy_data.seq_no,
latency / 1000, latency % 1000);
} else { // Packet not received.
// Increment number of missed packets.
packets_missed++;
// Print failed reception.
printf("Glossy NOT received\n");
}
#if GLOSSY_DEBUG
// printf("skew %ld ppm\n", (long)(period_skew * 1e6) / GLOSSY_PERIOD);
printf("high_T_irq %u, rx_timeout %u, bad_length %u, bad_header %u, bad_crc %u\n",
high_T_irq, rx_timeout, bad_length, bad_header, bad_crc);
#endif /* GLOSSY_DEBUG */
// Compute current average reliability.
unsigned long avg_rel = packets_received * 1e5 / (packets_received + packets_missed);
// Print information about average reliability.
printf("average reliability %3lu.%03lu %% ",
avg_rel / 1000, avg_rel % 1000);
printf("(missed %lu out of %lu packets)\n",
packets_missed, packets_received + packets_missed);
#if ENERGEST_CONF_ON
// Compute average radio-on time, in microseconds.
unsigned long avg_radio_on = (unsigned long)GLOSSY_PERIOD * 1e6 / RTIMER_SECOND *
(energest_type_time(ENERGEST_TYPE_LISTEN) + energest_type_time(ENERGEST_TYPE_TRANSMIT)) /
(energest_type_time(ENERGEST_TYPE_CPU) + energest_type_time(ENERGEST_TYPE_LPM));
// Print information about average radio-on time.
printf("average radio-on time %lu.%03lu ms\n",
avg_radio_on / 1000, avg_radio_on % 1000);
#endif /* ENERGEST_CONF_ON */
// Compute average latency, in microseconds.
unsigned long avg_latency = sum_latency * 1e6 / (RTIMER_SECOND * packets_received);
// Print information about average latency.
printf("average latency %lu.%03lu ms\n",
avg_latency / 1000, avg_latency % 1000);
}
}
PROCESS_END();
}
开发者ID:Conrad2210,项目名称:Glossy_hda,代码行数:58,代码来源:glossy-test.c
注:本文中的PROCESS_YIELD_UNTIL函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论