当前位置: 首页>>代码示例>>C++>>正文


C++ Task_sleep函数代码示例

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


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

示例1: clockTask

/*
 *  ======== clockTask ========
 *  Wrapper function for TSK objects calling
 *  Clock::tick()
 */
void clockTask(UArg arg)
{   
    Clock *clock = (Clock *)arg;
    int count = 0;
   
    if (clock->getId() == 3) {
        for(;;) {             // task id = 3
            Semaphore_pend(sem0, BIOS_WAIT_FOREVER);
            clock->tick();
            if(count == 50) {
                Task_sleep(25);
                count = 0;
            } 
            count++;
            Semaphore_post(sem1);
        }
    }
    else {
        for(;;) {             // task id = 4
            Semaphore_pend(sem1, BIOS_WAIT_FOREVER);
            if(count == 50) {
                Task_sleep(25);
                count = 0;
            }   
            clock->tick();
            count++;
            Semaphore_post(sem0);
        }
    }
}
开发者ID:DemonTu,项目名称:ALL_SmartBatterySwitch_CC2640,代码行数:35,代码来源:bigtime.cpp

示例2: sim800_send_sms

void sim800_send_sms(char * tx_buffer, int tx_size){
	char rxBuffer[SIM800_RXBUFFER_SIZE];

	 if(sim800_initialised  && !sim800_locked){
		sim800_locked = 1;

		UART_write(uart, sim800_at_smgf, sizeof(sim800_at_smgf));
		Task_sleep(500);

		UART_write(uart, sim800_at_smgs, strlen(sim800_at_smgs));
		Task_sleep(1000);

		UART_write(uart, tx_buffer, tx_size);
		Task_sleep(5000);

		memset(&rxBuffer, 0, sizeof(rxBuffer));
		UART_write(uart, sim800_ctrl_z, sizeof(sim800_ctrl_z));
		UART_read(uart, rxBuffer, sizeof(rxBuffer));
		serial_printf(cli_stdout, "sms:%s", rxBuffer);

		sim800_locked = 0;
	 }else{
		serial_printf(cli_stdout, "sim800 not initialised",0);
	}

}
开发者ID:Octanis1,项目名称:Octanis1-Mainboard-Firmware_MSP_EXP432P401RLP,代码行数:26,代码来源:sim800.c

示例3: sim800_buffermessage_http

void sim800_buffermessage_http(char * tx_buffer, int tx_size){
	if(!sim800_initialised){
		serial_printf(cli_stdout, "sim800 not initialised",0);
	}else{
		char rxBuffer[SIM800_RXBUFFER_SIZE];
		memset(&rxBuffer, 0, sizeof(rxBuffer));

		UART_write(uart, sim800_at_httpdata, sizeof(sim800_at_httpdata));
		Task_sleep(600);
		UART_write(uart, tx_buffer, tx_size);
		UART_read(uart, rxBuffer, sizeof(rxBuffer));
		serial_printf(cli_stdout, "%s", rxBuffer);


		Task_sleep(11000);
		UART_write(uart, sim800_at_httpaction, strlen(sim800_at_httpaction));

		Task_sleep(300);
		UART_write(uart, sim800_at_httpread, strlen(sim800_at_httpread));

		Task_sleep(300);
		UART_write(uart, sim800_at_httpterm, strlen(sim800_at_httpterm));
		UART_read(uart, rxBuffer, sizeof(rxBuffer));

	}
}
开发者ID:Octanis1,项目名称:Octanis1-Mainboard-Firmware_MSP_EXP432P401RLP,代码行数:26,代码来源:sim800.c

示例4: sim800_begin

//must be called from within a task - this function will block!
//returns 1 if modem responds with OK
int sim800_begin(){
	char rxBuffer[SIM800_RXBUFFER_SIZE];
	memset(&rxBuffer, 0, sizeof(rxBuffer));

	if(sim800_open()){
		UART_write(uart, sim800_at_echo_off, sizeof(sim800_at_echo_off));
		UART_read(uart, rxBuffer, sizeof(rxBuffer));
		Task_sleep(500);

		memset(&rxBuffer, 0, sizeof(rxBuffer));
		UART_write(uart, sim800_at_echo_off, sizeof(sim800_at_echo_off));
		UART_read(uart, rxBuffer, sizeof(rxBuffer));

		serial_printf(cli_stdout, "%s", rxBuffer);
		Task_sleep(500);

		if(!strcmp("\r\nOK\r\n", rxBuffer)){
			sim800_initialised = 1;
			return 1; //modem can now communicate with us
		}else{
			return 0;
		}
	}else{
		return 0;
	}
}
开发者ID:Octanis1,项目名称:Octanis1-Mainboard-Firmware_MSP_EXP432P401RLP,代码行数:28,代码来源:sim800.c

示例5: Utils_tskDelete

Int32 Utils_tskDelete(Utils_TskHndl * pHndl)
{
    UInt32 sleepTime = 8;                                  /* in OS ticks */

    Utils_tskSendCmd(pHndl, UTILS_TSK_CMD_EXIT);

    /* wait for command to be received and task to be exited */

    Task_sleep(1);

    while (Task_Mode_TERMINATED != Task_getMode(pHndl->tsk))
    {

        Task_sleep(sleepTime);

        sleepTime >>= 1;

        if (sleepTime == 0)
        {
            char name[64];

            strcpy(name, "INVALID_TSK");
            Utils_prfGetTaskName(pHndl->tsk, name);
            Vps_printf("Task Delete Error!!!!!!, task %s not deleted\n", name);
            UTILS_assert(0);
        }
    }

    Utils_prfLoadUnRegister(pHndl->tsk);

    Task_delete(&pHndl->tsk);
    Utils_mbxDelete(&pHndl->mbx);

    return FVID2_SOK;
}
开发者ID:sdut10523,项目名称:dvr_rdk,代码行数:35,代码来源:utils_tsk.c

示例6: display_on_matrix

void display_on_matrix(uint32_t number)
{
	char str[10];
	sprintf(str, "%d", number);
	int i = 0;
	for(i=0; str[i]!='\0';i++)
	{
		turnOffAllLeds();
		Task_sleep(300);
		displayChar(str[i]);
		Task_sleep(300);
	}
}
开发者ID:droptableuser,项目名称:embsysproject,代码行数:13,代码来源:Blink_Task.c

示例7: radioTask

Void radioTask(UArg arg0, UArg arg1){

	GPIO_write(MSP_OCT1_432P401RLP_5V_EN, 1);
	GPIO_write(MSP_OCT1_432P401RLP_HX1_EN, 1);

	while(true){
		GPIO_write(MSP_OCT1_432P401RLP_HX1_TX, 1);
		Task_sleep(1000);
		GPIO_write(MSP_OCT1_432P401RLP_HX1_TX, 0);

		Task_sleep(3000);
	}
}
开发者ID:Octanis1,项目名称:Octanis1-Mainboard-Firmware,代码行数:13,代码来源:radio.c

示例8: blink_led

void blink_led(uint8_t x, uint8_t y, uint8_t z){
	// Turn on
	//Input for Latches Port1-8
	GPIOPinWrite(GPIO_PORTG_BASE,GPIO_PIN_0,x);
	GPIOPinWrite(GPIO_PORTA_BASE,GPIO_PIN_1 |GPIO_PIN_2 |GPIO_PIN_3 |GPIO_PIN_4 |GPIO_PIN_5 |GPIO_PIN_6 |GPIO_PIN_7,x);
	Task_sleep(SLEEP_TIME);
	// CS latches Port11-18
	GPIOPinWrite(GPIO_PORTD_BASE,GPIO_PIN_0 |GPIO_PIN_1 |GPIO_PIN_2 |GPIO_PIN_3 |GPIO_PIN_4 |GPIO_PIN_5 |GPIO_PIN_6 |GPIO_PIN_7,y);
	Task_sleep(SLEEP_TIME);
	GPIOPinWrite(GPIO_PORTD_BASE,GPIO_PIN_0 |GPIO_PIN_1 |GPIO_PIN_2 |GPIO_PIN_3 |GPIO_PIN_4 |GPIO_PIN_5 |GPIO_PIN_6 |GPIO_PIN_7,0);
	Task_sleep(SLEEP_TIME);
	//Anode Port21-28
	GPIOPinWrite(GPIO_PORTK_BASE,GPIO_PIN_0 |GPIO_PIN_1 |GPIO_PIN_2 |GPIO_PIN_3 |GPIO_PIN_4 |GPIO_PIN_5 |GPIO_PIN_6 |GPIO_PIN_7,z);
	Task_sleep(SLEEP_TIME);
	//Turn off
	//Zero all latches
	GPIOPinWrite(GPIO_PORTG_BASE,GPIO_PIN_0,0);
	GPIOPinWrite(GPIO_PORTA_BASE,GPIO_PIN_1 |GPIO_PIN_2 |GPIO_PIN_3 |GPIO_PIN_4 |GPIO_PIN_5 |GPIO_PIN_6 |GPIO_PIN_7,0);
	Task_sleep(SLEEP_TIME);
	//Select all latches
	GPIOPinWrite(GPIO_PORTD_BASE,GPIO_PIN_0 |GPIO_PIN_1 |GPIO_PIN_2 |GPIO_PIN_3 |GPIO_PIN_4 |GPIO_PIN_5 |GPIO_PIN_6 |GPIO_PIN_7,0xFF);
	Task_sleep(SLEEP_TIME);
	GPIOPinWrite(GPIO_PORTD_BASE,GPIO_PIN_0 |GPIO_PIN_1 |GPIO_PIN_2 |GPIO_PIN_3 |GPIO_PIN_4 |GPIO_PIN_5 |GPIO_PIN_6 |GPIO_PIN_7,0);
	Task_sleep(SLEEP_TIME);
	GPIOPinWrite(GPIO_PORTK_BASE,GPIO_PIN_0 |GPIO_PIN_1 |GPIO_PIN_2 |GPIO_PIN_3 |GPIO_PIN_4 |GPIO_PIN_5 |GPIO_PIN_6 |GPIO_PIN_7,0);
	Task_sleep(SLEEP_TIME);


}
开发者ID:droptableuser,项目名称:embsysengineering,代码行数:29,代码来源:ledcube.c

示例9: _clip_setlock

int
_clip_setlock(ClipMachine * ClipMachineMemory, long hash, int fd, off_t pos, int flags)
{
   int ok = 0;

   struct flock fl;

   fl.l_type = (flags & CLIP_LOCK_WRITE) ? F_WRLCK : F_RDLCK;
   fl.l_whence = SEEK_SET;
   fl.l_start = pos;
   fl.l_len = (flags & CLIP_LOCK_FLOCK) ? pos - 1 : 1;

   while (1)
   {
      if (fl.l_type == F_WRLCK)
	 ok = _clip_wrlock(ClipMachineMemory->tasklocks, hash, fd, &fl, !(flags & CLIP_LOCK_HILEVEL));
      else
	 ok = _clip_rdlock(ClipMachineMemory->tasklocks, hash, fd, &fl, !(flags & CLIP_LOCK_HILEVEL));

      if (ok || !(flags & CLIP_LOCK_WAIT))
	 break;
#ifdef USE_TASKS
      Task_sleep(1);
#else
      usleep(1);
#endif
   }
   return !ok;
}
开发者ID:amery,项目名称:clip-angelo,代码行数:29,代码来源:_clip_setlock.c

示例10: appTaskFxn

Void appTaskFxn(UArg arg0, UArg arg1)
{
	char* args[8];
	//arg[0] is 2 chars for dev type
	args[0] = Memory_alloc(NULL, 2 * sizeof(char), 0, NULL);
	//arg[1] is 3 chars for channel num
	args[1] = Memory_alloc(NULL, 3 * sizeof(char), 0, NULL);

	//init the RPC queue
	rpcInitMq();

	//init the application thread to register the callbacks
	appInit();

	consolePrint(
	        "Enter device type c: Coordinator, r: Router, e: End Device:\n");
	consoleGetLine(args[0], 8);

	consolePrint("Enter channel 11-26:\n");
	consoleGetLine(args[1], 8);

	while (1)
	{
		appProcess(args);
		Task_sleep(10);
	}

	Memory_free(NULL, args[0], 2 * sizeof(char));
	Memory_free(NULL, args[1], 3 * sizeof(char));
}
开发者ID:GisKook,项目名称:smarthomebox,代码行数:30,代码来源:main.c

示例11: Dsp_AppTask

Void Dsp_AppTask (UArg arg1, UArg arg2)
{
  OMX_ERRORTYPE eError = OMX_ErrorNone;
  //TIMM_OSAL_ERRORTYPE osalError = TIMM_OSAL_ERR_NONE;

  /*--------------------------------------------------------------------------*/
  /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  /* Initiailize the system. The initialization can include driver, syslink */
  /* cache.  */
  /*--------------------------------------------------------------------------*/
  Log_print0 (Diags_USER1,"DSP: In Dsp_AppTask");
  platform_init ();
  Log_print0 (Diags_USER1,"DSP: Platform Initialized");

  while (TRUE)
  {
    Task_sleep (DSP_APP_TASK_SLEEP_DURATION);
  }

  /*--------------------------------------------------------------------------*/
  /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  /* UnInitiailize the system.  */
  /*--------------------------------------------------------------------------*/
  platform_deinit ();
  Log_print0 (Diags_USER1,"DSP: Platform De-Initialized");

  Log_print0 (Diags_USER1,"DSP: Exiting the system");
  System_exit (0);

//EXIT:
  if (eError != OMX_ErrorNone)
  {
    Log_print1 (Diags_USER1,"Error in executing app. Failed code:%d", eError);
  }
}                               /* Dsp_AppTask */
开发者ID:andreimironenko,项目名称:omx,代码行数:35,代码来源:main_c674.c

示例12: sim800_init_http

void sim800_init_http(SIM800_MIME mime_type){
	if(!sim800_initialised){
		serial_printf(cli_stdout, "sim800 not initialised",0);
	}else{
		char rxBuffer[SIM800_RXBUFFER_SIZE];
		int i;

		const char *init_http_cmdseq[] = {
			sim800_at_sapbr_apn,
			sim800_at_sapbr,
			sim800_at_httpinit,
			sim800_at_httppara_url,
			sim800_at_httppara_cid,
			""
		};

		//set selected mime type
		if(mime_type == MIME_OCTET_STREAM){
			init_http_cmdseq[5] = sim800_at_httppara_content_stream;
		}else{
			init_http_cmdseq[5] = sim800_at_httppara_content_text;
		}


		for(i=0; i<6; i++){
			memset(&rxBuffer, 0, sizeof(rxBuffer));
			UART_write(uart, init_http_cmdseq[i], strlen(init_http_cmdseq[i]));
			UART_read(uart, rxBuffer, sizeof(rxBuffer));
			Task_sleep(200);
		}


	}
}
开发者ID:Octanis1,项目名称:Octanis1-Mainboard-Firmware_MSP_EXP432P401RLP,代码行数:34,代码来源:sim800.c

示例13: usleep

int usleep(useconds_t usec)
{
	// tall TI-RTOS sleep task
	Task_sleep(usec / Clock_tickPeriod);

	return 0;
}
开发者ID:GisKook,项目名称:smarthomebox,代码行数:7,代码来源:unistd.c

示例14: Ducati_AppTask

Void Ducati_AppTask (UArg arg1, UArg arg2)
{
	FCSettings_init();
	Diags_setMask(FCSETTINGS_MODNAME"+12345678LEXAIZFS");
	CESettings_init();
	Diags_setMask(CESETTINGS_MODNAME"+12345678LEXAIZFS");
//	Diags_setMask("ti.sdo.rcm.RcmServer-12");
//	Diags_setMask("ti.sysbios.utils.Load-4");

    init_IVAHDFrwk();
    HDVICP_Reset(NULL, NULL);
    platform_init();

    /* how do we know when to unload.. */
    while (1) {
        Task_sleep(0x7fffffff);
    }

    /*The test cases will run in this task's context in the init call.
    Once init returns, testcases have exited so do deinit*/
    platform_deinit();

    exit_IVAHDFrwk();

    System_exit(0);
}
开发者ID:chenguangshen,项目名称:libdce,代码行数:26,代码来源:main.c

示例15: heartBeatFxn

/*
 *  ======== heartBeatFxn ========
 *  Toggle the Board_LED0. The Task_sleep is determined by arg0 which
 *  is configured for the heartBeat Task instance.
 */
Void heartBeatFxn(UArg arg0, UArg arg1)
{
    while (1) {
        Task_sleep((unsigned int)arg0);
        GPIO_toggle(Board_LED0);
    }
}
开发者ID:tomaszmat,项目名称:simulate,代码行数:12,代码来源:empty.c


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