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


C++ xTimerStart函数代码示例

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


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

示例1: main_full

void main_full( void )
{
TimerHandle_t xCheckTimer = NULL;

	/* Start all the other standard demo/test tasks.  The have not particular
	functionality, but do demonstrate how to use the FreeRTOS API and test the
	kernel port. */
	vStartIntegerMathTasks( tskIDLE_PRIORITY );
	vStartDynamicPriorityTasks();
	vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
	vCreateBlockTimeTasks();
	vStartCountingSemaphoreTasks();
	vStartGenericQueueTasks( tskIDLE_PRIORITY );
	vStartRecursiveMutexTasks();
	vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
	vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
	vStartMathTasks( mainFLOP_TASK_PRIORITY );
	
	/* Create the register check tasks, as described at the top of this
	file */
	xTaskCreate( vRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
	xTaskCreate( vRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );

	/* Create the software timer that performs the 'check' functionality,
	as described at the top of this file. */
	xCheckTimer = xTimerCreate( "CheckTimer",						/* A text name, purely to help debugging. */
								( mainCHECK_TIMER_PERIOD_MS ),		/* The timer period, in this case 3000ms (3s). */
								pdTRUE,								/* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
								( void * ) 0,						/* The ID is not used, so can be set to anything. */
								prvCheckTimerCallback				/* The callback function that inspects the status of all the other tasks. */
							  );	
	
	if( xCheckTimer != NULL )
	{
		xTimerStart( xCheckTimer, mainDONT_BLOCK );
	}

	/* The set of tasks created by the following function call have to be 
	created last as they keep account of the number of tasks they expect to see 
	running. */
	vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );

	/* Start the scheduler. */
	vTaskStartScheduler();
	
	/* If all is well, the scheduler will now be running, and the following line
	will never be reached.  If the following line does execute, then there was
	insufficient FreeRTOS heap memory available for the idle and/or timer tasks
	to be created.  See the memory management section on the FreeRTOS web site
	for more details. */
	for( ;; );	
}
开发者ID:vstehle,项目名称:FreeRTOS,代码行数:52,代码来源:main_full.c

示例2: SEND_Initialize

void SEND_Initialize ( void )
{
    sendData.state = SEND_STATE_INIT;
    sendData.sendCount = 0x55;
    sendData.testCount = 0;
    sendData.enqueueCount = 0;
    sendData.prevType = 'a';
    sendData.prevCount = 'a';
    
    strcpy(sendData.storedMessage, "~e8765432.");
    
    sendData.sendStoredMessage = 0;

    
    //Create a queue capable of holding 1000 characters
    sendData.transmitQ_SA = xQueueCreate( 1000, sizeof(char) );
    if( sendData.transmitQ_SA == 0 ) {
        dbgOutputVal(SEND_QUEUE_FAIL);
        stopAll();
    }
    
    // Create a queue capable of holding 250 messages
    sendData.sendQ_LR = xQueueCreate(250, MSG_LENGTH+1);
    if (sendData.sendQ_LR == 0) {
        dbgOutputVal(SEND_QUEUE_FAIL);
        stopAll();
    }
    
    //Create a timer
    sendData.sendTimer_SA = xTimerCreate(  
                     "SendTimer100ms", //Just a text name
                     ( 1000 / portTICK_PERIOD_MS ), //period is 100ms
                     pdTRUE, //auto-reload when expires
                     (void *) 24, //a unique id
                     sendTimerCallback ); //pointer to callback function
    
    
    //if SENSOR_DEBUG_NOACK is defined, then don't start the timer
    #ifndef SENSOR_DEBUG_NOACK
        //Start the timer
        if( sendData.sendTimer_SA == NULL ) {
            dbgOutputVal(SEND_TIMERINIT_FAIL);
            stopAll();
        }
        else if( xTimerStart( sendData.sendTimer_SA, 0 ) != pdPASS ) {
            dbgOutputVal(SEND_TIMERINIT_FAIL);
            stopAll();
        }
    #endif
    
     
}
开发者ID:bt2016,项目名称:ece4534_team4,代码行数:52,代码来源:send.c

示例3: soundInit

void soundInit(void)
{
  if (isInit)
    return;

  neffect = sizeof(effects)/sizeof(effects[0])-1;

  timer = xTimerCreate("SoundTimer", M2T(10),
                                     pdTRUE, NULL, soundTimer);
  xTimerStart(timer, 100);

  isInit = true;
}
开发者ID:Alfredvc,项目名称:crazyflie,代码行数:13,代码来源:sound_cf2.c

示例4: createTimerWifi

void ICACHE_FLASH_ATTR createTimerWifi(void){
	if(!restartActive){
	    restartActive=1;
             xTimerHandle wifiTimer2=xTimerCreate("s",200,pdFALSE, (void *)1,vTimerSACallback);
           if( xTimerStart( wifiTimer2,0) == pdPASS )  {
              printf("timer SOft AP babe!!!!! \n");  
           }


	}


}
开发者ID:JanisIOT,项目名称:JanisEsp8266,代码行数:13,代码来源:wifi.c

示例5: startTimerForADC

void startTimerForADC(adcStruct *adcData) {
	if (sizeof(long) != sizeof(adcStruct *)) {
		VT_HANDLE_FATAL_ERROR(0);
	}
	xTimerHandle adcTimerHandle = xTimerCreate((const signed char *)"ADC Timer",adcWRITE_RATE_BASE,pdTRUE,(void *) adcData,adcTimerCallback);
	if (adcTimerHandle == NULL) {
		VT_HANDLE_FATAL_ERROR(0);
	} else {
		if (xTimerStart(adcTimerHandle,0) != pdPASS) {
			VT_HANDLE_FATAL_ERROR(0);
		}
	}
}
开发者ID:nbjones,项目名称:RTOSDemo,代码行数:13,代码来源:myTimers.c

示例6: startTimerForLCD

void startTimerForLCD(vtLCDStruct *vtLCDdata) {
	if (sizeof(long) != sizeof(vtLCDStruct *)) {
		VT_HANDLE_FATAL_ERROR(0);
	}
	xTimerHandle LCDTimerHandle = xTimerCreate((const signed char *)"LCD Timer",lcdWRITE_RATE_BASE,pdTRUE,(void *) vtLCDdata,LCDTimerCallback);
	if (LCDTimerHandle == NULL) {
		VT_HANDLE_FATAL_ERROR(0);
	} else {
		if (xTimerStart(LCDTimerHandle,0) != pdPASS) {
			VT_HANDLE_FATAL_ERROR(0);
		}
	}
}
开发者ID:nbjones,项目名称:RTOSDemo,代码行数:13,代码来源:myTimers.c

示例7: prvInitialise_uIP

static void prvInitialise_uIP( void )
{
    TimerHandle_t xARPTimer, xPeriodicTimer;
    uip_ipaddr_t xIPAddr;
    const unsigned long ul_uIPEventQueueLength = 10UL;

    /* Initialise the uIP stack. */
    uip_init();
    uip_ipaddr( &xIPAddr, configIP_ADDR0, configIP_ADDR1, configIP_ADDR2, configIP_ADDR3 );
    uip_sethostaddr( &xIPAddr );
    uip_ipaddr( &xIPAddr, configNET_MASK0, configNET_MASK1, configNET_MASK2, configNET_MASK3 );
    uip_setnetmask( &xIPAddr );
    prvSetMACAddress();
    httpd_init();

    /* Create the queue used to sent TCP/IP events to the uIP stack. */
    xEMACEventQueue = xQueueCreate( ul_uIPEventQueueLength, sizeof( unsigned long ) );

    /* Create and start the uIP timers. */
    xARPTimer = xTimerCreate( 	"ARPTimer", /* Just a name that is helpful for debugging, not used by the kernel. */
                                ( 10000UL / portTICK_PERIOD_MS ), /* Timer period. */
                                pdTRUE, /* Autor-reload. */
                                ( void * ) uipARP_TIMER,
                                prvUIPTimerCallback
                            );

    xPeriodicTimer = xTimerCreate( 	"PeriodicTimer",
                                    ( 50 / portTICK_PERIOD_MS ),
                                    pdTRUE, /* Autor-reload. */
                                    ( void * ) uipPERIODIC_TIMER,
                                    prvUIPTimerCallback
                                 );

    configASSERT( xARPTimer );
    configASSERT( xPeriodicTimer );

    xTimerStart( xARPTimer, portMAX_DELAY );
    xTimerStart( xPeriodicTimer, portMAX_DELAY );
}
开发者ID:BuiChien,项目名称:FreeRTOS-TM4C123GXL,代码行数:39,代码来源:uIP_Task.c

示例8: app_timer_start

uint32_t app_timer_start(app_timer_id_t timer_id, uint32_t timeout_ticks, void * p_context)
{
    app_timer_info_t * pinfo = (app_timer_info_t*)(timer_id);
    TimerHandle_t hTimer = pinfo->osHandle;
    uint32_t rtc_prescaler = portNRF_RTC_REG->PRESCALER  + 1;
    /* Get back the microseconds to wait */
    uint32_t timeout_corrected = ROUNDED_DIV(timeout_ticks * m_prescaler, rtc_prescaler);

    if (hTimer == NULL)
    {
        return NRF_ERROR_INVALID_STATE;
    }
    if (pinfo->active && (xTimerIsTimerActive(hTimer) != pdFALSE))
    {
        // Timer already running - exit silently
        return NRF_SUCCESS;
    }

    pinfo->argument = p_context;

    if (__get_IPSR() != 0)
    {
        BaseType_t yieldReq = pdFALSE;
        if (xTimerChangePeriodFromISR(hTimer, timeout_corrected, &yieldReq) != pdPASS)
        {
            return NRF_ERROR_NO_MEM;
        }

        if ( xTimerStartFromISR(hTimer, &yieldReq) != pdPASS )
        {
            return NRF_ERROR_NO_MEM;
        }

        portYIELD_FROM_ISR(yieldReq);
    }
    else
    {
        if (xTimerChangePeriod(hTimer, timeout_corrected, APP_TIMER_WAIT_FOR_QUEUE) != pdPASS)
        {
            return NRF_ERROR_NO_MEM;
        }

        if (xTimerStart(hTimer, APP_TIMER_WAIT_FOR_QUEUE) != pdPASS)
        {
            return NRF_ERROR_NO_MEM;
        }
    }

    pinfo->active = true;
    return NRF_SUCCESS;
}
开发者ID:AaltoNEPPI,项目名称:nRF52_dev,代码行数:51,代码来源:app_timer_freertos.c

示例9: startProductionControl

void startProductionControl(){
	// Initialize xpre and xhat
	int i;
	for(i = 0; i < 4; ++i){
		plantParams.xpre[i] = 0.; // precomputed state vector
		plantParams.xhat[i] = 0.; // state vector [theta, alpha, thetadot, alphadot]
	}
	plantParams.cycle_count = 0;

	// Make sure tick_count is set to 1000 so that each tick is 1 millisecond as seen bellow
	ProductionControlTimer = xTimerCreate((const signed char *)"Production Controller Timer",1,pdTRUE,(void *) NULL, production_control_timer);
	xTimerStart(ProductionControlTimer, 0);
	xil_printf("Production Controller Timer started\n");
}
开发者ID:pallavides,项目名称:Bare_AMP_Zed,代码行数:14,代码来源:production_controller.c

示例10: wiced_rtos_start_timer

wiced_result_t wiced_rtos_start_timer( wiced_timer_t* timer )
{
    if ( xTimerReset( timer->handle, WICED_WAIT_FOREVER ) != pdPASS )
    {
        return WICED_ERROR;
    }

    if ( xTimerStart( timer->handle, WICED_WAIT_FOREVER ) != pdPASS )
    {
        return WICED_ERROR;
    }

    return WICED_SUCCESS;
}
开发者ID:fishbaoz,项目名称:wiced-emw3165,代码行数:14,代码来源:wiced_rtos.c

示例11: APP_Initialize

void APP_Initialize ( void )
{
    /* Place the App state machine in its initial state. */
    appData.state = APP_STATE_INIT;
    
    /* TODO: Initialize your application's state machine and other
     * parameters.
     */
    
    // uart initialization
    // The following code snippet shows an example USART driver initialization.
    // The driver is initialized for normal mode and a baud of 300. The
    // receive queue size is set to 2 and transmit queue size is set to 3.
    


    usartInit.baud  = 57600;
    usartInit.mode  = DRV_USART_OPERATION_MODE_NORMAL;
    usartInit.flags = DRV_USART_INIT_FLAG_NONE;
    usartInit.usartID   = USART_ID_1;
    usartInit.brgClock  = 80000000;
    usartInit.handshake = DRV_USART_HANDSHAKE_NONE;
    usartInit.lineControl       = DRV_USART_LINE_CONTROL_8NONE1;
    usartInit.interruptError    = INT_SOURCE_USART_1_ERROR;
    usartInit.interruptReceive  = INT_SOURCE_USART_1_RECEIVE;
    usartInit.queueSizeReceive  = 2;
    usartInit.queueSizeTransmit = 3;
    usartInit.interruptTransmit = INT_SOURCE_USART_1_TRANSMIT;
    usartInit.moduleInit.value  = SYS_MODULE_POWER_RUN_FULL;

//    objectHandle = DRV_USART_Initialize(DRV_USART_INDEX_1, (SYS_MODULE_INIT*)&usartInit);
//    if (SYS_MODULE_OBJ_INVALID == objectHandle)
//    {
//        // Handle error
//    }
    
    handle = DRV_USART_Open(DRV_USART_INDEX_0, DRV_IO_INTENT_NONBLOCKING | DRV_IO_INTENT_WRITE);
    if (DRV_HANDLE_INVALID == handle)
    {
        // Unable to open the driver
        // May be the driver is not initialized or the initialization
        // is not complete.
    }
    
    
    // timer setup
    xTimer = xTimerCreate("Timer", 10, pdTRUE, 0, vTimerCallback);
    xTimerStart(xTimer, 0);
    vTaskStartScheduler();
}
开发者ID:ryandw12,项目名称:Milestone2,代码行数:50,代码来源:app.c

示例12: lineTimerCallback

void lineTimerCallback( TimerHandle_t pxTimer )
{
    
    outputEvent(LINE_READING_START);
    
    if(!wait)
        if( xTimerStart( lineTimer, 0 ) != pdPASS )
            outputEvent(LINETIMER_NOT_STARTED);
   
    
    //Set Pins to digital output and HIGH
    SYS_PORTS_PinDirectionSelect(PORTS_ID_0, SYS_PORTS_DIRECTION_OUTPUT, PORT_CHANNEL_B, PORTS_BIT_POS_11);
    SYS_PORTS_PinDirectionSelect(PORTS_ID_0, SYS_PORTS_DIRECTION_OUTPUT, PORT_CHANNEL_B, PORTS_BIT_POS_12);
    SYS_PORTS_PinDirectionSelect(PORTS_ID_0, SYS_PORTS_DIRECTION_OUTPUT, PORT_CHANNEL_B, PORTS_BIT_POS_13);
    SYS_PORTS_PinDirectionSelect(PORTS_ID_0, SYS_PORTS_DIRECTION_OUTPUT, PORT_CHANNEL_G, PORTS_BIT_POS_8);
    SYS_PORTS_PinDirectionSelect(PORTS_ID_0, SYS_PORTS_DIRECTION_OUTPUT, PORT_CHANNEL_A, PORTS_BIT_POS_10);
    SYS_PORTS_PinDirectionSelect(PORTS_ID_0, SYS_PORTS_DIRECTION_OUTPUT, PORT_CHANNEL_F, PORTS_BIT_POS_0);
    SYS_PORTS_PinDirectionSelect(PORTS_ID_0, SYS_PORTS_DIRECTION_OUTPUT, PORT_CHANNEL_F, PORTS_BIT_POS_1);
    SYS_PORTS_PinDirectionSelect(PORTS_ID_0, SYS_PORTS_DIRECTION_OUTPUT, PORT_CHANNEL_D, PORTS_BIT_POS_6);
    
    
    SYS_PORTS_PinSet(PORTS_ID_0, PORT_CHANNEL_B, PORTS_BIT_POS_11);
    SYS_PORTS_PinSet(PORTS_ID_0, PORT_CHANNEL_B, PORTS_BIT_POS_13);
    SYS_PORTS_PinSet(PORTS_ID_0, PORT_CHANNEL_B, PORTS_BIT_POS_12);
    SYS_PORTS_PinSet(PORTS_ID_0, PORT_CHANNEL_G, PORTS_BIT_POS_8);
    SYS_PORTS_PinSet(PORTS_ID_0, PORT_CHANNEL_A, PORTS_BIT_POS_10);
    SYS_PORTS_PinSet(PORTS_ID_0, PORT_CHANNEL_F, PORTS_BIT_POS_0);
    SYS_PORTS_PinSet(PORTS_ID_0, PORT_CHANNEL_F, PORTS_BIT_POS_1);
    SYS_PORTS_PinSet(PORTS_ID_0, PORT_CHANNEL_D, PORTS_BIT_POS_6);
    
    //Start timer to charge cap and read data
    validData = false;
    if( xTimerStart( readTimer, 0 ) != pdPASS ){
        outputEvent(READTIMER_NOT_STARTED);
    }
}
开发者ID:kyleimh,项目名称:Embedded,代码行数:36,代码来源:timerCallbacks.c

示例13: main

int main(void) {
	initx();
	xTimerHandle timer = xTimerCreate((const signed char *) "timer",
			1000 / portTICK_RATE_MS, pdTRUE, NULL, toggleLedCallback);
	send_string_uart("timer created\n");
	queue = xQueueCreate(20, 1);
	xTaskCreate(acceleration_task, (signed char*)"acceleration_task", 128, NULL,
			tskIDLE_PRIORITY+1, NULL);
	send_string_uart("queue created\n");
	xTimerStart(timer, 0);
	send_string_uart("timer started\n");
	send_string_uart("INIT DONE, Starting\n");
	vTaskStartScheduler();
	return 0;
}
开发者ID:nraynaud,项目名称:DiscoveryF4_RTOS,代码行数:15,代码来源:main.c

示例14: vModeAstroStart

void vModeAstroStart(uint8_t motor_mask, uint8_t dir, float_t gear, float_t fact)
{
    if (state != MODE_ASTRO_STATE_STOP) return;
    
    taskENTER_CRITICAL();
    {
        state = MODE_ASTRO_STATE_WAKE_SM;
		motors = motor_mask;
        direction = dir;
        gear_reduction = gear;
		factor = fact;
        xTimerStart(xModeAstroControlTimer, 0);
    }
    taskEXIT_CRITICAL();
}
开发者ID:milindur,项目名称:MdkController,代码行数:15,代码来源:mode_astro.c

示例15: main_blinky

void main_blinky( void )
{
xTimerHandle xTimer;
xQueueHandle xQueue;

	/* Create the queue. */
	xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) );

	if( xQueue != NULL )
	{
		/* Start the two tasks as described in the comments at the top of this
		file. */
		xTaskCreate( prvQueueReceiveTask,					/* The function that implements the task. */
					( signed char * ) "Rx", 				/* The text name assigned to the task - for debug only as it is not used by the kernel. */
					configMINIMAL_STACK_SIZE, 				/* The size of the stack to allocate to the task. */
					( void * ) xQueue, 						/* Pass the queue into the task using the task parameter. */
					mainQUEUE_RECEIVE_TASK_PRIORITY, 		/* The priority assigned to the task. */
					NULL );									/* The task handle is not required, so NULL is passed. */

		xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, ( void * ) xQueue, mainQUEUE_SEND_TASK_PRIORITY, NULL );

		/* Create the blinky software timer as described at the top of this
		file. */
		xTimer = xTimerCreate(	( const signed char * ) "Blinky",/* A text name, purely to help debugging. */
								( mainBLINKY_TIMER_PERIOD ),	/* The timer period. */
								pdTRUE,							/* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
								( void * ) 0,					/* The ID is not used, so can be set to anything. */
								prvBlinkyTimerCallback );		/* The callback function that inspects the status of all the other tasks. */

		configASSERT( xTimer );

		if( xTimer != NULL )
		{
			xTimerStart( xTimer, mainDONT_BLOCK );
		}

		/* Start the tasks and timer running. */
		vTaskStartScheduler();
	}

	/* If all is well, the scheduler will now be running, and the following
	line will never be reached.  If the following line does execute, then
	there was insufficient FreeRTOS heap memory available for the idle and/or
	timer tasks	to be created.  See the memory management section on the
	FreeRTOS web site for more details. */
	for( ;; );
}
开发者ID:BirdBare,项目名称:STM32F4-Discovery_FW_V1.1.0_Makefiles,代码行数:47,代码来源:main_blinky.c


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