本文整理汇总了C++中rt_thread_delay函数的典型用法代码示例。如果您正苦于以下问题:C++ rt_thread_delay函数的具体用法?C++ rt_thread_delay怎么用?C++ rt_thread_delay使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rt_thread_delay函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: led_thread_entry
static void led_thread_entry(void* parameter)
{
unsigned int count=0;
rt_device_t led_dev=rt_device_find("led");
rt_uint8_t led_value=0;
while (1)
{
/* led1 on */
#ifndef RT_USING_FINSH
rt_kprintf("led on, count : %d\r\n",count);
#endif
count++;
led_value=1;
led_dev->write(led_dev,count%4,&led_value,1);
rt_thread_delay( RT_TICK_PER_SECOND/2 ); /* sleep 0.5 second and switch to other thread */
/* led1 off */
#ifndef RT_USING_FINSH
rt_kprintf("led off\r\n");
#endif
led_value=0;
led_dev->write(led_dev,count%4,&led_value,1);
rt_thread_delay( RT_TICK_PER_SECOND/2 );
}
}
开发者ID:liuweiqi,项目名称:RealBoard4088,代码行数:25,代码来源:application.c
示例2: rt_thread_entry_led1
static void rt_thread_entry_led1(void* parameter)
{
// GPIO_InitTypeDef GPIO_InitStructure;
/* GPIOD Periph clock enable */
// RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOF, ENABLE);
/* Configure PD12, PD13, PD14 and PD15 in output pushpull mode */
// GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;
// GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
// GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
// GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
// GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
// GPIO_Init(GPIOF, &GPIO_InitStructure);
while(1)
{
// GPIO_SetBits(GPIOF, GPIO_Pin_6);
// print_temp();
rt_thread_delay(20);
// GPIO_ResetBits(GPIOF, GPIO_Pin_6);
rt_thread_delay(20);
}
}
开发者ID:dlts200466,项目名称:PowerSupply,代码行数:25,代码来源:application.c
示例3: led_thread_entry
static void led_thread_entry(void* parameter)
{
/* LED : PB2 BOOT1 config. */
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
/* output setting */
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOB, &GPIO_InitStructure);
}
/* sys led blink. */
while(1)
{
/* turn on led 20ms. */
LED_SYS_ON();
rt_thread_delay(RT_TICK_PER_SECOND/50);
/* turn off led 1s. */
LED_SYS_OFF();
rt_thread_delay(RT_TICK_PER_SECOND);
}
}
开发者ID:eyeye,项目名称:ART,代码行数:29,代码来源:application.c
示例4: thread_entry
static void thread_entry(void* parameter)
{
rt_tick_t tick;
rt_kprintf("thread inited ok\n");
tick = rt_tick_get();
rt_kprintf("thread delay 10 tick\n");
rt_thread_delay(10);
if (rt_tick_get() - tick > 10)
{
tc_done(TC_STAT_FAILED);
return;
}
tick = rt_tick_get();
rt_kprintf("thread delay 15 tick\n");
rt_thread_delay(15);
if (rt_tick_get() - tick > 15)
{
tc_done(TC_STAT_FAILED);
return;
}
rt_kprintf("thread exit\n");
tc_done(TC_STAT_PASSED);
}
开发者ID:aspirefhaha,项目名称:ad7606_stm32107,代码行数:27,代码来源:thread_delay.c
示例5: sonar_thread_entry
void sonar_thread_entry(void* parameter)
{
rt_kprintf("start sonar\n");
while(1)
{
GPIO_SetBits(GPIOE,GPIO_Pin_7);
rt_thread_delay(RT_TICK_PER_SECOND*10/1000);
GPIO_ResetBits(GPIOE,GPIO_Pin_7);
rt_thread_delay(RT_TICK_PER_SECOND*50/1000);
sonar_h=Moving_Median(PWM8_Time/58.0f*ahrs.g_z,sonar_avr,SAMPLE_COUNT);
ahrs.height_v=HV_A*(ahrs.height_v+ahrs.height_acc*0.06f)+(1.0f-HV_A)*((sonar_h-ahrs.height)/0.06f);
ahrs.height=sonar_h;
h=(u16)sonar_h;
sonar_state=sonar_h>3.0f&&sonar_h<150.0f;
ahrs_state.sonar=!sonar_state;
rt_event_send(&ahrs_event,AHRS_EVENT_SONAR);
}
}
开发者ID:tcz717,项目名称:TPDT.FC_407,代码行数:25,代码来源:sonar.c
示例6: thread2_entry
/* 线程2的入口函数 */
static void thread2_entry(void* parameter)
{
/* 线程2拥有较高的优先级,以抢占线程1而获得执行 */
/* 线程2启动后先睡眠10个OS Tick */
rt_thread_delay(10);
/*
* 线程2唤醒后直接删除线程1,删除线程1后,线程1自动脱离就绪线程
* 队列
*/
rt_thread_delete(tid1);
tid1 = RT_NULL;
/*
* 线程2继续休眠10个OS Tick然后退出,线程2休眠后应切换到idle线程
* idle线程将执行真正的线程1控制块和线程栈的删除
*/
rt_thread_delay(10);
/*
* 线程2运行结束后也将自动被删除(线程控制块和线程栈依然在idle线
* 程中释放)
*/
tid2 = RT_NULL;
}
开发者ID:CollinsLiu,项目名称:rt-thread-pc,代码行数:27,代码来源:thread_delete.c
示例7: msc_thread_entry
void msc_thread_entry(void *parameter)
{
extern void player_ui_freeze(void);
unsigned long test_unit_ready_start = rt_tick_get();
test_unit_ready_last = test_unit_ready_start;
/* wait connection */
while( test_unit_ready_last == test_unit_ready_start )
{
rt_thread_delay( RT_TICK_PER_SECOND );
}
/* freeze player UI */
player_ui_freeze();
/* wait remove */
while(1)
{
rt_thread_delay( RT_TICK_PER_SECOND/2 );
if( rt_tick_get() - test_unit_ready_last > RT_TICK_PER_SECOND*2 )
{
// rt_kprintf("\r\nCable removed!\r\nSystemReset\r\n\r\n");
// NVIC_SystemReset();
}
}
}
开发者ID:Manish-cimcon,项目名称:micro,代码行数:27,代码来源:usb_main.c
示例8: led1_thread_entry
static void led1_thread_entry(void* parameter)
{
/*在LED1线程中初始化LED的GPIO配置*/
LED_GPIO_Config();
while(1)
{
//rt_kprintf ( "\r\n LED1 is going!!!\r\n");
LED1(ON);//点亮LED1
rt_thread_delay(100);//调用RTT的API将当前线程挂起200ticks,也就是1sec
LED1(OFF);//关闭LED1
rt_thread_delay(100);
if(bMp3Play == 0)
sys_wake_count++;
if(sys_wake_count==sys_default_count)
{
sys_wake_count=0;
if(sys_wake)
{
sys_wake=0;
rt_kprintf("系统进入休眠状态,如需使用请唤醒!\r\n");
rt_mb_send(&mb,(rt_uint32_t)sys_down_mp3);//发送邮件
}
}
}
}
开发者ID:wuhaixiang,项目名称:VoiceCode,代码行数:26,代码来源:application.c
示例9: rt_usbh_hub_reset_port
/**
* This function will rest hub port, it is invoked when sub device attached to the hub port.
*
* @param intf the interface instance.
* @param port the hub port.
*
* @return the error code, RT_EOK on successfully.
*/
rt_err_t rt_usbh_hub_reset_port(uhub_t hub, rt_uint16_t port)
{
rt_err_t ret;
rt_uint32_t pstatus;
/* parameter check */
RT_ASSERT(hub != RT_NULL);
rt_thread_delay(50);
/* reset hub port */
ret = rt_usbh_hub_set_port_feature(hub, port, PORT_FEAT_RESET);
if(ret != RT_EOK) return ret;
while(1)
{
ret = rt_usbh_hub_get_port_status(hub, port, (rt_uint8_t*)&pstatus);
if(!(pstatus & PORT_PRS)) break;
}
/* clear port reset feature */
ret = rt_usbh_hub_clear_port_feature(hub, port, PORT_FEAT_C_RESET);
if(ret != RT_EOK) return ret;
rt_thread_delay(50);
return RT_EOK;
}
开发者ID:DigFarmer,项目名称:aircraft,代码行数:36,代码来源:hub.c
示例10: USB_OTG_BSP_mDelay
/**
* @brief USB_OTG_BSP_mDelay
* This function provides delay time in milli sec
* @param msec : Value of delay required in milli sec
* @retval None
*/
void USB_OTG_BSP_mDelay (const uint32_t msec)
{
if(msec >= 10)
rt_thread_delay(msec / 10);
else
rt_thread_delay(msec / 1);
}
开发者ID:ADTL,项目名称:realtouch-stm32f4,代码行数:13,代码来源:usb_bsp.c
示例11: rt_transfer_thread_entry
void rt_transfer_thread_entry(void *parameter)
{
// rt_uint16_t ms_20=0,ms_100=0,ms_1000=0;
// char buff[33];
T_RC_Status data;
// T_RC_Voltage voltage;
T_RC_Sensor Sensor;
// rt_uint32_t _temp[3];
// rt_uint8_t i;
rt_thread_delay(1000);
for(;;)
{
//NRF24_Check_Event();
/*Pms_20++;
if(ms_20==100)
{
ms_20=0;
for(i=0;i<3;i++)
{
_temp[i]=read_battert_adc_value();
}
voltage.Voltage1=(float)_temp[0]/4095.0f*3.3f*2;
voltage.Voltage2=(float)_temp[1]/4095.0f*3.3f*2;
voltage.Voltage3=(float)_temp[2]/4095.0f*3.3f*2;
Data_Send_Voltage(&voltage);
}*/
#if 1
data.ANGLE.rol=angleActual.rol;
data.ANGLE.pit=angleActual.pit;
data.ANGLE.yaw=angleActual.yaw;
data.ALT_CSB=1234;
data.ALT_PRS=1234;
data.ARMED=0;
Data_Send_Status(&data);
Sensor.ACC.X=accelMpu.x;
Sensor.ACC.Y=accelMpu.y;
Sensor.ACC.Z=accelMpu.z;
Sensor.GYR.X=gyroMpu.x;
Sensor.GYR.Y=gyroMpu.y;
Sensor.GYR.Z=gyroMpu.z;
Sensor.MAG.X=magMpu.x;
Sensor.MAG.Y=magMpu.y;
Sensor.MAG.Z=magMpu.z;
Sensor.MAG.X=magCorrect.x;
Sensor.MAG.Y=magCorrect.y;
Sensor.MAG.Z=magCorrect.z;
Data_Send_Senser(&Sensor);
#endif
rt_thread_delay(20);
}
}
开发者ID:trigrass2,项目名称:MircoFlyV0.7,代码行数:58,代码来源:transfer_app.c
示例12: worker_thread_entry
static void worker_thread_entry(void* parameter)
{
rt_thread_delay(5);
for(worker_count = 0; worker_count < 5; worker_count++)
{
rt_kprintf("worker:count: %d\n", worker_count);
rt_thread_delay(5);
}
}
开发者ID:003900107,项目名称:realboard-lpc4088,代码行数:9,代码来源:demo.c
示例13: worker_thread_entry
static void worker_thread_entry(void* parameter)
{
rt_thread_delay(5);
for(worker_count = 0; worker_count < 10; worker_count++)
{
rt_kprintf("worker: count: %d\n", worker_count);
}
rt_thread_delay(RT_TICK_PER_SECOND);
}
开发者ID:003900107,项目名称:realboard-lpc4088,代码行数:9,代码来源:demo.c
示例14: worker_thread_entry
static void worker_thread_entry(void* parameter)
{
rt_thread_delay(10);
while (1) {
rt_sem_release(sem);
rt_thread_delay(5);
}
}
开发者ID:malooei,项目名称:yeejoin-workspace,代码行数:9,代码来源:semaphore_priority.c
示例15: rt_init_thread_entry
static void rt_init_thread_entry(void* parameter)
{
rt_thread_t system_thread;
rt_uint8_t buf[256];
/* Initialization RT-Thread Components */
#ifdef RT_USING_COMPONENTS_INIT
rt_components_init();
#endif
/* Set finsh device */
#ifdef RT_USING_FINSH
finsh_set_device(RT_CONSOLE_DEVICE_NAME);
#endif /* RT_USING_FINSH */
rt_hw_led1_off();
//cmx865a_init();
unsigned int count=1000;
rt_memset(buf,'\0',256);
rt_hw_led_init();
// rt_kprintf("led on, count : %d\r\n",count);
//rt_sprintf(buf,"%s","- RT - Thread Operating System");
// ST7585_Write_String(0,5,"- RT - ");
//ST7585_Write_String(0,4,"Thread Operating System");
// Draw_bat(3);
//b(0,1);
r(0);
while (1)
{
/* led1 on */
#ifdef RT_USING_FINSH
rt_kprintf("led on , count : %d\r\n",count);
#endif
// rt_sprintf(buf,"led on , count : %d",count);
// ST7585_Write_String(0,5,buf);
//test_cmx865a();
count++;
rt_hw_led1_off();
rt_thread_delay( RT_TICK_PER_SECOND/2 ); /* sleep 0.5 second and switch to other thread */
/* led1 off */
#ifdef RT_USING_FINSH
rt_kprintf("led off\r\n");
#endif
// rt_sprintf(buf,"led off, count : %d",count);
// ST7585_Write_String(0,5,buf);
rt_hw_led1_on();
rt_thread_delay( RT_TICK_PER_SECOND/2 );
}
}
开发者ID:blueskycoco,项目名称:dm3730-spi,代码行数:56,代码来源:application.c
示例16: thread1_entry
static void thread1_entry(void* parameter)
{
while(1)
{
Led_Control(0,1);
rt_thread_delay(RT_TICK_PER_SECOND);
Led_Control(0,0);
rt_thread_delay(RT_TICK_PER_SECOND);
}
}
开发者ID:Coing,项目名称:rt-thread,代码行数:10,代码来源:demo_thread.c
示例17: rt_vam_thread_entry
void rt_vam_thread_entry(void *parameter)
{
vam_stastatus_t location ;
rt_thread_delay(500);
timer_start();
while(1){
_vsm_get_local_status(&location) ;
rt_thread_delay(10);
}
}
开发者ID:gexueyuan,项目名称:cct,代码行数:10,代码来源:cv_vam_lip.c
示例18: led_thread_entry
static void led_thread_entry(void *parameter)
{
while (1)
{
led_on();
rt_thread_delay(RT_TICK_PER_SECOND);
led_off();
rt_thread_delay(RT_TICK_PER_SECOND);
}
}
开发者ID:cedar-renjun,项目名称:air-conditioning-assistant,代码行数:10,代码来源:drv_led.c
示例19: osd_test
void osd_test(void)
{ u8 t;
OLED_Init(); //3?¨º??¡¥OLED
OLED_Clear() ;
t=' ';
OLED_ShowCHinese(0,0,0);//?D
OLED_ShowCHinese(18,0,1);//?¡ã
OLED_ShowCHinese(36,0,2);//?¡ã
OLED_ShowCHinese(54,0,3);//¦Ì?
OLED_ShowCHinese(72,0,4);//¡Á¨®
OLED_ShowCHinese(90,0,5);//??
OLED_ShowCHinese(108,0,6);//??
while(1)
{
OLED_Clear();
OLED_ShowCHinese(0,0,0);//?D
OLED_ShowCHinese(18,0,1);//?¡ã
OLED_ShowCHinese(36,0,2);//?¡ã
OLED_ShowCHinese(54,0,3);//¦Ì?
OLED_ShowCHinese(72,0,4);//¡Á¨®
OLED_ShowCHinese(90,0,5);//??
OLED_ShowCHinese(108,0,6);//??
OLED_ShowString(6,3,"0.96' OLED TEST",16);
OLED_ShowString(6,4,"0.96' OLED TEST",16);
OLED_ShowString(0,5,"0.96' OLED TEST",16);
OLED_ShowString(0,6,"0.96' OLED TEST",16);
OLED_ShowString(1,7,"0.96' OLED TEST",16);
OLED_ShowString(6,3,"0.96' OLED TEST",16);
//OLED_ShowString(8,2,"ZHONGJINGYUAN");
// OLED_ShowString(20,4,"2014/05/01");
OLED_ShowString(0,6,"ASCII:",16);
OLED_ShowString(63,6,"CODE:",16);
OLED_ShowChar(48,6,t,16);//??¨º?ASCII¡Á?¡¤?
t++;
if(t>'~')t=' ';
OLED_ShowNum(103,6,t,3,16);//??¨º?ASCII¡Á?¡¤?¦Ì????¦Ì
rt_thread_delay(1000*3);
OLED_DrawBMP(0,0,128,8,BMP1); //¨ª?????¨º?(¨ª?????¨º?¨¦¡Â¨®?¡ê?¨¦¨²3¨¦¦Ì?¡Á?¡À¨ª??¡ä¨®¡ê??¨¢??¨®????¨¤????¡ê?FLASH????8K¨°???¨¦¡Â¨®?)
rt_thread_delay(1000*3);
OLED_DrawBMP(0,0,128,8,BMP1);
rt_thread_delay(1000*3);
}
}
开发者ID:pigeon0411,项目名称:eb120_ec11_new,代码行数:54,代码来源:osd_menu.c
示例20: rt_led_thread_entry
void rt_led_thread_entry(void* parameter)
{
while(1)
{
/* light on leds for one second */
rt_thread_delay(100);
/* light off leds for one second */
rt_thread_delay(100);
}
}
开发者ID:54chenjq,项目名称:rt-thread,代码行数:11,代码来源:application.c
注:本文中的rt_thread_delay函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论