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

C++ APP_TIMER_TICKS函数代码示例

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

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



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

示例1: blesi7021_write_handler

/**@brief Function for handling write events to the si7021 characteristic.
 *
 * @param[in] p_si7021  Instance of si7021 Service to which the write applies.
 * @param[in] led_state Written/desired state of the LED.
 */
static void blesi7021_write_handler(ble_si7021_t * p_si7021, ble_si7021_evt_t *evt) {
    uint32_t err_code;

    if (evt->evt_type == BLE_si7021_EVT_NOTIFICATION_ENABLED) {
    	NRF_LOG_INFO("BLE_si7021_EVT_NOTIFICATION_ENABLED\r\n");
        err_code = app_timer_start(m_si7021_timer_id, APP_TIMER_TICKS(p_si7021->interval, APP_TIMER_PRESCALER), NULL);
        APP_ERROR_CHECK(err_code);
        p_si7021->running=1;
    } else if (evt->evt_type == BLE_si7021_EVT_INTERVAL_CHANGE) {
    	NRF_LOG_INFO("BLE_si7021_EVT_INTERVAL_CHANGE %d\r\n",p_si7021->interval);
    	if (p_si7021->running==1) {
            err_code = app_timer_stop(m_si7021_timer_id);
            APP_ERROR_CHECK(err_code);
            p_si7021->running=0;

            err_code = app_timer_start(m_si7021_timer_id, APP_TIMER_TICKS(p_si7021->interval, APP_TIMER_PRESCALER), NULL);
            APP_ERROR_CHECK(err_code);
            p_si7021->running=1;
    	}
    } else { // BLE_si7021_EVT_NOTIFICATION_DISABLED | BLE_si7021_EVT_DISCONNECTED
    	NRF_LOG_INFO("BLE_si7021_EVT_NOTIFICATION_DISABLED\r\n");
        err_code = app_timer_stop(m_si7021_timer_id);
        APP_ERROR_CHECK(err_code);
        p_si7021->running=0;
    }
}
开发者ID:pcbreflux,项目名称:nordic,代码行数:31,代码来源:main.c


示例2: utils_setup

/**
 * @brief Function for setup all thinks not directly associated witch ANT stack/protocol.
 * @desc Initialization of: @n
 *         - app_tarce for debug.
 *         - app_timer, presetup for bsp and ant pulse simulation.
 *         - bsp for signaling leds and user buttons (if use button is enabled in example).
 *         - ant pulse simulate for task of filling hrm profile data.
 */
static void utils_setup(void)
{
    uint32_t err_code;

    app_trace_init();

    // Initialize and start a single continuous mode timer, which is used to update the event time
    // on the main data page.
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, NULL);

    #if (MODIFICATION_TYPE == MODIFICATION_TYPE_BUTTON)
    /** @snippet [ANT Pulse simulator button init] */
    err_code = bsp_init(BSP_INIT_LED | BSP_INIT_BUTTONS,
                        APP_TIMER_TICKS(100, APP_TIMER_PRESCALER),
                        bsp_evt_handler);
    /** @snippet [ANT Pulse simulator button init] */
    #else
    err_code = bsp_init(BSP_INIT_LED, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER), NULL);
    APP_ERROR_CHECK(err_code);
    #endif

    err_code = app_timer_create(&m_tick_timer,
                                APP_TIMER_MODE_REPEATED,
                                app_tick_handler);
    APP_ERROR_CHECK(err_code);

    // Schedule a timeout event every 2 seconds
    err_code = app_timer_start(m_tick_timer, APP_TICK_EVENT_INTERVAL, NULL);
    APP_ERROR_CHECK(err_code);
}
开发者ID:kevin-ledinh,项目名称:banana-tree,代码行数:38,代码来源:main.c


示例3: btle_gap_init

error_t btle_gap_init(void)
{
    ble_gap_conn_params_t gap_conn_params = {0};

    gap_conn_params.min_conn_interval = msec_to_1_25msec(
                                            CFG_GAP_CONNECTION_MIN_INTERVAL_MS);  // in 1.25ms units
    gap_conn_params.max_conn_interval = msec_to_1_25msec(
                                            CFG_GAP_CONNECTION_MAX_INTERVAL_MS);  // in 1.25ms unit
    gap_conn_params.slave_latency     = CFG_GAP_CONNECTION_SLAVE_LATENCY;
    gap_conn_params.conn_sup_timeout  =
        CFG_GAP_CONNECTION_SUPERVISION_TIMEOUT_MS / 10; // in 10ms unit

    ble_gap_conn_sec_mode_t sec_mode;
    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode); // no security is needed

    // ASSERT_STATUS( sd_ble_gap_device_name_set(&sec_mode,   //_modify
                   // (const uint8_t *)
                   // CFG_GAP_LOCAL_NAME,
                   // strlen(CFG_GAP_LOCAL_NAME)));
    // ASSERT_STATUS( sd_ble_gap_appearance_set(CFG_GAP_APPEARANCE));
    // ASSERT_STATUS( sd_ble_gap_ppcp_set(&gap_conn_params));
    // ASSERT_STATUS( sd_ble_gap_tx_power_set(CFG_BLE_TX_POWER_LEVEL));
    nrf_err_check( sd_ble_gap_device_name_set(&sec_mode,  
                   (const uint8_t *)
                   CFG_GAP_LOCAL_NAME,
                   strlen(CFG_GAP_LOCAL_NAME)) );
    nrf_err_check( sd_ble_gap_appearance_set(CFG_GAP_APPEARANCE) );
    nrf_err_check( sd_ble_gap_ppcp_set(&gap_conn_params) );
    nrf_err_check( sd_ble_gap_tx_power_set(CFG_BLE_TX_POWER_LEVEL) );
    
    /* Connection Parameters */
    enum {
        FIRST_UPDATE_DELAY = APP_TIMER_TICKS(5000, CFG_TIMER_PRESCALER),
        NEXT_UPDATE_DELAY  = APP_TIMER_TICKS(5000, CFG_TIMER_PRESCALER),
        MAX_UPDATE_COUNT   = 3
    };

    ble_conn_params_init_t cp_init = {0};

    cp_init.p_conn_params                  = NULL;
    cp_init.first_conn_params_update_delay = FIRST_UPDATE_DELAY;
    cp_init.next_conn_params_update_delay  = NEXT_UPDATE_DELAY;
    cp_init.max_conn_params_update_count   = MAX_UPDATE_COUNT;
    cp_init.start_on_notify_cccd_handle    = BLE_GATT_HANDLE_INVALID;
    cp_init.disconnect_on_fail             = true;
    cp_init.evt_handler                    = NULL;
    cp_init.error_handler                  = error_callback;

    //ASSERT_STATUS ( ble_conn_params_init(&cp_init));   //_modify
    nrf_err_check( ble_conn_params_init(&cp_init) );
    
    return ERROR_NONE;
}
开发者ID:A-L-E-X,项目名称:nRF51822-Arduino,代码行数:53,代码来源:btle_gap.cpp


示例4: twi_light_sampling

static void twi_light_sampling(void * p_context){
	UNUSED_PARAMETER(p_context);	
	static bool startup = true;
	static bool set_pin = true;
	uint32_t err_code;
	if(do_measurements){
		if(set_pin){
			set_pin = false;
			//TURN ON THE TRANSISTOR AND WAIT FOR IT TO STABILIZE
			nrf_gpio_pin_set(TSL2561_BASE_PIN);
			err_code = app_timer_start(iss_struct.meas_timer, APP_TIMER_TICKS(50, APP_TIMER_PRESCALER), NULL);
			APP_ERROR_CHECK(err_code);
		}else{
			uint8_t twi_data_tx[2] = {0,0};
			uint8_t twi_data_rx[2] = {0,0};
			uint8_t light_twi_command = TSL2561_COMMAND_BIT | TSL2561_CLEAR_BIT | TSL2561_WORD_BIT;
			if(startup){
				// POWER ON and wait 450 ms
				startup = false;
				twi_data_tx[0] = light_twi_command | TSL2561_REGISTER_CONTROL;
				twi_data_tx[1] = TSL2561_CONTROL_POWERON;
				err_code = !twi_master_write(light_sens_adr, twi_data_tx, 2,&my_twi_config);
				APP_ERROR_CHECK(err_code);
				err_code = app_timer_start(iss_struct.meas_timer, APP_TIMER_TICKS(450, APP_TIMER_PRESCALER), NULL);
				APP_ERROR_CHECK(err_code);
			}else{
				uint16_t ch0,ch1 = 0;
				twi_data_tx[0] = light_twi_command | TSL2561_REGISTER_CHAN0_LOW;	
				err_code = !twi_master_write_read(light_sens_adr, twi_data_tx, 1, twi_data_rx, 2,&my_twi_config);
				APP_ERROR_CHECK(err_code);
				ch0 = twi_data_rx[0];
				ch0 = ch0 | (((uint16_t)(twi_data_rx[1]))<<8);
				
				twi_data_tx[0] = light_twi_command | TSL2561_REGISTER_CHAN1_LOW;
				err_code = !twi_master_write_read(light_sens_adr, twi_data_tx, 1, twi_data_rx, 2,&my_twi_config);
				APP_ERROR_CHECK(err_code);
				ch1 = twi_data_rx[0];
				ch1 = ch1 | (((uint16_t)(twi_data_rx[1]))<<8);
				
				nrf_gpio_pin_clear(TSL2561_BASE_PIN);

				int32_t lux = calc_lux(ch0,ch1);
				err_code = update_iss_measurement(&iss_struct, &lux);
				APP_ERROR_CHECK(err_code);
				startup = true;
				set_pin = true;
				err_code = app_timer_start(iss_struct.meas_timer, APP_TIMER_TICKS(iss_struct.samp_freq_in_m_sec, APP_TIMER_PRESCALER), &iss_struct);
				APP_ERROR_CHECK(err_code);
			}	
		}		
	}
}
开发者ID:EnergyFutures,项目名称:ITU_BLE_Measurement_Service,代码行数:52,代码来源:light_sensor_TSL2561.c


示例5: main

/**@brief Function for application main entry.
 */
int main(void)
{
    uint32_t err_code;
    // Initialize.
    app_trace_init();
    ble_stack_init();
    device_manager_init();
    timers_init();
    APP_GPIOTE_INIT(APP_GPIOTE_MAX_USERS);
    err_code = bsp_init(BSP_INIT_LED | BSP_INIT_BUTTONS,
                        APP_TIMER_TICKS(100, APP_TIMER_PRESCALER),
                        NULL);
    APP_ERROR_CHECK(err_code);
    gap_params_init();
    advertising_init();
    services_init();
    sensor_simulator_init();
    conn_params_init();

    // Start execution.
    application_timers_start();
    advertising_start();

    // Enter main loop.
    for (;; )
    {
        power_manage();
    }
}
开发者ID:tkadom,项目名称:TWBLE,代码行数:31,代码来源:main.c


示例6: main

/**
 * @brief Function for application main entry.
 * @return 0. int return type required by ANSI/ISO standard.
 */
int main(void)
{
    uint32_t err_code = NRF_SUCCESS;

    clock_initialization();
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, NULL);

    err_code = NRF_LOG_INIT(NULL);
    APP_ERROR_CHECK(err_code);
    err_code = bsp_init(BSP_INIT_LED, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER), NULL);
    APP_ERROR_CHECK(err_code);

    // Set radio configuration parameters
    radio_configure();
    NRF_RADIO->PACKETPTR = (uint32_t)&packet;

    err_code = bsp_indication_set(BSP_INDICATE_USER_STATE_OFF);
    NRF_LOG_INFO("Wait for first packet\r\n");
    APP_ERROR_CHECK(err_code);
    NRF_LOG_FLUSH();    

    while (true)
    {
        uint32_t received = read_packet();

        err_code = bsp_indication_set(BSP_INDICATE_RCV_OK);
        NRF_LOG_INFO("Packet was received\r\n");
        APP_ERROR_CHECK(err_code);

        NRF_LOG_INFO("The contents of the package is %u\r\n", (unsigned int)received);
        NRF_LOG_FLUSH();
    }
}
开发者ID:Goodjamp,项目名称:ble_app_template,代码行数:37,代码来源:main.c


示例7: main

int main(void)
{
    uint32_t err_code;
    // Initialize.
    timers_init();
    err_code = bsp_init(BSP_INIT_LED, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER), NULL);
    APP_ERROR_CHECK(err_code);

    uart_init();
    ble_stack_init();

    twi_master_init();

    err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);
    nrf_delay_ms(200);
    bsp_indication_set(BSP_INDICATE_IDLE);
    nrf_delay_ms(200);
    err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);

    update_sensor(0);
    start_advertising();
    timers_start();

    // Enter main loop.
    for (;; )
    {
        power_manage();
    }
}
开发者ID:ix-wetterstation,项目名称:sensor,代码行数:29,代码来源:main.c


示例8: advertising_timer_init

void advertising_timer_init(void){

  app_timer_create(&advertising_timer, APP_TIMER_MODE_REPEATED, &radio_notification_evt_handler);
  //Starts the timer, sets it up for repeated start.
  app_timer_start(advertising_timer, APP_TIMER_TICKS(300, APP_TIMER_PRESCALER), NULL);

}
开发者ID:jtguggedal,项目名称:Physical_Web_Toy_SDK_11,代码行数:7,代码来源:main.c


示例9: utils_setup

/**@brief Function for the timer, tracer, and BSP initialization.
 */
static void utils_setup(bool * p_erase_bonds)
{
		uint32_t err_code;
		bsp_event_t startup_event;

    app_trace_init();
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);

		//bsp init ant
		err_code = bsp_init(BSP_INIT_LED, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER), NULL);
	//FROM BLE uint32_t err_code = bsp_init(BSP_INIT_LED | BSP_INIT_BUTTONS,APP_TIMER_TICKS(100, APP_TIMER_PRESCALER),bsp_event_handler);

    APP_ERROR_CHECK(err_code);
	
	  // Create timers for BLE
    err_code = app_timer_create(&m_battery_timer_id,
                                APP_TIMER_MODE_REPEATED,
                                battery_level_meas_timeout_handler);
    APP_ERROR_CHECK(err_code);

    // Create battery timer.
    err_code = app_timer_create(&m_rsc_meas_timer_id,
                                APP_TIMER_MODE_REPEATED,
                                rsc_meas_timeout_handler);
    APP_ERROR_CHECK(err_code);
		
		  err_code = bsp_btn_ble_init(NULL, &startup_event);
    APP_ERROR_CHECK(err_code);

    *p_erase_bonds = (startup_event == BSP_EVENT_CLEAR_BONDING_DATA);
		
}
开发者ID:pavarinna,项目名称:AntBleCommunication,代码行数:34,代码来源:main.c


示例10: sensor_timer_start

static void sensor_timer_start(uint16_t offset)
{
		uint32_t err_code;
		err_code = app_timer_start(iss_struct_h.meas_timer, APP_TIMER_TICKS(offset ? offset : iss_struct_h.samp_freq_in_m_sec, APP_TIMER_PRESCALER), NULL);
		APP_ERROR_CHECK(err_code);
		iss_struct_h.timer_running = true;
}
开发者ID:EnergyFutures,项目名称:ITU_BLE_Measurement_Service,代码行数:7,代码来源:HT_sensor_SI7021.c


示例11: main

/**@brief Function for application main entry.
 */
int main(void)
{
    uint32_t err_code = NRF_SUCCESS;

    // Initialize.
    ble_stack_init();
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, NULL);

    err_code = bsp_init(BSP_INIT_LED | BSP_INIT_BUTTONS,
                        APP_TIMER_TICKS(APP_BUTTON_DETECTION_DELAY, APP_TIMER_PRESCALER),
                        bsp_event_handler);
    APP_ERROR_CHECK(err_code);

    // Initialize advertising.
    advertising_init();

    // Start execution.
    advertising_start();

    // Enter main loop.
    for (;;)
    {
        err_code = sd_app_evt_wait();
        APP_ERROR_CHECK(err_code);
    }
}
开发者ID:kevin-ledinh,项目名称:banana-tree,代码行数:28,代码来源:main.c


示例12: main

/**
 * @brief Function for application main entry.
 */
int main(void)
{
    uint32_t err_code;
    // Initialize.
    err_code = NRF_LOG_INIT(NULL);
    APP_ERROR_CHECK(err_code);

    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);
    err_code = bsp_init(BSP_INIT_LED, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER), NULL);
    APP_ERROR_CHECK(err_code);
    ble_stack_init();
    advertising_init();

    // Start execution.
    NRF_LOG_INFO("BLE Beacon started\r\n");
    advertising_start();

    // Enter main loop.
    for (;; )
    {
        if (NRF_LOG_PROCESS() == false)
        {
            power_manage();
        }
    }
}
开发者ID:AaltoNEPPI,项目名称:nRF52_dev,代码行数:29,代码来源:main.c


示例13: main

int main(void)
{
    uint32_t err_code;
    
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, NULL);
    err_code = bsp_init(BSP_INIT_LED | BSP_INIT_BUTTONS, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER),NULL);
    APP_ERROR_CHECK(err_code);
    leds_init();
    timers_init();
    uart_init();
   
    ble_stack_init();
    device_manager_init();
    db_discovery_init();
    uart_c_init();
    
    printf("Scanning ...\r\n");
	
    // Start scanning for peripherals and initiate connection
    // with devices that advertise NUS UUID.
    scan_start();

    for (;;)
    {
        power_manage();
    }
}
开发者ID:NordicSemiconductor,项目名称:ble_app_uart_c_S120,代码行数:27,代码来源:main.c


示例14: main

/**@brief Function for application main entry.
 */
int main(void)
{
    uint32_t err_code;
    // Initialize.
    ble_stack_init();
    timers_init();
    APP_GPIOTE_INIT(1);
    err_code = bsp_init(BSP_INIT_LED | BSP_INIT_BUTTONS, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER), NULL);
    APP_ERROR_CHECK(err_code);
    device_manager_init();
    gap_params_init();
    advertising_init();
    services_init();
    sensor_simulator_init();
    conn_params_init();

    ble_evt_pool      = osPoolCreate(osPool(ble_evt_pool));
    ble_stack_msg_box = osMessageCreate(osMessageQ(ble_stack_msg_box), NULL);

    // Start execution.
    ble_stack_thread_id = osThreadCreate(osThread(ble_stack_thread), NULL);
    UNUSED_VARIABLE(ble_stack_thread_id);
    application_timers_start();
    advertising_start();

    // Enter main loop.
    for (;; )
    {
        UNUSED_VARIABLE(osDelay(1000));
    }
}
开发者ID:dhruvkakadiya,项目名称:OpenSJ_Bluz,代码行数:33,代码来源:main.c


示例15: app_nfc_callback

/**@brief Function for handling NFC events.
 * Schedulers call to handler.
 */
void app_nfc_callback(void* p_context, nfc_t2t_event_t event, const uint8_t* p_data, size_t data_length)
{
  NRF_LOG_INFO("NFC\r\n");
  switch (event)
  {
    case NFC_T2T_EVENT_FIELD_ON:
      // NFC activation causes tag to hang sometimes. Fix this by reseting tag after a delay on NFC read.
      NRF_LOG_INFO("NFC Field detected \r\n");
      app_timer_start(reset_timer_id, APP_TIMER_TICKS(NFC_RESET_DELAY, RUUVITAG_APP_TIMER_PRESCALER), NULL);
      break;

    case NFC_T2T_EVENT_FIELD_OFF:
      NRF_LOG_INFO("NFC Field lost \r\n");
      app_sched_event_put (NULL, 0, reinit_nfc);
      if(APP_GATT_PROFILE_ENABLED)
      {
        app_sched_event_put (NULL, 0, become_connectable);
      }
      break;

    case NFC_T2T_EVENT_DATA_READ:
      NRF_LOG_INFO("Data read\r\n");
      break;
    
    default:
      break;
  }
}
开发者ID:ruuvi,项目名称:ruuvitag_fw,代码行数:31,代码来源:main.c


示例16: timers_start

/**@brief Function for starting timers.
*/
static void timers_start(void)
{
    uint32_t err;
    
	err= app_timer_start(tmrOneSecondID, APP_TIMER_TICKS(1000, 0), NULL);
	APP_ERROR_CHECK(err);
}
开发者ID:451506709,项目名称:automated_machine,代码行数:9,代码来源:ble_support.c


示例17: main

/**@brief Function for application main entry.
 */
int main(void)
{
    uint32_t err_code;

    // Initialize.
    ble_stack_init();
    timers_init();

    err_code = bsp_init(BSP_INIT_LED, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER), NULL);
    APP_ERROR_CHECK(err_code);

    device_manager_init();
    gap_params_init();
    advertising_init();
    services_init();
    sensor_simulator_init();
    conn_params_init();
    
    beacon_scanner_init.evt_handler   = beacon_evt_handler;
    beacon_scanner_init.error_handler = beacon_scanner_error_handler;
    app_beacon_scanner_init(&beacon_scanner_init);
    app_beacon_scanner_start();

    // Start execution.
    application_timers_start();
    advertising_start();

    // Enter main loop.
    for (;;)
    {
        power_manage();
    }
}
开发者ID:dhruvkakadiya,项目名称:OpenSJ_Bluz,代码行数:35,代码来源:main.c


示例18: iot_timer_init

/**@brief Function for initializing the IoT Timer. */
static void iot_timer_init(void)
{
    uint32_t err_code;

    static const iot_timer_client_t list_of_clients[] =
    {
        {blink_timeout_handler,   LED_BLINK_INTERVAL_MS},
        {app_coap_time_tick,      COAP_TICK_INTERVAL_MS},
#ifdef COMMISSIONING_ENABLED
        {commissioning_time_tick, SEC_TO_MILLISEC(COMMISSIONING_TICK_INTERVAL_SEC)}
#endif // COMMISSIONING_ENABLED
    };

    // The list of IoT Timer clients is declared as a constant.
    static const iot_timer_clients_list_t iot_timer_clients =
    {
        (sizeof(list_of_clients) / sizeof(iot_timer_client_t)),
        &(list_of_clients[0]),
    };

    // Passing the list of clients to the IoT Timer module.
    err_code = iot_timer_client_list_set(&iot_timer_clients);
    APP_ERROR_CHECK(err_code);

    // Starting the app timer instance that is the tick source for the IoT Timer.
    err_code = app_timer_start(m_iot_timer_tick_src_id, \
                               APP_TIMER_TICKS(IOT_TIMER_RESOLUTION_IN_MS, APP_TIMER_PRESCALER), \
                               NULL);
    APP_ERROR_CHECK(err_code);
}
开发者ID:NordicSemiconductor,项目名称:arduino-primo-iot-examples,代码行数:31,代码来源:main.c


示例19: lock_control_handler

static void lock_control_handler(ble_doorlock_t * p_doorlock, uint8_t state) 
{ 
    uint32_t             err_code;
    if (state) 
    { 
        // Open door
        LEDS_ON((BSP_LED_3_MASK));
        // Start timer
        if (m_lock_timer_id != 0xFFFFFFFF) {
            err_code = app_timer_stop(m_lock_timer_id);
            APP_ERROR_CHECK(err_code);
        } else {
            err_code = app_timer_create(&m_lock_timer_id, 
                                        APP_TIMER_MODE_SINGLE_SHOT, 
                                        lock_timeout_handler); 
            APP_ERROR_CHECK(err_code); 
        }
        err_code = app_timer_start(m_lock_timer_id, APP_TIMER_TICKS(APP_CFG_CHAR_LOCK_TIMEOUT, APP_TIMER_PRESCALER), NULL);
        APP_ERROR_CHECK(err_code);
    } 
    else 
    { 
        // Lock door
        LEDS_OFF((BSP_LED_3_MASK));
    } 
} 
开发者ID:albert361,项目名称:nRF51_Beacon_Peripheral_DualRole,代码行数:26,代码来源:ble_srv_doorlock.c


示例20: main

/**
 * @brief Function for application main entry.
 */
int main(void)
{
    uint32_t err_code;

    clock_init();

    // Start APP_TIMER to generate timeouts.
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, NULL);

    leds_init();

    err_code = bsp_init(BSP_INIT_BUTTONS,
                        APP_TIMER_TICKS(100, APP_TIMER_PRESCALER),
                        bsp_evt_handler);
    APP_ERROR_CHECK(err_code);

    nfc_init();

    m_active_led_mask = BSP_LED_0_MASK;
    err_code = led_softblink_start(m_active_led_mask);
    APP_ERROR_CHECK(err_code);

    while (true)
    {
        __WFE();
        softblink_led_update();
    }
}
开发者ID:lyncxy119,项目名称:Sentry,代码行数:31,代码来源:main.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ APP_UART_FIFO_INIT函数代码示例发布时间:2022-05-30
下一篇:
C++ APP_TIMER_INIT函数代码示例发布时间: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