本文整理汇总了C++中OSTimeDlyHMSM函数的典型用法代码示例。如果您正苦于以下问题:C++ OSTimeDlyHMSM函数的具体用法?C++ OSTimeDlyHMSM怎么用?C++ OSTimeDlyHMSM使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OSTimeDlyHMSM函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AppTaskStart
static void AppTaskStart (void *p_arg)
{
(void)p_arg;
BSP_Init(); /* Initialize BSP functions */
CPU_Init(); /* Initialize the uC/CPU services */
BSP_Tick_Init(); /* Start Tick Initialization */
Mem_Init(); /* Initialize memory managment module */
Math_Init(); /* Initialize mathematical module */
#if (OS_TASK_STAT_EN > 0)
OSStatInit(); /* Determine CPU capacity */
#endif
BSP_LED_Off(0);
#if (APP_CFG_SERIAL_EN == DEF_ENABLED)
App_SerialInit(); /* Initialize Serial communication for application ... */
#endif
APP_TRACE_INFO(("Creating Application Events...\n\r"));
AppEventCreate(); /* Create Application Events */
APP_TRACE_INFO(("Creating Application Tasks...\n\r"));
AppTaskCreate(); /* Create application tasks */
while (DEF_TRUE) { /* Task body, always written as an infinite loop. */
BSP_LED_Toggle(0);
OSTimeDlyHMSM(0, 0, 0, 100);
}
}
示例2: TaskStart
/*
*********************************************************************************************************
* STARTUP TASK
*********************************************************************************************************
*/
void TaskStart (void *pdata)
{
#if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
OS_CPU_SR cpu_sr;
#endif
char s[100];
INT16S key;
pdata = pdata; /* Prevent compiler warning */
TaskStartDispInit(); /* Initialize the display */
OS_ENTER_CRITICAL(); /* Used to disable interrupts (see chapter 13)*/
PC_VectSet(0x08, OSTickISR); /* Install uC/OS-II's clock tick ISR */
PC_SetTickRate(OS_TICKS_PER_SEC); /* Reprogram tick rate */
OS_EXIT_CRITICAL(); /* Re-enable interrupts*/
OSStatInit(); /* Initialize uC/OS-II's statistics */
TaskStartCreateTasks(); /* Create all the application tasks */
for (;;) {
if (PC_GetKey(&key) == TRUE) { /* See if key has been pressed */
if (key == 0x1B) { /* Yes, see if it's the ESCAPE key */
PC_DOSReturn(); /* Return to DOS */
}
}
OSCtxSwCtr = 0; /* Clear context switch counter */
OSTimeDlyHMSM(0, 0, 1, 0); /* Wait one second */
}
}
示例3: AppTask3
void AppTask3 (void *p_arg)
{
while (1) {
AppUpdatePB(PB_Rd()); /* Update the PB layout to be displayed on the LCD */
OSTimeDlyHMSM(0, 0, 0, 100);
}
}
示例4: AnalogCaptureTask
/*
*********************************************************************************************************
* AnalogCaptureTask TASK
*
*********************************************************************************************************
*/
void AnalogCaptureTask (void *p_arg)
{
(void)p_arg; /* Prevent compiler warning */
OS_ERR err = 0;
CPU_INT32U uCount = 0;
static ADC_CONTROL_BLOCK_t strAdcControlBlock;
InitAdcControlBlock(&strAdcControlBlock); /* Initialize ADC control structures */
InitADCPort(); /* Initialize the ADC */
OSSemCreate(&semAdcIntSignal,"ADC EOC Int signal",0,&err);
OSSemCreate(&semADC_Complete,"ADC completed semaphore",0,&err);
OSMutexCreate(&mutADC,"ADC value",&err);
OSMutexCreate(&mutTMR3,"PWM in",&err);
while (TRUE) {
OSTimeDlyHMSM(0, 0, 0, 50, /* Performs conversions every 100 ms. */
OS_OPT_TIME_HMSM_STRICT,
&err);
ADC1->CR2 |= 1<<21; /* Trigger the conversion */
OSSemPend(&semAdcIntSignal, /* Wait for the end of conversion */
0, /* (This semaphore is posted by the ADC1_ISR) */
OS_OPT_PEND_BLOCKING,
(CPU_TS*)NULL,&err);
ReportAdcSample(ADC_CHANNEL_1, &strAdcControlBlock);
if (++uCount > 5)
{
BSP_LED_Toggle(2); /* Toggle the BSP Led #3 */
uCount = 0;
}
}
}
示例5: AppTaskFirst
static void AppTaskFirst (void *p_arg)
{
if (DEBUG)
xil_printf("DEBUG: INSIDE AppTaskFirst\n\r");
p_arg = p_arg; /* Prevent compiler warning by doing something with argument */
BSP_InitIO(); /* Initialize the I/Os */
#if OS_TASK_STAT_EN > 0
OSStatInit(); /* Initialize uC/OS-II's statistics */
#endif
AppTaskCreate(); /* La resta de tasques de l'aplicació es crean normalment */
/* dins d'una altra funció per tal de mantenir neta la secció */
/* de codi corresponent a la funció m */
int led = 0; // S3A400 - initialize LED selector
while (1) {
if (DEBUG)
xil_printf("DEBUG: INSIDE AppTaskFirst while\n\r");
//BSP_LEDToggle(led + 1); // S3A400 - Light selected LED, all others off
OSTimeDlyHMSM(0,0,5,0); // Release the CPU (every 5 second)
//led = (led + 1) % LEDS; // S3A400 - Select next LED
}
}
示例6: appTaskConnect
static void appTaskConnect(void *pdata) {
while (true) {
OSTimeDlyHMSM(0,0,0,500);
ledToggle(USB_CONNECT_LED);
}
}
示例7: LedFont_ScrollText
void LedFont_ScrollText(char *text, bool scrollOnce, bool waitForFinish) {
INT8U err;
UTIL1_strcpy((uint8_t*)LedFont_Text, sizeof(LedFont_Text), (const unsigned char*)text);
LedFont_ScrollOnce = scrollOnce;
while (!(OSFlagQuery(LedFont_Flags, &err)&LEDFONT_FLAG_READY)) {
(void)OSTimeDlyHMSM(0,0,0,100); /* wait task to be ready */
}
OSTaskResume(TASK_PRIO_SCROLLER);
if (scrollOnce && waitForFinish) {
while (!(OSFlagQuery(LedFont_Flags, &err)&LEDFONT_FLAG_FINISHED_SCROLLING)) {
(void)OSTimeDlyHMSM(0,0,0,100); /* wait for scrolling to be finished */
}
OSFlagPost(LedFont_Flags, LEDFONT_FLAG_FINISHED_SCROLLING, OS_FLAG_CLR, &err); /* clear flag */
}
}
示例8: ProbeDemoIntro_TaskLED
static void ProbeDemoIntro_TaskLED (void *p_arg)
{
CPU_INT32U ms_ctr;
ms_ctr = 0;
ProbeDemoIntro_LED1 = DEF_OFF;
ProbeDemoIntro_LED2 = DEF_OFF;
ProbeDemoIntro_LED3 = DEF_OFF;
while(DEF_TRUE) {
if(ProbeDemoIntro_LED_Sel == DEF_OFF) {
ProbeDemoIntro_LED1 = DEF_OFF;
ProbeDemoIntro_LED2 = DEF_ON;
} else {
ProbeDemoIntro_LED1 = DEF_ON;
ProbeDemoIntro_LED2 = DEF_OFF;
}
if (ms_ctr > (DEF_TIME_NBR_mS_PER_SEC / PROBE_DEMO_INTRO_LED_SEL_POLL_RATE_mS)) {
if (ProbeDemoIntro_LED3 == DEF_OFF) {
ProbeDemoIntro_LED3 = DEF_ON;
} else {
ProbeDemoIntro_LED3 = DEF_OFF;
}
ms_ctr = 0;
} else {
ms_ctr++;
}
OSTimeDlyHMSM(0, 0, 0, PROBE_DEMO_INTRO_LED_SEL_POLL_RATE_mS);
}
}
示例9: tasklet_kill
//in t->func(t->data), don't restart tasklet_schedule,oterwise tasklet_kill will not exit.
void tasklet_kill(struct tasklet_struct *t)
{
OS_ERR err;
CPU_SR cpu_sr;
if (in_interrupt())
USBH_DBG("tasklet_kill Attempt to kill tasklet from interrupt\r\n");
CPU_CRITICAL_ENTER();
while (t->state == TASKLET_STATE_SCHED){
t->state = TASKLET_STATE_SCHED;
do {
CPU_CRITICAL_EXIT();
OSTimeDlyHMSM(0,0,0,5, OS_OPT_TIME_DLY,&err);
CPU_CRITICAL_ENTER();
} while (t->state == TASKLET_STATE_SCHED);
}
CPU_CRITICAL_EXIT();
// while (test_and_set_bit(TASKLET_STATE_SCHED, &t->state)) {
// do {
// yield();
// } while (test_bit(TASKLET_STATE_SCHED, &t->state));
// }
// tasklet_unlock_wait(t);
// clear_bit(TASKLET_STATE_SCHED, &t->state);
}
示例10: Task_Tmr
/*
* 函数名:Task_Tmr
* 描述 : 定时器应用任务
* 优先级为OS_CFG_PRIO_MAX-5u
* 输入 :无
* 输出 : 无
*/
void Task_Tmr(void *p_arg)
{
OS_ERR err;
//定时器变量
OS_TMR MyTmr;
(void)p_arg;
//创建定时器
OSTmrCreate ((OS_TMR *)&MyTmr,
(CPU_CHAR *)"MyTimer",
(OS_TICK )100, //第一次延时设置为100,结合定时器的频率是100Hz,正好1s
(OS_TICK )100, //重复延时的时候100个TmrTick,结合定时器的频率是100Hz,正好1s
(OS_OPT )OS_OPT_TMR_PERIODIC,//模式设置为重复模式
(OS_TMR_CALLBACK_PTR )_cbOfTmr1, //回调函数
(void *)0, //参数设置为0
(OS_ERR *)err);
//启动定时器
OSTmrStart ((OS_TMR *)&MyTmr,
(OS_ERR *)err);
//保存定时器开始的时候的时间戳
ts_start = OS_TS_GET();
while (1)
{
//不断阻塞
OSTimeDlyHMSM(0, 0,1,0,OS_OPT_TIME_HMSM_STRICT,&err);
}
}
示例11: My_Task2
void* My_Task2()
{
static INT32U mytask2 = GPIO_LED_PIN3;
SysTest2 = 1;
printf("My_Task2 Starting...9...\n");
printf("My_Task2 Starting...8...\n");
printf("My_Task2 Starting...7...\n");
printf("My_Task2 Starting...6...\n");
printf("My_Task2 Starting...5...\n");
printf("My_Task2 Starting...4...\n");
printf("My_Task2 Starting...3...\n");
printf("My_Task2 Starting...2...\n");
printf("My_Task2 Starting...1...\n");
OSTimeDly(5);
while(1)
{
SysTest2++;
mytask2 = ~mytask2;
GPIOPinWrite(GPIO_TEST_OUT_BASE, GPIO_TEST2_OUTPUT,SysTest2<<2);
GPIOPinWrite(GPIO_LED_PORT_BASE, GPIO_LED_PIN3,mytask2);
printf("My_Task2 Running...%d,%#x...\n",&mytask2,mytask2);
OSTimeDlyHMSM(0,0,2,0);
}
}
示例12: AppTask_2
static void AppTask_2 (void *p_arg)
{
INT8U err;
(void)p_arg;
APP_TRACE_INFO(("AppTask_2\n\r"));
pSecureEventFlagGrp = OSFlagCreate(0x0, &err);
/* Enable Crypto clock */
CLK->AHBCLK |= CLK_AHBCLK_CRPTCKEN_Msk;
BSP_IntVectSet(BSP_INT_ID_CRYPTO, CRYPTO_IRQHandler);
BSP_IntEn(BSP_INT_ID_CRYPTO);
PRNG_ENABLE_INT();
while (1)
{
PRNG_Open(PRNG_KEY_SIZE_256, 0, 0);
bsp_printf("Start PRNG...\n");
PRNG_Start();
OSFlagPend(pSecureEventFlagGrp, 0x1, OS_FLAG_WAIT_SET_ANY, 0, &err);
dump_PRNG();
OSTimeDlyHMSM(0, 0, 0, 100);
}
}
示例13: Task5
void Task5 (void *pdata)
{
pdata = pdata;
for (;;) {
OSTimeDlyHMSM(0, 0, 0, 100); //task 5 does nothing except delaying itself for 100ms
}
}
示例14: beep_task
/*
***************************************************************
* 名称: beep_task
* 功能: 蜂鸣器任务
* 输入: 1. *pdata:任务参数
* 输出: NULL
* 返回: NULL
* 描述: 无
***************************************************************
*/
static void beep_task(void *pdata)
{
u8 flag = 0;
Beep_On(100);
Wt588d16_Play(0);
Show_StrInLine(1, 0, "江苏晶浩有限");
Show_StrInLine(2, 0, "申通快递详情单");
Show_StrInLine(3, 0, "延中盐汽水");
Show_StrInLine(4, 0, "liuchao");
oled_Show_StrInLine(1, 0, "江苏晶浩有限");
oled_Show_StrInLine(2, 0, "申通快递详情单");
oled_Show_StrInLine(3, 0, "延中盐汽水");
oled_Show_StrInLine(4, 0, "liuchao:刘超");
if (flag == 1)
WriteCharToFlash();
if (flag == 1)
RTC_Set(2015, 5, 13, 16, 50, 00);
while (1)
{
userCardCheck();
sprintf(dateshow, "%4d-%2d-%2d", calendar.w_year, calendar.w_month, calendar.w_date);
sprintf(timeshow, "%2d:%2d:%2d", calendar.hour, calendar.min, calendar.sec);
Show_StrInLine(3, 0, dateshow);
Show_StrInLine(4, 0, timeshow);
OSTimeDlyHMSM(0, 0, 0, 300);
}
}
示例15: App_testEndstops
bool App_testEndstops(void )
{
OS_ERR err;
Debug_printf(Debug_Level_1, "Test all endstops\n");
applicationState = ApplicationState_Test;
endschalterXPlusTest = FALSE;
endschalterXMinusTest = FALSE;
endschalterYPlusTest = FALSE;
endschalterYMinusTest = FALSE;
endschalterZPlusTest = FALSE;
endschalterZMinusTest = FALSE;
while(!(endschalterXPlusTest && endschalterXMinusTest
&& endschalterYPlusTest && endschalterYMinusTest
&& endschalterZPlusTest && endschalterZMinusTest
&& (applicationState == ApplicationState_Test)
))
OSTimeDlyHMSM(0u, 0u, 0u, 100u, OS_OPT_TIME_HMSM_STRICT, &err);
applicationState = ApplicationState_Idle;
Debug_printf(Debug_Level_1, "All endstops successfully tested\n");
return TRUE;
}