• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ InitTimer函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: main

int main( int argc, char **argv )
{
  int     algo, arg, verbose;
  char    *filename;

  /* Check arguments */
  if( (argc < 3) || (argc > 4) )
  {
    Help( argv[ 0 ] );
    return 0;
  }
  arg = 1;

  /* Check for options */
  verbose = 0;
  if( strcmp( argv[arg], "-v" ) == 0 )
  {
    verbose = 1;
    ++ arg;
  }

  /* Get algo */
  algo = 0;
  if( strcmp( argv[arg], "rle" ) == 0 )     algo = 1;
  if( strcmp( argv[arg], "huff" ) == 0 )    algo = 2;
  if( strcmp( argv[arg], "rice8" ) == 0 )   algo = 3;
  if( strcmp( argv[arg], "rice16" ) == 0 )  algo = 4;
  if( strcmp( argv[arg], "rice32" ) == 0 )  algo = 5;
  if( strcmp( argv[arg], "rice8s" ) == 0 )  algo = 6;
  if( strcmp( argv[arg], "rice16s" ) == 0 ) algo = 7;
  if( strcmp( argv[arg], "rice32s" ) == 0 ) algo = 8;
  if( strcmp( argv[arg], "lz" ) == 0 )      algo = 9;
  if( strcmp( argv[arg], "lz_f" ) == 0 )    algo = 10;
  if( strcmp( argv[arg], "sf" ) == 0 )      algo = 11;
  if( !algo )
  {
    Help( argv[ 0 ] );
    return 0;
  }
  ++ arg;

  /* Get file name */
  filename = argv[arg];

  /* Initialize timer */
  InitTimer();

  /* Test file */
  TestFile( filename, algo, verbose );

  return 0;
}
开发者ID:Grumbel,项目名称:rfactortools,代码行数:52,代码来源:bcltest.c


示例2: InitTimer

/**
 * @function DeleteWorld
 * @brief 
 * @date 2011-10-13
 */
void GRIPFrame::DeleteWorld() {

    InitTimer("",0);

    timeVector.clear();

    if(mWorld) {
        delete mWorld;
        mWorld = 0;
        selectedTreeNode = 0;
        treeView->DeleteAllItems();
    }
}
开发者ID:Sosi,项目名称:grip,代码行数:18,代码来源:GRIPFrame.cpp


示例3: main

int main()
{
	InitTimer();
	InitComm();

	PrintLn("hello, world!");

	InitOLED();
	
	TestOLED();

	return 0;
}
开发者ID:pixeldis,项目名称:oled,代码行数:13,代码来源:main.cpp


示例4: main

int main(void) //main body calls all other functions to initialize the proper values of the Transmission protocol, timer and ADC module, then starts them
{
	InitialzeLCD(); //initializes LCD
	SetADCChannel(5); // sets ADC channel for temperature sensor 
	InitADC(); // Initializes ADC and timer below to 1 second 
	InitTimer();
	startTimer();
	startADC();
	while(1)
	{
		// Main loop
	}
}
开发者ID:hotyboty59,项目名称:cpe301-mookherjee,代码行数:13,代码来源:DA7.c


示例5: main

void main(void) {

    (void)puts("\r\nIn test harness for timer.c \r\n");
    InitTimer();
    EnableInterrupts;

    StartTimer(1, 2000);
    while(1) {
        if(IsTimerExpired(1)) {
            (void)printf("Egg is Cooked!\r\n");
        }
    }
}
开发者ID:SPDLDaemon,项目名称:spdldaemon.github.io,代码行数:13,代码来源:timer.c


示例6: subscribeToShadowActionAcks

IoT_Error_t subscribeToShadowActionAcks(const char *pThingName, ShadowActions_t action, bool isSticky) {
	IoT_Error_t ret_val = NONE_ERROR;
	MQTTSubscribeParams subParams = MQTTSubscribeParamsDefault;

	bool clearBothEntriesFromList = true;
	int16_t indexAcceptedSubList = 0;
	int16_t indexRejectedSubList = 0;
	indexAcceptedSubList = getNextFreeIndexOfSubscriptionList();
	indexRejectedSubList = getNextFreeIndexOfSubscriptionList();

	if (indexAcceptedSubList >= 0 && indexRejectedSubList >= 0) {
		topicNameFromThingAndAction(SubscriptionList[indexAcceptedSubList].Topic, pThingName, action, SHADOW_ACCEPTED);
		subParams.mHandler = AckStatusCallback;
		subParams.qos = QOS_0;
		subParams.pTopic = SubscriptionList[indexAcceptedSubList].Topic;
		ret_val = pMqttClient->subscribe(&subParams);
		if (ret_val == NONE_ERROR) {
			SubscriptionList[indexAcceptedSubList].count = 1;
			SubscriptionList[indexAcceptedSubList].isSticky = isSticky;
			topicNameFromThingAndAction(SubscriptionList[indexRejectedSubList].Topic, pThingName, action,
					SHADOW_REJECTED);
			subParams.pTopic = SubscriptionList[indexRejectedSubList].Topic;
			ret_val = pMqttClient->subscribe(&subParams);
			if (ret_val == NONE_ERROR) {
				SubscriptionList[indexRejectedSubList].count = 1;
				SubscriptionList[indexRejectedSubList].isSticky = isSticky;
				clearBothEntriesFromList = false;

				// wait for SUBSCRIBE_SETTLING_TIME seconds to let the subscription take effect
				Timer subSettlingtimer;
				InitTimer(&subSettlingtimer);
				countdown(&subSettlingtimer, SUBSCRIBE_SETTLING_TIME);
				while(!expired(&subSettlingtimer));

			}
		}
	}

	if (clearBothEntriesFromList) {
		if (indexAcceptedSubList >= 0) {
			SubscriptionList[indexAcceptedSubList].isFree = true;
		} else if (indexRejectedSubList >= 0) {
			SubscriptionList[indexRejectedSubList].isFree = true;
		}
		if (SubscriptionList[indexAcceptedSubList].count == 1) {
			ret_val = pMqttClient->unsubscribe(SubscriptionList[indexAcceptedSubList].Topic);
		}
	}

	return ret_val;
}
开发者ID:chrisfraser,项目名称:aws-iot-device-sdk-embedded-C,代码行数:51,代码来源:aws_iot_shadow_records.c


示例7: MQTTPublish

int MQTTPublish(Client* c, const char* topicName, MQTTMessage* message)
{
    int rc = FAILURE;
    Timer timer;   
    MQTTString topic = MQTTString_initializer;
    topic.cstring = (char *)topicName;
    int len = 0;

    InitTimer(&timer);
    countdown_ms(&timer, c->command_timeout_ms);
    
    if (!c->isconnected)
        goto exit;

    if (message->qos == QOS1 || message->qos == QOS2)
        message->id = getNextPacketId(c);
    len = MQTTSerialize_publish(c->buf, c->buf_size, 0, message->qos, message->retained, message->id, 
              topic, (unsigned char*)message->payload, message->payloadlen);
    if (len <= 0)
        goto exit;
    if ((rc = sendPacket(c, len, &timer)) != SUCCESS) // send the subscribe packet
        goto exit; // there was a problem
    if (message->qos == QOS1)
    {
        if (waitfor(c, PUBACK, &timer) == PUBACK)
        {
            unsigned short mypacketid;
            unsigned char dup, type;
            if (MQTTDeserialize_ack(&type, &dup, &mypacketid, c->readbuf, c->readbuf_size) != 1)
                rc = FAILURE;
        }
        else
            rc = FAILURE;
    }
    else if (message->qos == QOS2)
    {
        if (waitfor(c, PUBCOMP, &timer) == PUBCOMP)
        {
            unsigned short mypacketid;
            unsigned char dup, type;
            if (MQTTDeserialize_ack(&type, &dup, &mypacketid, c->readbuf, c->readbuf_size) != 1)
                rc = FAILURE;
        }
        else
            rc = FAILURE;
    }
    
exit:
    return rc;
}
开发者ID:ngocphu811,项目名称:RasPi-mqtt-c,代码行数:50,代码来源:MQTTClient.c


示例8: TclServiceIdle

int
TclServiceIdle(void)
{
    IdleHandler *idlePtr;
    int oldGeneration;
    Tcl_Time blockTime;
    ThreadSpecificData *tsdPtr = InitTimer();

    if (tsdPtr->idleList == NULL) {
	return 0;
    }

    oldGeneration = tsdPtr->idleGeneration;
    tsdPtr->idleGeneration++;

    /*
     * The code below is trickier than it may look, for the following reasons:
     *
     * 1. New handlers can get added to the list while the current one is
     *	  being processed. If new ones get added, we don't want to process
     *	  them during this pass through the list (want to check for other work
     *	  to do first). This is implemented using the generation number in the
     *	  handler: new handlers will have a different generation than any of
     *	  the ones currently on the list.
     * 2. The handler can call Tcl_DoOneEvent, so we have to remove the
     *	  handler from the list before calling it. Otherwise an infinite loop
     *	  could result.
     * 3. Tcl_CancelIdleCall can be called to remove an element from the list
     *	  while a handler is executing, so the list could change structure
     *	  during the call.
     */

    for (idlePtr = tsdPtr->idleList;
	    ((idlePtr != NULL)
		    && ((oldGeneration - idlePtr->generation) >= 0));
	    idlePtr = tsdPtr->idleList) {
	tsdPtr->idleList = idlePtr->nextPtr;
	if (tsdPtr->idleList == NULL) {
	    tsdPtr->lastIdlePtr = NULL;
	}
	idlePtr->proc(idlePtr->clientData);
	ckfree(idlePtr);
    }
    if (tsdPtr->idleList) {
	blockTime.sec = 0;
	blockTime.usec = 0;
	Tcl_SetMaxBlockTime(&blockTime);
    }
    return 1;
}
开发者ID:smh377,项目名称:tcl,代码行数:50,代码来源:tclTimer.c


示例9: IR_Init

/*******************************************************************************
 * PUBLIC FUNCTIONS                                                           *
 ******************************************************************************/
char IR_Init() {
    //dbprintf("\nInitializing the IR Sensor Module.");

    #ifdef USE_LEDS
    LED_Init(LED_BANK3 |LED_BANK1);
    LED_OffBank(LED_BANK3, 0xF);
    LED_OffBank(LED_BANK1, 0xF);

    #endif

    InitTimer(TIMER_IR, UPDATE_DELAY);

    return SUCCESS;
}
开发者ID:dagoodma,项目名称:24_hour_bot_2013,代码行数:17,代码来源:IR.c


示例10: InitTimer

int64_t ArchHooks::GetMicrosecondsSinceStart( bool bAccurate )
{
	if( !g_bTimerInitialized )
		InitTimer();

	int64_t ret = timeGetTime() * int64_t(1000);
	if( bAccurate )
	{
		ret = FixupTimeIfLooped( ret );
		ret = FixupTimeIfBackwards( ret );
	}
	
	return ret;
}
开发者ID:Pisces000221,项目名称:stepmania,代码行数:14,代码来源:ArchHooks_Win32Static.cpp


示例11: MQTTConnect

int  MQTTConnect (Client *c, MQTTPacket_connectData *options)
{
    Timer     connect_timer;
    int       rc = FAILURE;
    int       len = 0;
    MQTTPacket_connectData  default_options = MQTTPacket_connectData_initializer;

    InitTimer (&connect_timer);
    countdown_ms (&connect_timer, c->command_timeout_ms);

    if (c->isconnected) // don't send connect packet again if we are already connected
        goto exit;

    if (options == 0)
       options = &default_options;  // set default options if none were supplied

    c->keepAliveInterval = options->keepAliveInterval;
    countdown (&c->ping_timer, c->keepAliveInterval);

       //--------------------------------------------------------------------
       // Generate a MQTT "Connect" packet, and send it to the remote Broker
       //--------------------------------------------------------------------
    len = MQTTSerialize_connect (c->buf, c->buf_size, options);
    if (len <= 0)
        goto exit;                              // supplied buffer is too small
    rc = sendPacket (c, len, &connect_timer);   // send the connect packet
    if (rc != SUCCESS)
        goto exit;                              // there was a problem

       //--------------------------------------------------------------------
       // Wait for and read in the MQTT "ConnAck" reply packet.
       //--------------------------------------------------------------------
        // this will be a blocking call, wait for the connack
    if (waitfor(c, CONNACK, &connect_timer) == CONNACK)
      {
        unsigned char connack_rc     = 255;
        char          sessionPresent = 0;
        if (MQTTDeserialize_connack((unsigned char*) &sessionPresent, &connack_rc,
                                    c->readbuf, c->readbuf_size) == 1)
            rc = connack_rc;
            else rc = FAILURE;
      }
     else rc = FAILURE;

exit:
    if (rc == SUCCESS)
       c->isconnected = 1;
    return rc;
}
开发者ID:GrandviewIoT,项目名称:Industrial_IoT_Projects,代码行数:49,代码来源:MQTTClient.c


示例12: MQTTSubscribe

int  MQTTSubscribe (Client *c, const char *topicFilter,  enum QoS qos,
                    messageHandler messageHandler)
{
    int         i;
    int         rc = FAILURE;
    Timer       timer;
    int         len = 0;
    MQTTString  topic = MQTTString_initializer;

    topic.cstring = (char*) topicFilter;

    InitTimer (&timer);
    countdown_ms (&timer, c->command_timeout_ms);   // default is 1 second timeouts

    if ( ! c->isconnected)
        goto exit;

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

    if (waitfor(c, SUBACK, &timer) == SUBACK)          // wait for suback
      {
        int count = 0, grantedQoS = -1;
        unsigned short mypacketid;
        if (MQTTDeserialize_suback(&mypacketid, 1, &count, &grantedQoS, c->readbuf, c->readbuf_size) == 1)
           rc = grantedQoS;       // will be 0, 1, 2 or 0x80
        if (rc != 0x80)
          {
            for (i = 0; i < MAX_MESSAGE_HANDLERS; ++i)
              {
                if (c->messageHandlers[i].topicFilter == 0)
                  {
                    c->messageHandlers[i].topicFilter = topicFilter;
                    c->messageHandlers[i].fp = messageHandler;
                    rc = 0;    // denote success
                    break;
                  }
              }
          }
      }
     else rc = FAILURE;        // timed out - no SUBACK received

exit:
    return rc;
}
开发者ID:GrandviewIoT,项目名称:Industrial_IoT_Projects,代码行数:49,代码来源:MQTTClient.c


示例13: main

void main( void )
{  
  // Stop watchdog timer to prevent time out reset 
  WDTCTL = WDTPW + WDTHOLD; 
    
  // Increase PMMCOREV level to 2 for proper radio operation
  SetVCore(2);                               
  
  ResetRadioCore();
  InitButtonLeds();
  InitTimer(); 
    
  // Clean out the RX Buffer 
  rxPosition = PACKET_LEN+2;
  while(rxPosition--)
  {
    RxBuffer[rxPosition] = 0; 
  }

  InitRadio();  
  ReceiveOn(); 
    
  while (1)
  { 
    P1IE |= BIT7;                           // Enable button interrupt
    
    __bis_SR_register( LPM3_bits + GIE );   
    __no_operation(); 
    
    if (buttonPressed)                      // Process a button press->transmit 
    {            
      ReceiveOff();                         // Button means TX, stop RX
      receiving = 0;                         
      
      TransmitPacket();                 

      buttonPressed = 0;                    // Re-enable button press                           
    }    
    if(receiving)
    {
      ReceivePacket(); 
      __no_operation(); 
    }
    if(!transmitting)
    {
      ReceiveOn(); 
    }
  }
}
开发者ID:GDXN,项目名称:Level,代码行数:49,代码来源:RF_Toggle_LED_Demo.c


示例14: main

void main(void) {
  (void)printf("Start of E128 program\r\n");
  InitPorts();
  InitTimer();
  InitMotors();
  InitSide();
  InitBeacons();
  EnableInterrupts;

  StartMasterSM();

  while(1) {		   		     // Repeat State Machine Forever
    (void)RunMasterSM(CheckEvents());
  }
}
开发者ID:SPDLDaemon,项目名称:spdldaemon.github.io,代码行数:15,代码来源:main.c


示例15: MQTTDisconnect

int MQTTDisconnect(Client* c)
{  
    int rc = FAILURE;
    Timer timer;     // we might wait for incomplete incoming publishes to complete
    int len = MQTTSerialize_disconnect(c->buf, c->buf_size);

    InitTimer(&timer);
    countdown_ms(&timer, c->command_timeout_ms);

    if (len > 0)
        rc = sendPacket(c, len, &timer);            // send the disconnect packet
        
    c->isconnected = 0;
    return rc;
}
开发者ID:ngocphu811,项目名称:RasPi-mqtt-c,代码行数:15,代码来源:MQTTClient.c


示例16: main

/**
 * main program
 */
void main(void)
{
    EnableInterrupts;       // Interrupts aktivieren

    PTFDD = LED;

    InitTimer();

    for(;;)
    {
        __RESET_WATCHDOG();  /* feeds the dog */
    }

  /* please make sure that you never leave main */
}
开发者ID:daniw,项目名称:mc,代码行数:18,代码来源:main.c


示例17: main

int main(void)
{
    int     i;

    InitTimer();
    InitUART();

    LED_DDR |= LED_MASK;

    // The first handle opened for read goes to stdin, and the first handle
    // opened for write goes to stdout.

    fdevopen( UART0_PutCharStdio, UART0_GetCharStdio );

    printf( "*****\n" );
    printf( "***** Uart Test program\n" );
    printf( "*****\n" );

    while( 1 )
    {
        LED_PORT ^= LED_MASK;

        printf( "." );

        // Tick rate is 100/sec so waiting for 100 waits for 1 sec

        for ( i = 0; i < 100; i++ ) 
        {
            WaitForTimer0Rollover();

            if ( UART0_IsCharAvailable() )
            {
                char    ch = getchar();

                printf( "Read: '%c'\n", ch );

                if ( ch == ' ' )
                {
                    printf( "*** Press a key to continue\n" );
                    ch = getchar();
                    printf( "*** Continuing...\n" );
                }
            }
        }
    }

    return 0;
}
开发者ID:JonHylands,项目名称:projects,代码行数:48,代码来源:uart-test.c


示例18: keepalive

int keepalive(Client* c)
{
	int rc = FAILURE;

	if (c->keepAliveInterval == 0)
	{
		return SUCCESS;
	}

	if (expired(&c->ping_timer))
	{
		if (!c->ping_outstanding)
		{
			// there is not a ping outstanding - send one
			Timer timer;
			InitTimer(&timer); 
			countdown_ms(&timer, 2000); //STM: modified the value from 1000 to 2000
			int len = MQTTSerialize_pingreq(c->buf, c->buf_size);
			INFO("-->keepalive");
			rc = sendPacket(c, len, &timer); // send the ping packet
			DeInitTimer(&timer); //STM: added this line
			if (len > 0 && rc == SUCCESS)
			{
				c->ping_outstanding = 1;
				// start a timer to wait for PINGRESP from server
				countdown(&c->ping_timer, c->keepAliveInterval / 2);
			}
			else
			{
				rc = FAILURE;
			}
		}
		else
		{
			// timer expired while waiting for a ping - decide we are disconnected
			MQTTDisconnect(c);
			if (c->disconnectHandler != NULL) {
				c->disconnectHandler();
			}
		}
	}
	else
	{
		rc = SUCCESS;
	}

	return rc;
}
开发者ID:Klika-Tech,项目名称:nucleo-aws-iot-demo,代码行数:48,代码来源:MQTTClient.c


示例19: Flash

static void Flash()
{
#if 0               // FIXME
    FILE *animf;
    TEvent e;

    VVF_DrawFrame = DrawFlash;
    animf = GetAnimFile("flash");
    do {GetEvent(&e);} while (e.What != evNothing);
    DoneTimer();
    PlayVVF(animf);
    InitTimer();
    do {GetEvent(&e);} while (e.What != evNothing);
    fclose(animf);
#endif
}
开发者ID:danvac,项目名称:signus,代码行数:16,代码来源:mainmenu.cpp


示例20: MQTTConnect

int MQTTConnect(Client* c, MQTTPacket_connectData* options)
{
    Timer connect_timer;
    int rc = FAILURE;
    MQTTPacket_connectData default_options = MQTTPacket_connectData_initializer;
    int len = 0;
	
    InitTimer(&connect_timer); 
    countdown_ms(&connect_timer, c->command_timeout_ms);

    if (c->isconnected) // don't send connect packet again if we are already connected
        goto exit;

    if (options == 0)
        options = &default_options; // set default options if none were supplied
    
    c->keepAliveInterval = options->keepAliveInterval;
    countdown(&c->ping_timer, c->keepAliveInterval);
		
    if ((len = MQTTSerialize_connect(c->buf, c->buf_size, options)) <= 0)
        goto exit;
		
		
		
		
    if ((rc = sendPacket(c, len, &connect_timer)) != SUCCESS)  // send the connect packet
        goto exit; // there was a problem
    
    // this will be a blocking call, wait for the connack
    if (waitfor(c, CONNACK, &connect_timer) == CONNACK)
    {
        unsigned char connack_rc = 255;
        char sessionPresent = 0;
        if (MQTTDeserialize_connack((unsigned char*)&sessionPresent, &connack_rc, c->readbuf, c->readbuf_size) == 1)
            rc = connack_rc;
        else
            rc = FAILURE;
    }
    else
        rc = FAILURE;
    
exit:
    if (rc == SUCCESS)
        c->isconnected = 1;
    DeInitTimer(&connect_timer); //STM: added this line of code
		return rc;
}
开发者ID:Klika-Tech,项目名称:nucleo-aws-iot-demo,代码行数:47,代码来源:MQTTClient.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ InitTimers函数代码示例发布时间:2022-05-30
下一篇:
C++ InitSysCtrl函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap