• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ rtimer_set函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中rtimer_set函数的典型用法代码示例。如果您正苦于以下问题:C++ rtimer_set函数的具体用法?C++ rtimer_set怎么用?C++ rtimer_set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了rtimer_set函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: init

/*---------------------------------------------------------------------------*/
static void
init(void)
{
  radio_is_on = 0;
  PT_INIT(&pt);
#if NURTIMER
  rtimer_setup(&rt, RTIMER_HARD,
               (void (*)(struct rtimer *, void *, int status))powercycle,
               NULL);
  rtimer_schedule(&rt, CYCLE_TIME, 1);
#else
  rtimer_set(&rt, RTIMER_NOW() + CYCLE_TIME, 1,
             (void (*)(struct rtimer *, void *))powercycle, NULL);
#endif

  contikimac_is_on = 1;

#if WITH_PHASE_OPTIMIZATION
  phase_init(&phase_list);
#endif /* WITH_PHASE_OPTIMIZATION */

#if CONTIKIMAC_CONF_ANNOUNCEMENTS
  announcement_register_listen_callback(listen_callback);
  ctimer_set(&announcement_cycle_ctimer, ANNOUNCEMENT_TIME,
             cycle_announcement, NULL);
#endif /* CONTIKIMAC_CONF_ANNOUNCEMENTS */
}
开发者ID:project-master-device,项目名称:project-master-device,代码行数:28,代码来源:contikimac.c


示例2: turn_on

/*---------------------------------------------------------------------------*/
static int
turn_on(void)
{
  xmac_is_on = 1;
  rtimer_set(&rt, RTIMER_NOW() + xmac_config.off_time, 1,
	     (void (*)(struct rtimer *, void *))powercycle, NULL);
  return 1;
}
开发者ID:lanada-sensor,项目名称:plb,代码行数:9,代码来源:xmac.c


示例3: rtimer_task

static char
rtimer_task(struct rtimer *t, void *ptr)
{
    PT_BEGIN(&pt);

    while (1) {
        leds_on(LEDS_ALL);
        rtimer_set(t, RTIMER_NOW() + LEDS_ON_PERIOD, 0, (rtimer_callback_t)rtimer_task, NULL);
        PT_YIELD(&pt);

        leds_off(LEDS_ALL);
        rtimer_set(t, timesynch_time_to_rtimer(0), 0, (rtimer_callback_t)rtimer_task, NULL);
        PT_YIELD(&pt);
    }

    PT_END(&pt);
}
开发者ID:algoragit,项目名称:Contiki4EMMAC,代码行数:17,代码来源:timesync-master.c


示例4: PROCESS_THREAD

/**
 * \brief  rtimer process only set the callback ok
 * \param 
 * 
 */
PROCESS_THREAD(rtimer_ex_process, ev, data)
{
    PROCESS_BEGIN();
    led_init();
	  /* start the led, period 200ms */
    rtimer_set(&ex_timer, 1000, 0, led_on, NULL);
    PROCESS_END();
}
开发者ID:ehigh2014,项目名称:contiki_stm32_keil,代码行数:13,代码来源:rtimer_example.c


示例5: do_timeout3

//Rtimer callback function
void do_timeout3(struct rtimer *timer, void *ptr) {
  counter_rtimer++;

  printf("\n\rProcess 3: RTimer callback called");

  /* Re-arm rtimer */
  rtimer_set(&timer_rtimer, RTIMER_NOW() + timeout_rtimer, 0, do_timeout3,
             NULL);
}
开发者ID:JIANGYUFEI,项目名称:contiki-examples,代码行数:10,代码来源:all-timers.c


示例6: PROCESS_THREAD

//Rtimer thread
PROCESS_THREAD(process3, ev, data) {
  PROCESS_BEGIN();

  while(1) {
    rtimer_set(&timer_rtimer, RTIMER_NOW() + timeout_rtimer, 0, do_timeout3, NULL);
    PROCESS_YIELD();
  }

  PROCESS_END();
}
开发者ID:JIANGYUFEI,项目名称:contiki-examples,代码行数:11,代码来源:all-timers.c


示例7: turn_on

/*---------------------------------------------------------------------------*/
static int
turn_on(void)
{
  if(contikimac_is_on == 0) {
    contikimac_is_on = 1;
    contikimac_keep_radio_on = 0;
    rtimer_set(&rt, RTIMER_NOW() + CYCLE_TIME, 1, powercycle_wrapper, NULL);
  }
  return 1;
}
开发者ID:bthebaudeau,项目名称:contiki,代码行数:11,代码来源:contikimac.c


示例8: test_rtimer

static void test_rtimer(void)
{
	while(1)
	{
		printf("Now = %u\r\n",RTIMER_NOW());
		rtimer_set(&task, RTIMER_NOW() + RTIMER_SECOND*2, RTIMER_SECOND, &callback, NULL);
		PROCESS_WAIT_UNTIL(sem);
		sem=0;
	}
}
开发者ID:Spike0,项目名称:Contiki_my,代码行数:10,代码来源:rtimer-arch.c


示例9: zero_cross_callback

static void
zero_cross_callback(uint8_t port, uint8_t pin)
{
//INTERRUPTS_DISABLE();
//if (pin == BUTTON_LEFT_PIN)
//{
//  GPIO_DISABLE_INTERRUPT(BUTTON_LEFT_PORT, BUTTON_LEFT_PIN);


//do{
//} while ((GPIO_READ_PIN(GPIO_B_BASE, 0x08)&0x08)==0x08);



//  clock_delay_usec(8000);
//  GPIO_SET_PIN(GPIO_C_BASE, 0x04);
//  clock_delay_usec(50);
//disable simistor
//  GPIO_CLR_PIN(GPIO_C_BASE, 0x04);
//  GPIO_ENABLE_INTERRUPT(BUTTON_LEFT_PORT, BUTTON_LEFT_PIN);

//INTERRUPTS_ENABLE();
//  count50++;
//  if (count50==100) {
//    GPIO_SET_PIN(GPIO_C_BASE, 0x80);
//    count50=0;
//    ctimer_set(&my_ct, CLOCK_SECOND/128, my_rt_callback, NULL);
//    GPIO_DISABLE_INTERRUPT(BUTTON_LEFT_PORT_BASE, BUTTON_LEFT_PIN_MASK);
//    nvic_interrupt_disable(BUTTON_LEFT_VECTOR);
//    clock_delay_usec(4000);

// GPIO_ENABLE_INTERRUPT(BUTTON_LEFT_PORT, BUTTON_LEFT_PIN);
// nvic_interrupt_enable(BUTTON_LEFT_VECTOR);


//timer if RISING detect
//    rtimer_set(&zero_detector_rtimer, RTIMER_NOW()+(RTIMER_SECOND/1000)*9, 1, zero_detector_enable_callback, NULL);


//    if (GPIO_READ_PIN(GPIO_B_BASE, 0x08)&0x08)
//        rtimer_set(&my_rt, RTIMER_NOW()+(RTIMER_SECOND/10000)*abs(95-dimming_time), 1, my_rt_callback, NULL);


//    rtimer_set(&simistor_strob_rtimer, RTIMER_NOW()+(RTIMER_SECOND/10000)*abs(95-dimming_time), 1, simistor_strob_callback, NULL);
 if (dim_chan0.thyristor_open_time)
//  rtimer_set(&dim_chan0.thyristor_rtimer, RTIMER_NOW()+(RTIMER_SECOND/10000)*(255 - dim_chan0.thyristor_open_time)/2.68, 1, simistor_strob_callback, NULL);
  rtimer_set(&dim_chan0.thyristor_rtimer, RTIMER_NOW()+(RTIMER_SECOND/10000)*((100 - dim_chan0.thyristor_open_time)/1.02), 1, simistor_strob_callback, NULL);

//    else 
//	 nvic_interrupt_enable(BUTTON_LEFT_VECTOR);	
//  }
//}

}
开发者ID:0009281,项目名称:contiki,代码行数:54,代码来源:button-sensor.c


示例10: turn_on

/*---------------------------------------------------------------------------*/
static int
turn_on(void)
{
  if(contikimac_is_on == 0) {
    contikimac_is_on = 1;
    contikimac_keep_radio_on = 0;
    rtimer_set(&rt, RTIMER_NOW() + CYCLE_TIME, 1,
               (void (*)(struct rtimer *, void *))powercycle, NULL);
  }
  return 1;
}
开发者ID:alesko,项目名称:contiki,代码行数:12,代码来源:contikimac.c


示例11: timeout

static void timeout(struct rtimer *t, void *ptr) {
  // it is assumed that the timeout rtimer always expires within
  // the off phase of powercycle immediately after the first received strobe
  waiting_for_packet = 0;
  leds_off(LEDS_GREEN);
  if (we_are_sending == 0)
  {
    off();
  }
  rtimer_set(t, last_on + xmac_config.on_time + xmac_config.off_time, 1,
	     (void (*)(struct rtimer *, void *))powercycle, ptr);
}
开发者ID:EDAyele,项目名称:ptunes,代码行数:12,代码来源:xmac.c


示例12: schedule_powercycle

static void
schedule_powercycle(struct rtimer *t, rtimer_clock_t time)
{
  int r;
  if(xmac_is_on) {
    r = rtimer_set(t, RTIMER_TIME(t) + time, 1,
		   (void (*)(struct rtimer *, void *))powercycle, NULL);
    if(r) {
      PRINTF("schedule_powercycle: could not set rtimer\n");
    }
  }
}
开发者ID:lanada-sensor,项目名称:plb,代码行数:12,代码来源:xmac.c


示例13: powercycle

/*---------------------------------------------------------------------------*/
#if GLOSSY
static volatile int in_on_phase = 0;
char powercycle(void) {
	PT_BEGIN(&pt);

	while(1)
	{
		if((xmac_config.off_time > 0) && (!was_timeout))
		{
			if(we_are_sending == 0)
			{
				in_on_phase = 1;
				off();
			}

			if(xmac_is_on)
			{
				TBCCR3 += xmac_config.off_time;
			}
			PT_YIELD(&pt);
		}

		last_on = TBCCR3;
		was_timeout = 0;

		if(we_are_sending == 0)
		{
			in_on_phase = 0;
			on();
		}
		if(xmac_is_on)
		{
			TBCCR3 += xmac_config.on_time;
			in_on_phase = 0;
		}
		PT_YIELD(&pt);
	}

	PT_END(&pt);
}
#else /* GLOSSY */
static char powercycle(struct rtimer *t, void *ptr) {
	int r;

	PT_BEGIN(&pt);

	while(1)
	{
		if((xmac_config.off_time > 0) && (!was_timeout))
		{
			if(we_are_sending == 0)
			{
				off();
			}

			if(xmac_is_on)
			{
				r = rtimer_set(t, RTIMER_TIME(t) + xmac_config.off_time, 1,
					(void (*)(struct rtimer *, void *))powercycle, ptr);

			}
			PT_YIELD(&pt);
		}

		last_on = RTIMER_TIME(t);
		was_timeout = 0;

		if(we_are_sending == 0)
		{
			on();
		}
		if(xmac_is_on)
		{
			r = rtimer_set(t, RTIMER_TIME(t) + xmac_config.on_time, 1,
					(void (*)(struct rtimer *, void *))powercycle, ptr);
		}
		PT_YIELD(&pt);
	}

	PT_END(&pt);
}
开发者ID:EDAyele,项目名称:ptunes,代码行数:82,代码来源:xmac.c


示例14: on

// turn on RDC layer
static int on(void)
{
  PRINTF("turn on RDC layer\n");
#ifdef SF_MOTE_TYPE_AP
    rtimer_set(&BSTimer,RTIMER_NOW()+segment_period,0,TDMA_BS_send,NULL);
    return NETSTACK_RADIO.on();
#else
    // SF_MOTE_TYPE_SENSOR
    TDMA_SN_listen();
    return 1;
#endif
  
}
开发者ID:s3lsensor,项目名称:CEE155_WirelessCommLab_b,代码行数:14,代码来源:tdmardc.c


示例15: plb_powercycle

/*---------------------------------------------------------------------------*/
static char
plb_powercycle(void)
{

  PRINT_P("plb_powercycle [sr:%d cw:%d]\n",send_req,c_wait);

  PT_BEGIN(&pt);
  while(1) {
    // check on/send state
    if(send_req == 1 && c_wait==1){
    	PRINTF("plb_powercycle send DATA <start>\n");
    	send_req = 0;	//avoid repeat sending
    	plb_send_data(sent_callback, sent_ptr);
    	PRINTF("plb_powercycle send DATA <end>\n");
    	radio_off();
    	NETSTACK_MAC.input();
    }

    /* on */
    radio_on();
    rtimer_set(&rt, RTIMER_NOW() + PC_ON_TIME, 1,
	       (void (*)(struct rtimer *, void *))plb_powercycle, NULL);
    PT_YIELD(&pt);

    /* off */
    if(wait_packet == 0){
      radio_off();
    }
    else if (wait_packet > 0)
    {
    	wait_packet = 0;
    }
    rtimer_set(&rt, RTIMER_NOW() + PC_OFF_TIME, 1,
	       (void (*)(struct rtimer *, void *))plb_powercycle, NULL);
    PT_YIELD(&pt);
  }
  PT_END(&pt);
}
开发者ID:deawoo,项目名称:contiki-2.7-plb,代码行数:39,代码来源:plb_backup_0218.c


示例16: start_discovery_process

/**
 * @brief start_discovery_process
 */
static void start_discovery_process(){
    uint16_t Tup_bound = 0, random_slot = 1;

    random_slot = 1 +  random_rand()%period_length;

    Tup_bound = (period_length*period_length)/4;

    //random_slot = random_slot + random_rand()%Tup_bound ;

    /*if (rimeaddr_node_addr.u8[0] < 130){
        random_slot = random_slot + random_rand()%period_length;
    }else{
        random_slot = random_slot + Tup_bound + random_rand()%period_length;
    }*/


    /*if(rimeaddr_node_addr.u8[0] == 10 || rimeaddr_node_addr.u8[0] == 11){
      //uint8_t channel_group = 1+rimeaddr_node_addr.u8[0]%GROUP_MERGE_SIZE;
      uint8_t channel_group = 1;
      
      
      random_slot = 0;

      cc2420_set_channel(i3e154_channels[channel_group]);
    }*/

    //enable random offset wait flag..
    rand_offset_wait_flag = 1;
    node_slots_offset     = random_slot;
    slot_upperBound       = 10000 - node_slots_offset;

    //-------- HERE WE DIVIDE NODES INTO CHANNELS.........
    if(1 /*rimeaddr_node_addr.u8[0] == 10*/){
        //uint8_t channel_group = 1+rimeaddr_node_addr.u8[0]%GROUP_MERGE_SIZE;
        uint8_t channel_group = 0;

        cc2420_set_channel(i3e154_channels[channel_group]);
    }

    COOJA_DEBUG_PRINTF("======>>>>> ID:%2u, channel:%2u\n", rimeaddr_node_addr.u8[0], cc2420_get_channel());
    //--------END GROUP CHANNEL SETTING...

    rtimer_clock_t startTime = RTIMER_NOW() + 2;

    int ret = rtimer_set(&generic_timer, startTime, 1,
                         (void (*)(struct rtimer *, void *))power_cycle, NULL);
    if(ret){
        PRINTF("synchronization failed\n");
    }
}
开发者ID:aoboy,项目名称:acc-slight,代码行数:53,代码来源:acc-sl.c


示例17: schedule_fixed

/**
 * @brief schedule_fixed
 * @param rt
 * @param next_time
 * @return
 */
static char schedule_fixed(struct rtimer *rt, rtimer_clock_t next_time){

    if(RTIMER_CLOCK_LT(next_time, RTIMER_NOW() + 1)) {
        next_time = RTIMER_NOW() + 3;
    }

    int ret = rtimer_set(&generic_timer, next_time, 1,
                         (void (*)(struct rtimer *, void *))power_cycle, NULL);
    if(ret){
        PRINTF("synchronization failed\n");
    }
    
    return 0;
}
开发者ID:aoboy,项目名称:acc-slight,代码行数:20,代码来源:acc-sl.c


示例18: turn_on

/*---------------------------------------------------------------------------*/
static int
turn_on(void)
{
  if(contikimac_is_on == 0) {
    contikimac_is_on = 1;
#if NURTIMER
    rtimer_schedule(&rt, CYCLE_TIME, 1);
#else
    rtimer_set(&rt, RTIMER_NOW() + CYCLE_TIME, 1,
               (void (*)(struct rtimer *, void *))powercycle, NULL);
#endif
  }
  return 1;
}
开发者ID:project-master-device,项目名称:project-master-device,代码行数:15,代码来源:contikimac.c


示例19: init

/*---------------------------------------------------------------------------*/
static void
init(void)
{
  radio_is_on = 0;
  PT_INIT(&pt);
  rtimer_set(&rt, RTIMER_NOW() + CYCLE_TIME, 1,
             (void (*)(struct rtimer *, void *))powercycle, NULL);

  contikimac_is_on = 1;

#if WITH_PHASE_OPTIMIZATION
  phase_init(&phase_list);
#endif /* WITH_PHASE_OPTIMIZATION */

}
开发者ID:Asterios,项目名称:contiki-econotag,代码行数:16,代码来源:contikimac.c


示例20: init

/*---------------------------------------------------------------------------*/
static void
init(void)
{
  radio_is_on = 0;
  PT_INIT(&pt);

  rtimer_set(&rt, RTIMER_NOW() + CYCLE_TIME, 1, powercycle_wrapper, NULL);

  contikimac_is_on = 1;

#if WITH_PHASE_OPTIMIZATION
  phase_init();
#endif /* WITH_PHASE_OPTIMIZATION */

}
开发者ID:bthebaudeau,项目名称:contiki,代码行数:16,代码来源:contikimac.c



注:本文中的rtimer_set函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ rtl函数代码示例发布时间:2022-05-30
下一篇:
C++ rtimer_init函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap