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


C++ TimerInit函数代码示例

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


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

示例1: main

int main(void)
{
	char incoming;
	OT_init();
	EthernetInit();
	UART0_Init(9600);

	TimerInit(0, 1000);
	TimerInit(3, 120000000);
	//delayMs(0,1000);
	//enable_timer(3);

	while(1)
	{
		EthernetHandle();

		//UARTHandle();
		if(UART0_Available())
		{
			UARTLED_ON;
			incoming = UART0_Getchar();
			gw_char(incoming);
			UARTLED_OFF;
		}
	}
}
开发者ID:rhekkers,项目名称:Opentherm_Gateway,代码行数:26,代码来源:main.c

示例2: InitDevice

uint8 InitDevice()//TODO:异常处理
{
	uint8 r=0,t=0;
	//GPIO
	PinInit();
	IO0DIR=1<<29|1<<30;//P0.29,P0.30必须同为输出才能输出(SSP0的片选).
	//GpioSpeedHigh();//全局高速模式,因为P0.29问题无法使用。

	//指示系统启动
	LED1ON();

	//UART0-GCS
	r+=UARTInit(FCUARTPORT,FCUARTBPS);//UART0-PC
	UARTSendChar(FCUARTPORT,0x40);
	UARTSendChar(FCUARTPORT,0x40);

	//UART2-INS
	r+=UARTInit(INSUARTPORT,INSUARTBPS);
	//UARTSendChar(2,0x40);
	//UARTSendChar(2,0x40);

	//SSP0-FPGA
	r+=SSP0FPGAMode();
	//r+=SPIInit();
	//while(1)
	//{
	t=FPGACheck();
	//}
	if(t==TRUE)
	{
		FCEventSend(OKFPGA);
	}
	else
	{
		FCEventSend(ErrFPGA);
	}
	r+=t;

	//SSP1-FLASH
	r+=FlashInit(FlashQueueSize);

	//Timer0-MainLoop
	r+=TimerInit(0,1000/MainLoopHz);
	TimerDisable(0);
	//TimerEnable(0);

	//Timer1-Time+LED1
	r+=TimerInit(1,1000);
	TimerEnable(1);
	
	//Timer2-Working-LED2
	r+=TimerInit(2,100);
	TimerDisable(2);

	//启动中断
	IRQEnable();
	
	return r;
}
开发者ID:sexroute,项目名称:vfly-fc,代码行数:59,代码来源:Init.c

示例3: MQTTClientInit

bool MQTTClientInit(MQTTClient *c, Network *network, unsigned int command_timeout_ms,
                    unsigned char *sendbuf, size_t sendbuf_size, unsigned char *readbuf, size_t readbuf_size)
{
    int i;
    c->ipstack = network;

    for (i = 0; i < MAX_MESSAGE_HANDLERS; ++i) {
        c->messageHandlers[i].topicFilter = 0;
    }

    if (command_timeout_ms != 0) {
        c->command_timeout_ms = command_timeout_ms;
    } else {
        c->command_timeout_ms = CONFIG_MQTT_SEND_CYCLE;
    }

    if (sendbuf) {
        c->buf = sendbuf;
        c->buf_size = sendbuf_size;
    } else {
        c->buf = (unsigned char *)malloc(CONFIG_MQTT_SEND_BUFFER);

        if (c->buf) {
            c->buf_size = CONFIG_MQTT_SEND_BUFFER;
        } else {
            return false;
        }
    }

    if (readbuf) {
        c->readbuf = readbuf;
        c->readbuf_size = readbuf_size;
    } else {
        c->readbuf = (unsigned char *)malloc(CONFIG_MQTT_RECV_BUFFER);

        if (c->readbuf) {
            c->readbuf_size = CONFIG_MQTT_RECV_BUFFER;
        } else {
            return false;
        }
    }

    c->isconnected = 0;
    c->cleansession = 0;
    c->ping_outstanding = 0;
    c->defaultMessageHandler = NULL;
    c->next_packetid = 1;
    TimerInit(&c->last_sent);
    TimerInit(&c->last_received);
    TimerInit(&c->ping_wait);
#if defined(MQTT_TASK)
    MutexInit(&c->mutex);
#endif
    return true;
}
开发者ID:espressif,项目名称:ESP8266_RTOS_SDK,代码行数:55,代码来源:MQTTClient.c

示例4: SwitchInit

// @brief : To initialise port pin for user switch input.
// @param : none
// @retval
void SwitchInit() {
	EXTI_InitTypeDef EXTI_InitStruct;
	NVIC_InitTypeDef NVIC_InitStruct;

	// USER_SW_PORT is defined as PA14
	GPIO_Init_Mode(USER_SW_PORT, USER_SW_PIN, GPIO_Mode_IN_FLOATING);

	EXTI_InitStruct.EXTI_Line = EXTI_Line14;
	EXTI_InitStruct.EXTI_Mode = EXTI_Mode_Interrupt;
	EXTI_InitStruct.EXTI_Trigger = EXTI_Trigger_Rising_Falling;
	EXTI_InitStruct.EXTI_LineCmd = ENABLE;
	EXTI_Init(&EXTI_InitStruct);

	NVIC_InitStruct.NVIC_IRQChannel = EXTI15_10_IRQn;
	NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority = SWITCH_PRIORITY;
	NVIC_InitStruct.NVIC_IRQChannelSubPriority = 0;
	NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE;
	NVIC_Init(&NVIC_InitStruct);

	bSWFlag = FALSE;
	SWstate = SW_LOW;
	SW_PRESS_TIME = 0;

	TimerInit(TIM_SWITCH);
}
开发者ID:gowgos5,项目名称:myproj,代码行数:28,代码来源:libSwitch.c

示例5: MQTTUnsubscribe

int MQTTUnsubscribe(MQTTClient* c, const char* topicFilter)
{
	int rc = FAILURE;
	Timer timer;
	MQTTString topic = MQTTString_initializer;
	topic.cstring = (char *)topicFilter;
	int len = 0;

#if defined(MQTT_TASK)
	FreeRTOS_MutexLock(&c->mutex);
#endif
	if (!c->isconnected)
		goto exit;

	TimerInit(&timer);
	TimerCountdownMS(&timer, c->command_timeout_ms);

	if ((len = MQTTSerialize_unsubscribe(c->buf, c->buf_size, 0, getNextPacketId(c), 1, &topic)) <= 0)
		goto exit;
	if ((rc = sendPacket(c, len, &timer)) != SUCCESS) // send the subscribe packet
		goto exit; // there was a problem

	if (waitfor(c, UNSUBACK, &timer) == UNSUBACK) {
		unsigned short mypacketid;  // should be the same as the packetid above
		if (MQTTDeserialize_unsuback(&mypacketid, c->readbuf, c->readbuf_size) == 1)
			rc = 0;
	} else
		rc = FAILURE;

exit:
#if defined(MQTT_TASK)
	FreeRTOS_MutexUnlock(&c->mutex);
#endif
	return rc;
}
开发者ID:huihongmei,项目名称:mylinks-m0m1-open-sdk,代码行数:35,代码来源:MQTTClient.c

示例6: smeMain_Init

/******************************************************************************
*
* Name: smeMain_Init
*
* Description:
*   This routine is called to initialize the the SME Task and related
*   components.
*
* Conditions For Use:
*   None.
*
* Arguments:
*   None.
*
* Return Value:
*   Status indicating success or failure
*
* Notes:
*   None.
*
* PDL:
*   Call smeQ_Init()
*   If the queue was successfully initialized Then
*      Create the SME Task by calling os_TaskCreate()
*      If creating the SME Task succeeded Then
*         Return OS_SUCCESS
*      End If
*   End If
*
*   Return OS_FAIL
* END PDL
*
*****************************************************************************/
extern WL_STATUS smeMain_Init( vmacApInfo_t *vmacSta_p )
{
	//	WL_STATUS status;

#ifdef IEEE80211H
	{
		UINT8 ChannelList[IEEE_80211_MAX_NUMBER_OF_CHANNELS]; /* the assumption of NULL-terminated is made */

		memset(ChannelList, 0, IEEE_80211_MAX_NUMBER_OF_CHANNELS);

		/* get regulatory maximum tx power */   
		domainGetInfo(ChannelList);

		/* init channel utilization information database */
		semChannelUtilizationInit(ChannelList);
	}

	TimerInit(&vmacSta_p->reqMeasurementTimer);
#endif /* IEEE80211H */
#ifdef AP_MAC_LINUX
#ifdef IEEE80211H_NOTWIFI
	/* Start MREQUEST periodic timer (10 mins interval) */
	TimerFireEvery(&vmacSta_p->reqMeasurementTimer, 1, &StartSendMREQUESTCmd, vmacSta_p, 50);
#endif /* IEEE80211H */
#endif
	//    SendStartCmd();
	return(OS_SUCCESS);
}
开发者ID:kmihelich,项目名称:wlan-smileplug,代码行数:61,代码来源:smeMain.c

示例7: PapStart

void
PapStart(Link l, int which)
{
	PapInfo pap = &l->lcp.auth.pap;

	switch (which) {
	case AUTH_PEER_TO_SELF:	/* Just wait for peer's request */
		break;

	case AUTH_SELF_TO_PEER:

		/* Initialize retry counter and timer */
		pap->next_id = 1;
		pap->retry = AUTH_RETRIES;

		TimerInit(&pap->timer, "PapTimer",
		    l->conf.retry_timeout * SECONDS, PapTimeout, l);
		TimerStart(&pap->timer);

		/* Send first request */
		PapSendRequest(l);
		break;

	default:
		assert(0);
	}
}
开发者ID:vstakhov,项目名称:mpd,代码行数:27,代码来源:pap.c

示例8: TimerQInitialize

/******************************************************************************
 *
 *   @name        TimerQInitialize
 *
 *   @brief       Initializes RTC, Timer Object Queue and System Clock Counter
 *
 *	 @param       controller_ID    : Controller ID
 *
 *   @return      None
 *****************************************************************************
 * This function initializes System Clock Counter, Timer Queue and Initializes
 * System Timer
 *****************************************************************************/
uint_8 
TimerQInitialize(uint_8 controller_ID)
{
    UNUSED (controller_ID)
	(void)memset(g_TimerObjectArray, (int)NULL, sizeof(g_TimerObjectArray));
	return TimerInit();
}
开发者ID:richardsongqc,项目名称:COEN6711-SmartHouse,代码行数:20,代码来源:tpm.c

示例9: MulticastInitialize

FSTATUS
MulticastInitialize(void)
{
	FSTATUS Status;
	
	_DBG_ENTER_LVL(_DBG_LVL_FUNC_TRACE, InitializeMulticast);

	McSdHandle = NULL;

	QListInit(&MasterMcGroupList);
	QListInit(&MasterMcClientList);
	SpinLockInitState(&MulticastLock);
	SpinLockInit(&MulticastLock);
	
	TimerInitState(&MaintenanceTimer);
	TimerInit(&MaintenanceTimer, McMaintenance, NULL);
	
	MaintenanceTimerActivated = FALSE;
	
	Status = iba_sd_register(&McSdHandle, NULL);
	if (Status != FSUCCESS)
	{
		McSdHandle = NULL;
		_DBG_ERROR(("Multicast Module Not Able To Register With Subnet Driver "
		            "Status = %d.\n", Status));
	}
	
	_DBG_LEAVE_LVL( _DBG_LVL_FUNC_TRACE );
	
	return Status;
}
开发者ID:01org,项目名称:opa-ff,代码行数:31,代码来源:multicast.c

示例10: main

//主程序
int main()
{
    INT8U remember;
 	DISABLE_INTERRUPTS;            //禁止总中断
 	//1. 芯片初始化
 	MCUInit();
    //2. 模块初始化
	SCIInit();                     //(1) 串口初始化
 	TimerInit();                   //(2) 定时器1初始化
    //3. 内存初始化
    //(1) "时分秒"缓存初始化(00:00:00)
	time[0] = 0;
	time[1] = 0;
	time[2] = 0;
	//(2) 临时变量remember初始化
    remember = time[2];
    //(3) 全局变量TimInterCount初始化
 	TimInterCount = 0;
 	//4. 开放各模块中断
    EnableSCIReInt;                //(1) 开放SCI0接收中断
    EnableT1OVInt;                 //(2) 开放定时器1溢出中断
    //5. 开放总中断
	ENABLE_INTERRUPTS;             //开总中断
	while (1)
	{
        if (time[2] != remember)
        {
            SCISendN(3, time);     //发送当前"时分秒"
            remember = time[2];    //remember中存放当前秒值
        }
    }
}
开发者ID:jerryfree,项目名称:DG128C,代码行数:33,代码来源:main.c

示例11: MQTTRun

void MQTTRun(void *parm)
{
    Timer timer;
    MQTTClient *c = (MQTTClient *)parm;

    TimerInit(&timer);

    while (1) {
        TimerCountdownMS(&timer, CONFIG_MQTT_RECV_CYCLE); /* Don't wait too long if no traffic is incoming */

#if CONFIG_MQTT_RECV_CYCLE == 0     /* The smaller cycle, the greater throughput */
        esp_task_wdt_reset();
#endif

#if defined(MQTT_TASK)
        MutexLock(&c->mutex);
#endif

        int rc = cycle(c, &timer);

        if (rc == FAILURE) {
            ESP_LOGE(TAG, "MQTTRun cycle failed");
#if defined(MQTT_TASK)
            MutexUnlock(&c->mutex);
#endif
            vTaskDelete(NULL);
        }

#if defined(MQTT_TASK)
        MutexUnlock(&c->mutex);
#endif
    }
}
开发者ID:espressif,项目名称:ESP8266_RTOS_SDK,代码行数:33,代码来源:MQTTClient.c

示例12: RCC_APB2PeriphClockCmd

	void F4Timer::set_period(uint32_t period)
	{
		if(TIM1==TIMx)
			RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1,ENABLE);
		if(TIM2==TIMx)
			RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2,ENABLE);
		if(TIM3==TIMx)
			RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3,ENABLE);
		if(TIM4==TIMx)
			RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM4,ENABLE);
		if(TIM5==TIMx)
			RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM5,ENABLE);
		if(TIM6==TIMx)
			RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM6,ENABLE);
		TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
		TIM_DeInit(TIMx);
		TIM_InternalClockConfig(TIMx);
		TIM_TimeBaseStructure.TIM_Prescaler=167;//1Mhz 1us 65536
		TIM_TimeBaseStructure.TIM_ClockDivision=TIM_CKD_DIV1;
		TIM_TimeBaseStructure.TIM_CounterMode=TIM_CounterMode_Up;
		TIM_TimeBaseStructure.TIM_Period=period;
		TIM_TimeBaseStructure.TIM_RepetitionCounter = 0x0;
		TIM_TimeBaseInit(TIMx,&TIM_TimeBaseStructure);
		TIM_ClearFlag(TIMx,TIM_FLAG_Update);
		TIM_ARRPreloadConfig(TIMx,DISABLE);
		TIM_ITConfig(TIMx,TIM_IT_Update,ENABLE);
		TIM_Cmd(TIMx,ENABLE);
		TimerInit(this->TIMx);
	}
开发者ID:dreamkeep,项目名称:Acantha,代码行数:29,代码来源:F4Timer.cpp

示例13: Zqsort

void _CRTAPI1  Zqsort (void * Arg1, size_t Arg2, size_t Arg3,
	int (_CRTAPI1 * Arg4)(const void *, const void *))
{

    SHORT sTimerHandle;
    ULONG ulElapsedTime;

    if (fInitDone == FALSE) {
        ApfInitDll();
    }
    TimerOpen(&sTimerHandle, MICROSECONDS);
    TimerInit(sTimerHandle);
    //
    // Call the api
    //
    qsort(Arg1,Arg2,Arg3,Arg4);
    //
    // Get the elapsed time
    //
    ulElapsedTime = TimerRead(sTimerHandle);
    ApfRecordInfo(I_qsort, ulElapsedTime);
    TimerClose(sTimerHandle);

    return;
}
开发者ID:mingpen,项目名称:OpenNT,代码行数:25,代码来源:zvarargs.c

示例14: test2_click_to_measure_btnclicked

void test2_click_to_measure_btnclicked(GtkWidget *widget, gpointer user_data)
{
	
	long int Delay = 0xFFFFFFFF;
	start_timer = 1;
	wait_for_5sec = 1;

		GtkWidget *feed_back;
	feed_back = GTK_WIDGET (gtk_builder_get_object (Test2Builder, "label9"));
	gtk_label_set_label (feed_back, "Please hold the handles");
	
	/*
	while(BLITestEn==1){
		while(Delay>0){
			Delay--;
		}
		GetBliOutput();
		Delay = 0xFFFFFFFF;
	}
	*/
	BLITestEn=1;
	test2_button_set_state(FALSE);
	Minutes = 0;
	Seconds = 0;

	test_timeout = BODYFAT_TIMEOUT;
	StartTimer = 1;
	TimerInit();
	return;
}
开发者ID:wellth,项目名称:Demo-03,代码行数:30,代码来源:body_fat.c

示例15: Z_execl

int _CRTAPI1  Z_execl (const char* Arg1,const char* Arg2, DWORD64ARGS)
{

    int RetVal;

    SHORT sTimerHandle;
    ULONG ulElapsedTime;

    if (fInitDone == FALSE) {
        ApfInitDll();
    }
    TimerOpen(&sTimerHandle, MICROSECONDS);
    TimerInit(sTimerHandle);
    //
    // Call the api
    //
    RetVal = _execl(Arg1,Arg2, ARGS64);
    //
    // Get the elapsed time
    //
    ulElapsedTime = TimerRead(sTimerHandle);
    ApfRecordInfo(I__execl, ulElapsedTime - ApfData[I_CALIBRATE].ulFirstTime);
    TimerClose(sTimerHandle);

    return(RetVal);
}
开发者ID:mingpen,项目名称:OpenNT,代码行数:26,代码来源:zvarargs.c


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