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

C++ Ticker类代码示例

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

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



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

示例1: main

int main(void)
{
    led1 = 1;
    Ticker ticker;
    ticker.attach(periodicCallback, 1); // blink LED every second

    BLE& ble = BLE::Instance(BLE::DEFAULT_INSTANCE);
    ble.init(bleInitComplete);

    // Instantiate security manager now so that it doesn't need to be done from an ISR later.
    nRF5xn::Instance(BLE::DEFAULT_INSTANCE).getSecurityManager();

    /* SpinWait for initialization to complete. This is necessary because the
     * BLE object is used in the main loop below. */
    while (ble.hasInitialized()  == false) { /* spin loop */ }

    // infinite loop
    while (1) {
        // check for trigger from periodicCallback()
        if (triggerSensorPolling && ble.getGapState().connected) {
            triggerSensorPolling = false;

            // Do blocking calls or whatever is necessary for sensor polling.
            // In our case, we simply update the HRM measurement.
            hrmCounter++;
            if (hrmCounter == 175) { //  100 <= HRM bps <=175
                hrmCounter = 100;
            }

            hrService->updateHeartRate(hrmCounter);
        } else {
            ble.waitForEvent(); // low power wait for event
        }
    }
}
开发者ID:evark,项目名称:gcc4mbed,代码行数:35,代码来源:main.cpp


示例2: app_start

void app_start(int, char**) {

	// setup the EthernetInterface
	eth.init();	// DHCP
	eth.connect();
	
	// initialize the ipv4 tcp/ip stack
	lwipv4_socket_init();

	// setup the M2MInterface
	srand(time(NULL));
	uint16_t port = rand() % 65535 + 12345;
	srv = M2MInterfaceFactory::create_interface(observer,endpoint,type,
		lifetime,port,domain,M2MInterface::UDP,M2MInterface::LwIP_IPv4,context_address);

	// setup the Security object		
	sec = M2MInterfaceFactory::create_security(M2MSecurity::M2MServer);
	sec->set_resource_value(M2MSecurity::M2MServerUri,address);
	sec->set_resource_value(M2MSecurity::SecurityMode, M2MSecurity::NoSecurity);

	// setup the Device object
	dev = M2MInterfaceFactory::create_device();
	dev->create_resource(M2MDevice::Manufacturer,"Freescale");
	dev->create_resource(M2MDevice::DeviceType,"frdm-k64f");
	dev->create_resource(M2MDevice::ModelNumber,"M64FN1MOVLL12");
	dev->create_resource(M2MDevice::SerialNumber,"EB1524XXXX");

	// setup the sensor objects
	obj = M2MInterfaceFactory::create_object("loc");
	M2MObjectInstance* ins = obj->create_object_instance();
	M2MResource* resx = ins->create_dynamic_resource("x","accel",M2MResourceInstance::INTEGER,true);
	resx->set_operation(M2MBase::GET_PUT_ALLOWED);
	resx->set_value((const uint8_t*)"0",1);
	M2MResource* resy = ins->create_dynamic_resource("y","accel",M2MResourceInstance::INTEGER,true);
	resy->set_operation(M2MBase::GET_PUT_ALLOWED);
	resy->set_value((const uint8_t*)"0",1);

	
	// Assemble the list of objects to register
	M2MObjectList list;
	list.push_back(dev);
	list.push_back(obj);

	// setup registration event
	Ticker timer;
	timer.attach(&reg,&Registrar::update,20);

	// enable accelerometer
	printf("Initializied accelerometer\r\n");
	accel.enable();
	Ticker sampler;
	sampler.attach(sample,5);

	// schedule 
	FunctionPointer1<void, M2MObjectList> fp(&reg, &Registrar::setup);
	minar::Scheduler::postCallback(fp.bind(list));
	minar::Scheduler::postCallback(sample).period(minar::milliseconds(10000));
	minar::Scheduler::start();
}
开发者ID:wotio,项目名称:mbedos-accel-frdm-k64f,代码行数:59,代码来源:app.cpp


示例3: main

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Ticker w;
    w.setText(QString(QObject::tr("***人的孤独********!")));
    w.show();

    return a.exec();
}
开发者ID:CarlosLei,项目名称:Ticker,代码行数:9,代码来源:main.cpp


示例4: main

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    Ticker ticker;
    ticker.setWindowTitle(QObject::tr("Ticker"));
    ticker.setText(QObject::tr("How long it lasted was impossible to "
                               "say ++ "));
    ticker.show();
    return app.exec();
}
开发者ID:vukhuyen,项目名称:Qt,代码行数:10,代码来源:main.cpp


示例5: equeue_tick_init

static void equeue_tick_init() {
    MBED_STATIC_ASSERT(sizeof(equeue_timer) >= sizeof(Timer),
            "The equeue_timer buffer must fit the class Timer");
    MBED_STATIC_ASSERT(sizeof(equeue_ticker) >= sizeof(Ticker),
            "The equeue_ticker buffer must fit the class Ticker");
    Timer *timer = new (equeue_timer) Timer;
    Ticker *ticker = new (equeue_ticker) Ticker;

    equeue_minutes = 0;
    timer->start();
    ticker->attach_us(equeue_tick_update, 1000 << 16);

    equeue_tick_inited = true;
}
开发者ID:NXPmicro,项目名称:mbed,代码行数:14,代码来源:equeue_mbed.cpp


示例6: main

int main (void) {
    Thread thread(queue_thread);

    Ticker ticker;
    ticker.attach(queue_isr, 1.0);

    while (true) {
        osEvent evt = queue.get();
        if (evt.status != osEventMessage) {
            printf("queue->get() returned %02x status\n\r", evt.status);
        } else {
            printf("queue->get() returned %d\n\r", evt.value.v);
        }
    }
}
开发者ID:1deus,项目名称:tmk_keyboard,代码行数:15,代码来源:main.cpp


示例7: main

int main()
{
    Ticker blinky;
    blinky.attach(blink, 0.4f);

    printf("NetworkSocketAPI Example\r\n");

    eth.connect();
    const char *ip = eth.get_ip_address();
    const char *mac = eth.get_mac_address();
    printf("IP address is: %s\r\n", ip ? ip : "No IP");
    printf("MAC address is: %s\r\n", mac ? mac : "No MAC");
    
    SocketAddress addr(&eth, "mbed.org");
    printf("mbed.org resolved to: %s\r\n", addr.get_ip_address());

    TCPSocket ipv4socket(&eth);
    ipv4socket.connect("4.ifcfg.me", 23);
    ipv4socket.set_blocking(false);
    ipv4socket.attach(network_callback);

    TCPSocket ipv6socket(&eth);
    ipv6socket.connect("6.ifcfg.me", 23);
    ipv6socket.set_blocking(false);
    ipv6socket.attach(network_callback);

    // Tries to get both an IPv4 and IPv6 address
    while (network_sem.wait(2500) > 0) {
        int count;
        char buffer[64];

        count = ipv4socket.recv(buffer, sizeof buffer);
        if (count >= 0) {
            printf("public IPv4 address is: %.15s\r\n", &buffer[15]);
        }

        count = ipv6socket.recv(buffer, sizeof buffer);
        if (count >= 0) {
            printf("public IPv6 address is: %.39s\r\n", &buffer[15]);
        }
    }
    
    ipv4socket.close();
    ipv6socket.close();
    eth.disconnect();

    printf("Done\r\n");
}
开发者ID:iriark01,项目名称:test_docs,代码行数:48,代码来源:HW_Non_Blocking.cpp


示例8: qCreateSinkForDebugFeedback

unsigned qCreateSinkForDebugFeedback(void* feedbackChannel)
{
	QAudioSinkForDebugFeedback *sink = new QAudioSinkForDebugFeedback(*((FeedbackChannel**)feedbackChannel));
	if (!sink) return 0;
	g_Ticker.addTickee(sink->ptr());
	return sink->key();
}
开发者ID:JupiterSmalltalk,项目名称:openqwaq,代码行数:7,代码来源:qAudioPluginGlue.cpp


示例9: main

int main(void)
{
    led1 = 1;
    Ticker ticker;
    ticker.attach(periodicCallback, 1); // blink LED every second

    ble.init();
    ble.gap().onDisconnection(disconnectionCallback);

    /* Setup primary service. */
    uint8_t hrmCounter = 100; // init HRM to 100bps
    HeartRateService hrService(ble, hrmCounter, HeartRateService::LOCATION_FINGER);

    /* Setup auxiliary service. */
    DeviceInformationService deviceInfo(ble, "ARM", "Model1", "SN1", "hw-rev1", "fw-rev1", "soft-rev1");

    /* Setup advertising. */
    ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE);
    ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS, (uint8_t *)uuid16_list, sizeof(uuid16_list));
    ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::GENERIC_HEART_RATE_SENSOR);
    ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME, (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME));
    ble.gap().setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);
    ble.gap().setAdvertisingInterval(1000); /* 1000ms */
    ble.gap().startAdvertising();

    // infinite loop
    while (1) {
        // check for trigger from periodicCallback()
        if (triggerSensorPolling && ble.getGapState().connected) {
            triggerSensorPolling = false;

            // Do blocking calls or whatever is necessary for sensor polling.
            // In our case, we simply update the HRM measurement.
            hrmCounter++;

            //  100 <= HRM bps <=175
            if (hrmCounter == 175) {
                hrmCounter = 100;
            }

            // update bps
            hrService.updateHeartRate(hrmCounter);
        } else {
            ble.waitForEvent(); // low power wait for event
        }
    }
}
开发者ID:ChristianRiesen,项目名称:Smoothie2,代码行数:47,代码来源:main.cpp


示例10: pppSurfing

void pppSurfing(void const*) {
    while (pppDialingSuccessFlag == 0) {
        Thread::wait(500);
    }
    NetLED_ticker.detach();
    NetLED_ticker.attach(&toggle_NetLed, 0.5);	//net is connect
    startRemoteUpdate();
}
开发者ID:HeydayGuan,项目名称:Nucleo_RemoteUpdate,代码行数:8,代码来源:main.cpp


示例11: main

int main() {
    led1 = 0;
    led2 = 0;
    flipper_1.attach(&flip_1, 1.0); // the address of the function to be attached (flip) and the interval (1 second)
    flipper_2.attach(&flip_2, 2.0); // the address of the function to be attached (flip) and the interval (2 seconds)

    while (true) {
        wait(1.0);
    }
}
开发者ID:Illuminux,项目名称:mbed,代码行数:10,代码来源:main.cpp


示例12: pushUp

void pushUp(){
    freq += FREQ_SIZE;
    if (freq >= MAX_FREQ) freq = MAX_FREQ;

    dx = 1.0/(DX_LEN * freq);
    controller.detach();
    controller.attach(&bldcval, dx);

    DBG("freq = %d\r\n", freq);
}
开发者ID:hirotakaster,项目名称:hallsensor-bldc,代码行数:10,代码来源:test.cpp


示例13: debounce_handler

void debounce_handler() {
    if (debounce.read_ms() >= 500) {
        debounce.reset();
        training_mode = !training_mode;
        if (training_mode) tcontrol.attach(checkTimers, 1);
        else tcontrol.detach();
        led4 = !led4;
        turnoffgreen();
        greenlightact();
    }
}
开发者ID:lukevin13,项目名称:ESE350,代码行数:11,代码来源:main.cpp


示例14: update

 inline void update(FT mFT) override
 {
     tlShoot.update(mFT);
     if(tckShoot.getCurrent() > shootDelay / 1.5f &&
         tckShoot.getCurrent() < shootDelay)
         game.createPCharge(1, cPhys.getPosPx(), 20);
     if(tckShoot.update(mFT))
     {
         tlShoot.reset();
         tlShoot.start();
     }
 }
开发者ID:SuperV1234,项目名称:SSVBloodshed,代码行数:12,代码来源:OBCTurret.hpp


示例15: report_sample

/*
for reporting a sample that satisfies the reporting criteria and resetting the state machine
*/
int report_sample(sample s)
{
    if(send_notification(s)){  // sends current_sample if observing is on
        last_band = band(s); // limits state machine
        high_step = s + LWM2M_step; // reset floating band upper limit defined by step
        low_step = s - LWM2M_step; // reset floating band lower limit defined by step
        pmin_timer.detach();
        pmin_exceeded = false; // state machine to inhibit reporting at intervals < pmin
        pmin_timer.attach(&on_pmin, LWM2M_pmin);
        pmax_timer.detach();
        pmax_timer.attach(&on_pmax, LWM2M_pmax);
        return 1;
    }
    else return 0;
}
开发者ID:connectIOT,项目名称:lwm2m-objects,代码行数:18,代码来源:LWM2M_resource.cpp


示例16: kickExternalWatchdog

void kickExternalWatchdog(void) {
	static bool locked = false;
	static bool wdog_state = false;
	static bool wdog_configured = false;
	if (!wdog_configured) {
		pinMode(WATCHDOG_WOUT_PIN, OUTPUT);
		kickAllSoftwareWatchdogs();
		SWWatchdog.attach_ms(300, softwareWatchdog); // Check for stuck tasks and kick external Watchdog
		// The external wdog trips after 1.6s, but the timing is sloppy for the ESP8266, need this as 300ms.
		wdog_configured = true;
		startedTime = millis();
		Serial.println(F("Software watchdog initialized."));
	}

	if (!locked) {
		locked = true;
		pinMode(WATCHDOG_WOUT_PIN, OUTPUT);
		if (wdog_state) {
			digitalWrite(WATCHDOG_WOUT_PIN, HIGH);
			wdog_state = false;
		}
		else {
			digitalWrite(WATCHDOG_WOUT_PIN, LOW);
			wdog_state = true;
		}
		locked = false;
	}
}
开发者ID:intrepidor,项目名称:esp8266-Sensor,代码行数:28,代码来源:wdog.cpp


示例17: main

int main() {
  pc.printf("\r\nHi! Built with keil\r\n");
  
  //leftChannelA.rise(&leftGotPulse);
  //rightChannelA.rise(&rightGotPulse);
  
  bool pressed = false;
  int motorState = 0;
  speed = 0.0f;
  
  ticker.attach(&printStatus, 0.5);
  
  while(1){
    if (user_button == 0 && !pressed){
        pressed = true;
        
        
        switch (motorState){
            case 0: speed = 0.0f; break;
            case 1: speed = 0.1f; break;
            case 2: speed = 0.5f; break;
            case 3: speed = 1.0f; break;
            case 4: speed = 0.0f; break;
            case 5: speed = -0.1f; break;
            case 6: speed = -0.5f; break;
            case 7: speed = -1.0f; motorState = -1; break;
        }
        motorState++;
        drive(speed);
    }
    else if (user_button == 1){
        pressed = false;
    }
  }
}
开发者ID:austinxiao-ucsd,项目名称:falcon,代码行数:35,代码来源:main.cpp


示例18: main

int main() {
    // Init the ticker with the address of the function (toggle_led) to be attached and the interval (100 ms)
    toggle_led_ticker.attach(&toggle_led, 0.1);
    while (true) {
        // Do other things...
    }
}
开发者ID:dotnfc,项目名称:arducleo,代码行数:7,代码来源:ticker_main.cpp


示例19: initializeSnake

void initializeSnake(LLRoot * master) {
    /* Start Snake at 3 in length
     * x, y, z:layer
     */ 
      
    //if(master != NULL)      // Uh oh, non-empty snake?
    //    freeListLL(master); // No matter
    
    initializeLL(master);
    __disable_irq();
    addToHeadLL(master, 0, 0, 0);
    __enable_irq();
    // BEAMMEUPSCOTTY
    myCube.plotPoint(0, 0, 0);
    master->direction = XPOS;
    //master->length = 1;
   
    generateFruit(master);
    
    // Note: What if fruit is generated on snake?
    // The user will not be able to see it until all snake nodes have gone
    // over it
    
    tick.attach(&setSnakeFlag, SPEED);
}
开发者ID:ahmedlogic,项目名称:LEDcube,代码行数:25,代码来源:main.cpp


示例20: OBCTurret

        OBCTurret(Entity& mE, OBCPhys& mCPhys, OBCDraw& mCDraw,
            OBCKillable& mCKillable, Dir8 mDir, const OBWpnType& mWpn,
            float mShootDelay, float mPJDelay, int mShootCount) noexcept
            : OBCActor{mE, mCPhys, mCDraw},
              cKillable(mCKillable),
              direction{mDir},
              wpn{game, OBGroup::GFriendlyKillable, mWpn},
              shootDelay{mShootDelay},
              pjDelay{mPJDelay},
              shootCount{mShootCount}
        {
            cDraw.setRotation(getDegFromDir8(direction));

            getEntity().addGroups(OBGroup::GEnemy, OBGroup::GEnemyKillable);
            body.setResolve(false);
            body.addGroups(OBGroup::GSolidGround, OBGroup::GSolidAir,
                OBGroup::GEnemy, OBGroup::GKillable, OBGroup::GEnemyKillable);

            tckShoot.restart(shootDelay);
            repeat(tlShoot,
                [this]
                {
                    shoot();
                },
                shootCount, pjDelay);

            cKillable.onDeath += [this]
            {
                game.createEShard(5, cPhys.getPosI());
            };
        }
开发者ID:SuperV1234,项目名称:SSVBloodshed,代码行数:31,代码来源:OBCTurret.hpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ Ticket类代码示例发布时间:2022-05-31
下一篇:
C++ TickMeter类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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