本文整理汇总了C++中xTimerCreate函数的典型用法代码示例。如果您正苦于以下问题:C++ xTimerCreate函数的具体用法?C++ xTimerCreate怎么用?C++ xTimerCreate使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xTimerCreate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main_full
void main_full( void )
{
xTimerHandle 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, ( signed char * ) "Reg1", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
xTaskCreate( vRegTest2Task, ( signed char * ) "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( ( const signed char * ) "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( ;; )
{
__asm volatile( "NOP" );
}
}
示例2: buzzerInit
static void buzzerInit(DeckInfo *info)
{
piezoInit();
neffect = sizeof(effects)/sizeof(effects[0])-1;
nmelody = sizeof(melodies)/sizeof(melodies[0])-1;
timer = xTimerCreate( "buzztimer", M2T(10),
pdTRUE, NULL, buzzTimer );
xTimerStart(timer, 100);
}
示例3: timer_initialize
// Initializes timer to specified period in ms
void timer_initialize(int ms)
{
TimerHandle_t myTimer1;
myTimer1 = xTimerCreate("test",
(ms/portTICK_PERIOD_MS),
pdTRUE,
(void *)0,
timerCallback);
if (xTimerStart(myTimer1,10) == pdFAIL)
error('a');
}
示例4: xTimerCreate
FreeRTOSTimer::FreeRTOSTimer(tmrTIMER_CALLBACK pFunction, TIME_MS t, TimerType type)
{
// xTimerCreate() copies the pointer for the name, so the tName variable
// cannot simply be on the stack, it should be global or static
static signed char tName[] = "Tmr";
mTimerHandle = xTimerCreate(tName, OS_MS(t),
type == TimerOneShot ? pdFALSE : pdTRUE,
0,
pFunction);
}
示例5: osTimerCreate
/// Create a timer.
/// \param[in] timer_def timer object referenced with \ref osTimer.
/// \param[in] type osTimerOnce for one-shot or osTimerPeriodic for periodic behavior.
/// \param[in] argument argument to the timer call back function.
/// \return timer ID for reference by other functions or NULL in case of error.
/// \note MUST REMAIN UNCHANGED: \b osTimerCreate shall be consistent in every CMSIS-RTOS.
osTimerId osTimerCreate (const osTimerDef_t *timer_def, os_timer_type type, void *argument)
{
timer_def->custom->argument = argument;
return xTimerCreate((const portCHAR *)"",
1, //Set later when timer is started
(type == osTimerPeriodic) ? pdTRUE : pdFALSE,
(void *)timer_def,
_osTimerCallbackFreeRTOS
);
}
示例6: vTask4
void vTask4(void *pvParameters) {
// Remove compiler warnings.
(void) pvParameters;
xTimer1 = xTimerCreate( "Timer 1",( 4000 ), pdTRUE,( void * ) 41, vTimerCallback1);
xTimerStart(xTimer1,0);
vTaskDelay(2000);
xTimer2 = xTimerCreate( "Timer 2",( 4000 ), pdTRUE,( void * ) 42, vTimerCallback2);
xTimerStart(xTimer2,0);
vTaskDelay(1000);
xTimer3 = xTimerCreate( "Timer 3",( 2000 ), pdTRUE,( void * ) 43, vTimerCallback3);
xTimerStart(xTimer3,0);
while (1) {
vTaskSuspend(NULL);
}
vTaskDelete(NULL);
}
示例7: prvOptionallyCreateComprehensveTestApplication
static void prvOptionallyCreateComprehensveTestApplication( void )
{
#if ( mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY == 0 )
{
xTimerHandle xCheckTimer = NULL;
/* Start all the other standard demo/test tasks. */
vStartIntegerMathTasks( tskIDLE_PRIORITY );
vStartDynamicPriorityTasks();
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
vCreateBlockTimeTasks();
vStartCountingSemaphoreTasks();
vStartGenericQueueTasks( tskIDLE_PRIORITY );
vStartRecursiveMutexTasks();
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
/* Most importantly, start the tasks that use the FPU. */
vStartMathTasks( mainFLOP_TASK_PRIORITY );
/* Create the register check tasks, as described at the top of this
file */
xTaskCreate( vRegTest1Task, ( signed char * ) "Reg1", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
xTaskCreate( vRegTest2Task, ( signed char * ) "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( ( const signed char * ) "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 );
}
/* This task has to be created last as it keeps account of the number of
tasks it expects to see running. */
vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
}
#else /* mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY */
{
/* Just to prevent compiler warnings when the configuration options are
set such that these static functions are not used. */
( void ) vRegTest1Task;
( void ) vRegTest2Task;
( void ) prvCheckTimerCallback;
( void ) prvSetupNestedFPUInterruptsTest;
}
#endif /* mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY */
}
示例8: APP_Initialize
void APP_Initialize ( void )
{
//stopEverything();
/* Place the App state machine in its initial state. */
appData.state = APP_STATE_INIT;
/* TODO: Initialize your application's state machine and other
* parameters.
*/
//Create the queue
appData.local_q = xQueueCreate(10, sizeof(unsigned int));
//Ensure queue was created. If not, do not continue and turn on LED
if(appData.local_q == 0)
{
stopEverything();
}
appData.sensor1_q = xQueueCreate(100, sizeof(unsigned char));
if(appData.sensor1_q == 0)
{
stopEverything();
}
//stopEverything();
//Create the timer
appData.local_timer = xTimerCreate( "50msTimer",
50 / portTICK_PERIOD_MS,
pdTRUE,
0,
vTimerCallback );
//Ensure timer was created. If not, do not continue and turn on LED
if(appData.local_timer == 0)
{
stopEverything();
}
BaseType_t started = xTimerStart(appData.local_timer, 0);
//Ensure the timer started successfully. If not, do not continue and turn
// on LED
if(started == pdFAIL)
{
stopEverything();
}
//Setup AD Driver
SYS_INT_SourceEnable(INT_SOURCE_ADC_1);
DRV_ADC_Initialize();
DRV_ADC_Open();
DRV_ADC_ChannelScanInputsAdd(ADC_INPUT_SCAN_AN0 | ADC_INPUT_SCAN_AN1|ADC_INPUT_SCAN_AN2);
PLIB_ADC_MuxAInputScanEnable(ADC_ID_1);
DRV_ADC_Start();
/* Initialization is done, allow the state machine to continue */
appData.state = APP_STATE_OUTPUT;
}
示例9: timers_init
/**@brief Function for the Timer initialization.
*
* @details Initializes the timer module. This creates and starts application timers.
*/
static void timers_init(void)
{
// Initialize timer module.
APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);
// Create timers.
m_battery_timer = xTimerCreate("BATT", BATTERY_LEVEL_MEAS_INTERVAL , pdTRUE, NULL, battery_level_meas_timeout_handler );
m_heart_rate_timer = xTimerCreate("HRT" , HEART_RATE_MEAS_INTERVAL , pdTRUE, NULL, heart_rate_meas_timeout_handler );
m_rr_interval_timer = xTimerCreate("RRT" , RR_INTERVAL_INTERVAL , pdTRUE, NULL, rr_interval_timeout_handler );
m_sensor_contact_timer = xTimerCreate("SCT" , SENSOR_CONTACT_DETECTED_INTERVAL, pdTRUE, NULL, sensor_contact_detected_timeout_handler);
/* Error checking */
if( (NULL == m_battery_timer)
|| (NULL == m_heart_rate_timer)
|| (NULL == m_rr_interval_timer)
|| (NULL == m_sensor_contact_timer) )
{
APP_ERROR_HANDLER(NRF_ERROR_NO_MEM);
}
}
示例10: createTimer
void ICACHE_FLASH_ATTR createTimer(char * ssid, char * pwd){
sprintf(ssid_name, "%s\0", ssid);
sprintf(password,"%s\0",pwd);
xTimerHandle wifiTimer=xTimerCreate("r",200,pdFALSE, (void *)1,vTimerSCallback);
if( xTimerStart( wifiTimer,0) == pdPASS ) {
printf("timer STATION babe!!!!! \n");
}
}
示例11: timer_initiaize_20
void timer_initiaize_20(int ms){
TimerHandle_t myTimer2;
myTimer2 = xTimerCreate("test2",
(ms/portTICK_PERIOD_MS),
pdTRUE,
(void *)0,
timerCallback_20);
if (xTimerStart(myTimer2,10) == pdFAIL)
error('a');
}
示例12: main
/**
* @brief Main program
* @param None
* @retval None
*/
int main() {
TimerHandle_t idTim1;
idTim1=xTimerCreate("Timer1", 1000/portTICK_RATE_MS, pdTRUE, 0, led1_callback);
xTimerStart(idTim1, 0);
xTaskCreate(led2_thread, "Thread1", 1024, (void*) NULL, tskIDLE_PRIORITY + 1UL, NULL);
vTaskStartScheduler();
for(;;);
}
示例13: queueMonitorInit
void queueMonitorInit() {
ASSERT(!initialized);
timer = xTimerCreate( "queueMonitorTimer", TIMER_PERIOD,
pdTRUE, NULL, timerHandler );
xTimerStart(timer, 100);
data[0].fileName = "Na";
data[0].queueName = "Na";
initialized = true;
}
示例14: prvInitialise_uIP
static void prvInitialise_uIP( void )
{
uip_ipaddr_t xIPAddr;
xTimerHandle xARPTimer, xPeriodicTimer;
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( uipEVENT_QUEUE_LENGTH, sizeof( unsigned long ) );
/* Create and start the uIP timers. */
xARPTimer = xTimerCreate( ( signed char * ) "ARPTimer", /* Just a name that is helpful for debugging, not used by the kernel. */
( 10000UL / portTICK_RATE_MS ), /* Timer period. */
pdTRUE, /* Autor-reload. */
( void * ) uipARP_TIMER,
prvUIPTimerCallback
);
xPeriodicTimer = xTimerCreate( ( signed char * ) "PeriodicTimer",
( 500UL / portTICK_RATE_MS ),
pdTRUE, /* Autor-reload. */
( void * ) uipPERIODIC_TIMER,
prvUIPTimerCallback
);
/* Sanity check that the timers were indeed created. */
configASSERT( xARPTimer );
configASSERT( xPeriodicTimer );
configASSERT( xEMACEventQueue );
/* These commands will block indefinitely until they succeed, so there is
no point in checking their return values. */
xTimerStart( xARPTimer, portMAX_DELAY );
xTimerStart( xPeriodicTimer, portMAX_DELAY );
}
示例15: ad_rf_init
void ad_rf_init(void)
{
if (dg_configRF_RECALIBRATION_TIMER_TIMEOUT > 0) {
/* Initialize timer */
recalib_timer = xTimerCreate("RFRecalibTimer",
dg_configRF_RECALIBRATION_TIMER_TIMEOUT,
pdFALSE,
NULL,
recalib_timer_cb);
OS_ASSERT(recalib_timer != NULL);
}
}