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


C++ sd_app_evt_wait函数代码示例

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


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

示例1: crypto_storeKeys

void crypto_storeKeys(void)
{
  uint32_t err_code;

  if (crypto_storing)
  {
    pstorage_handle_t handle;
    err_code = pstorage_block_identifier_get(&crypto_store_handle, 0, &handle);
    APP_ERROR_CHECK(err_code);

    crypto_persistent_keys_t keys = {};
    memcpy(keys.srp_b, srp.b, 32);
    memcpy(keys.srp_salt, srp.salt, 16);
    memcpy(keys.srp_v, srp.v, 384);
    memcpy(keys.srp_B, srp.B, 384);
    memcpy(keys.sign_secret, crypto_keys.sign.secret, 64);
    memcpy(keys.clientname, crypto_keys.client.name, 36);
    memcpy(keys.ltpk, crypto_keys.client.ltpk, 32);

    keys.instance = CRYPTO_INSTANCE;
    keys.valid0 = 0x55;
    keys.valid1 = 0xAA;
    err_code = pstorage_update(&handle, (uint8_t*)&keys, sizeof(keys), 0);
    APP_ERROR_CHECK(err_code);

    // Pump events until the store is done
    while (crypto_storing)
    {
      err_code = sd_app_evt_wait();
      APP_ERROR_CHECK(err_code);
      app_sched_execute();
    }
  }
}
开发者ID:engeneeringhall,项目名称:HomeKit,代码行数:34,代码来源:crypto.c

示例2: main

int main(void)
{
  /* Silence the compiler */
  (void) g_sd_assert_pc;
  (void) g_evt;

  uart_init();

  char start_msg[128];
  sprintf(&start_msg[0], "\n| %s |---------------------------------------------------\r\n\n", __TIME__);
  uart_putstring((uint8_t*) &start_msg[0]);

  nrf_gpio_range_cfg_output(0, 30);
  for(int i = LED_START; i <= LED_STOP; ++i)
    nrf_gpio_pin_set(i);

  uint32_t error_code = sd_softdevice_enable((uint32_t)NRF_CLOCK_LFCLKSRC_XTAL_75_PPM, sd_assert_cb);
  APP_ERROR_CHECK(error_code);


  error_code = sd_nvic_EnableIRQ(SD_EVT_IRQn);
  APP_ERROR_CHECK(error_code);

  ble_setup();

  /* Enable a generic SD advertiser to display concurrent operation */
  nrf_adv_conn_init();

  while (true)
  {
    sd_app_evt_wait();
  }
}
开发者ID:Frozenleaf,项目名称:nRF51-multi-role-conn-observer-advertiser,代码行数:33,代码来源:main.c

示例3: main

/**@brief Function for application main entry. Does not return.
 */
int main(void)
{
    uint32_t err_code;
    nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;

    utils_setup();

    // Setup SoftDevice and events handler
    err_code = softdevice_ant_evt_handler_set(ant_io_tx_event_handler);
    APP_ERROR_CHECK(err_code);

    err_code = softdevice_handler_init(&clock_lf_cfg, NULL, 0, NULL);
    APP_ERROR_CHECK(err_code);

    err_code = ant_stack_static_config();
    APP_ERROR_CHECK(err_code);

    // Setup and start ANT channel
    ant_io_tx_setup();

    // Enter main loop.
    for (;;)
    {
        err_code = sd_app_evt_wait();
        APP_ERROR_CHECK(err_code);
    }
}
开发者ID:mrhexiaoheng,项目名称:nrf51_sdk11,代码行数:29,代码来源:main.c

示例4: nrf_pwr_mgmt_run

void nrf_pwr_mgmt_run(void)
{
#if NRF_PWR_MGMT_CONFIG_FPU_SUPPORT_ENABLED
    /*
     * Clear FPU exceptions.
     * Without this step, the FPU interrupt is marked as pending,
     * preventing system from sleeping.
     */
    uint32_t fpscr = __get_FPSCR();
    __set_FPSCR(fpscr & ~0x9Fu);
    __DMB();
    NVIC_ClearPendingIRQ(FPU_IRQn);

    // Assert if a critical FPU exception is signaled.
    ASSERT((fpscr & 0x03) == 0);
#endif // NRF_PWR_MGMT_CONFIG_FPU_SUPPORT_ENABLED

    SLEEP_LOCK();

#if NRF_PWR_MGMT_CONFIG_CPU_USAGE_MONITOR_ENABLED
    uint32_t sleep_start;
    uint32_t sleep_end;
    uint32_t sleep_duration;

    sleep_start = app_timer_cnt_get();
#endif // NRF_PWR_MGMT_CONFIG_CPU_USAGE_MONITOR_ENABLED

    DEBUG_PIN_SET();

    // Wait for an event.
#ifdef SOFTDEVICE_PRESENT
    ret_code_t ret_code = sd_app_evt_wait();
    if (ret_code == NRF_ERROR_SOFTDEVICE_NOT_ENABLED)
    {
        __WFE();
        __SEV();
        __WFE();
    }
    else
    {
        APP_ERROR_CHECK(ret_code);
    }
#else
    __WFE();
    __SEV();
    __WFE();
#endif // SOFTDEVICE_PRESENT

    DEBUG_PIN_CLEAR();

#if NRF_PWR_MGMT_CONFIG_CPU_USAGE_MONITOR_ENABLED
    sleep_end = app_timer_cnt_get();
    UNUSED_VARIABLE(app_timer_cnt_diff_compute(sleep_end,
                                               sleep_start,
                                               &sleep_duration));
    m_ticks_sleeping += sleep_duration;
#endif // NRF_PWR_MGMT_CONFIG_CPU_USAGE_MONITOR_ENABLED

    SLEEP_RELEASE();
}
开发者ID:CWBudde,项目名称:Espruino,代码行数:60,代码来源:nrf_pwr_mgmt.c

示例5: main

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

    //Initialize.
    app_trace_init();
    leds_init();
    scheduler_init();
    timers_init();
    iot_timer_init();
    button_init();
    ble_stack_init();
    advertising_init();
    ip_stack_init ();

    //Start execution.
    advertising_start();

    //Enter main loop.
    for (;;)
    {
        //Execute event schedule.
        app_sched_execute();

        //Sleep waiting for an application event.
        err_code = sd_app_evt_wait();
        APP_ERROR_CHECK(err_code);
    }
}
开发者ID:xueliu,项目名称:nRF51822,代码行数:32,代码来源:main.c

示例6: main

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

    // Initialize.
    app_trace_init();
    leds_init();
    timers_init();
    gpiote_init();

    err_code = ipv6_transport_init();
    APP_ERROR_CHECK(err_code);

    // Initialize IP Stack.
    ip_stack_init();

    APPL_LOG("\r\n");
    APPL_LOG("[APPL]: Init complete.\r\n");

    // Start execution.
    advertising_start();

    // Enter main loop.
    for (;;)
    {
        /* Sleep waiting for an application event. */
        err_code = sd_app_evt_wait();
        APP_ERROR_CHECK(err_code);
    }
}
开发者ID:451506709,项目名称:automated_machine,代码行数:33,代码来源:main.c

示例7: socket_recv

static uint32_t
socket_recv(socket_handle_t * p_socket_handle,
            void * p_buf,
            uint32_t buf_size,
            uint32_t * buf_len,
            int flags)
{
    if ((p_socket_handle->flags & O_NONBLOCK) != 0 &&
        (flags & MSG_WAITALL) == 0)
    {
        flags |= MSG_DONTWAIT;
    }
    uint32_t err_code = NRF_SUCCESS;
    if (mbuf_empty(&p_socket_handle->mbuf_head) == true)
    {
        if ((flags & MSG_DONTWAIT) != 0)
        {
            err_code = SOCKET_WOULD_BLOCK;
        }
        else
        {
            while ((mbuf_empty(&p_socket_handle->mbuf_head) == true) && (err_code == NRF_SUCCESS))
            {
                err_code = sd_app_evt_wait();
            }
        }
    }

    if (err_code == NRF_SUCCESS)
    {
        *buf_len = mbuf_read(&p_socket_handle->mbuf_head, p_buf, buf_size);
        p_socket_handle->read_events = 0;
    }
    return err_code;
}
开发者ID:sische,项目名称:MasterThesis,代码行数:35,代码来源:socket.c

示例8: main

/**@brief Function for application main entry. Does not return.
 */
int main(void)
{
    uint32_t err_code;
    nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;

    utils_setup();

    // Enable SoftDevice.
    err_code = softdevice_ant_evt_handler_set(ant_evt_dispatch);
    APP_ERROR_CHECK(err_code);

    err_code = softdevice_handler_init(&clock_lf_cfg, NULL, 0, NULL);
    APP_ERROR_CHECK(err_code);

    err_code = ant_stack_static_config();
    APP_ERROR_CHECK(err_code);

    // Setup and open Channel_0 as a Bidirectional Master.
    app_channel_setup();

    #ifdef INCLUDE_DEBUG_CHANNEL
    // Setup and open Debug Channel
    ad_init();
    ad_register_custom_command_callback(app_custom_debug_command_handler);
    #endif

    // Enter main loop
    for (;;)
    {
        err_code = sd_app_evt_wait();
        APP_ERROR_CHECK(err_code);
    }
}
开发者ID:IOIOI,项目名称:nRF51,代码行数:35,代码来源:main.c

示例9: main

/* Main function */
int main(void)
{
    uint32_t           err_code;
    nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;

    utils_setup();

    // Setup SoftDevice and events handler
    err_code = softdevice_ant_evt_handler_set(continuous_scan_event_handler);
    APP_ERROR_CHECK(err_code);

    err_code = softdevice_handler_init(&clock_lf_cfg, NULL, 0, NULL);
    APP_ERROR_CHECK(err_code);

    err_code = ant_stack_static_config();
    APP_ERROR_CHECK(err_code);

    continuous_scan_init();

    err_code = app_timer_create(&m_scan_timer_id,
                                APP_TIMER_MODE_SINGLE_SHOT,
                                scan_timeout_event);
    APP_ERROR_CHECK(err_code);

    // Enter main loop
    for (;;)
    {
        err_code = sd_app_evt_wait();
        APP_ERROR_CHECK(err_code);
    }
}
开发者ID:lyncxy119,项目名称:Sentry,代码行数:32,代码来源:main.c

示例10: main

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

    timers_init();
    gpiote_init();
    buttons_init();
    ble_stack_init();
    device_manager_init();

    // Initialize Bluetooth Stack parameters.
    gap_params_init();
    advertising_init();
    services_init();
    conn_params_init();

    // Start advertising.
    advertising_start();

    // Enter main loop.
    for (;;)
    {
        // Switch to a low power state until an event is available for the application
        err_code = sd_app_evt_wait();
        APP_ERROR_CHECK(err_code);
    }
}
开发者ID:ChicoSlim,项目名称:BLEKey,代码行数:29,代码来源:main.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: dtm_init

/**@brief Function for initializing the DTM mode.
 */
static void dtm_init(void)
{
    uint32_t                      err_code;
    app_uart_stream_comm_params_t uart_params;

    uart_params.baud_rate = UART_BAUD_RATE_19200;
    uart_params.rx_pin_no = DTM_RX_PIN_NO;
    uart_params.tx_pin_no = DTM_TX_PIN_NO;

    err_code = ble_dtm_init(&uart_params);

    if (err_code == NRF_SUCCESS)
    {
        err_code = bsp_indication_set(BSP_INDICATE_USER_STATE_OFF);
        APP_ERROR_CHECK(err_code);

        // Close serialization transport layer.
        err_code = sd_softdevice_disable();
        APP_ERROR_CHECK(err_code);

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

示例13: main

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

    timers_init();
    gpiote_init();
    buttons_init();

    nrf_gpio_cfg_output(CONNECTED_LED_PIN_NO);  //DM: Green LED controlled directly. Red through GPIOTE task (Timer1_Compare[0])

    ble_stack_init();
    bond_manager_init();

    // Initialize Bluetooth Stack parameters
    gap_params_init();
    advertising_init();
    services_init();
    conn_params_init(); //just for relayr, iBeacon does´t allow connect
    sec_params_init();  //iBeacon: no security

    // Start advertising
    advertising_start();

    // Enter main loop
    for (;;)
    {
        // Switch to a low power state until an event is available for the application
        err_code = sd_app_evt_wait();
        APP_ERROR_CHECK(err_code);
    }
}
开发者ID:damancusonqn,项目名称:BLE_tests,代码行数:33,代码来源:main.c

示例14: main

/**@brief Function for application main entry. Does not return.
 */ 
int main(void)
{

    utils_setup();
    softdevice_setup();
    ant_channel_tx_broadcast_setup();

    // Main loop. 
    for (;;)
    {
#ifdef CPU_LOAD_TRACE
        // Disabling interrupts in this way is highly not recommended. It has an impact on the work
        // of the softdecive and it is used only in order to show CPU load.
        __disable_irq();
        LEDS_OFF(BSP_LED_0_MASK);
        __WFI();
        LEDS_ON(BSP_LED_0_MASK);
        __enable_irq();
#else
        // Put CPU in sleep if possible. 
        uint32_t err_code = sd_app_evt_wait();
        APP_ERROR_CHECK(err_code);
#endif // CPU_LOAD_TRACE
    }
}
开发者ID:IOIOI,项目名称:nRF51,代码行数:27,代码来源:main.c

示例15: main

/** @brief main function */
int main(void)
{
    /* Enable Softdevice (including sd_ble before framework */
    uint32_t error_code = 
        sd_softdevice_enable(NRF_CLOCK_LFCLKSRC_XTAL_75_PPM, sd_assert_handler);
    APP_ERROR_CHECK(error_code);
    
    ble_enable_params_t ble_enable_params;
    ble_enable_params.gatts_enable_params.service_changed = 0;
    
    error_code = sd_ble_enable(&ble_enable_params);
    APP_ERROR_CHECK(error_code);
    
    /* init leds and pins */
    gpio_init();
    
#ifdef RBC_MESH_SERIAL
    
    /* only want to enable serial interface, and let external host setup the framework */
    mesh_aci_init();

#else    
    /* Enable mesh framework on channel 37, min adv interval at 100ms, 
        2 characteristics */
    rbc_mesh_init_params_t init_params;

    init_params.access_addr = 0xA541A68F;
    init_params.adv_int_ms = 100;
    init_params.channel = 38;
    init_params.handle_count = 2;
    init_params.packet_format = RBC_MESH_PACKET_FORMAT_ORIGINAL;
    init_params.radio_mode = RBC_MESH_RADIO_MODE_BLE_1MBIT;
    
    error_code = rbc_mesh_init(init_params);
    APP_ERROR_CHECK(error_code);
    
    /* request values for both LEDs on the mesh */
    error_code = rbc_mesh_value_enable(1);
    APP_ERROR_CHECK(error_code);
    error_code = rbc_mesh_value_enable(2);
    APP_ERROR_CHECK(error_code);
    
    
    /* init BLE gateway softdevice application: */
    nrf_adv_conn_init();
    
#endif
    
    /* enable softdevice IRQ */
    sd_nvic_EnableIRQ(SD_EVT_IRQn);
    
    
    /* sleep */
    while (true)
    {
        sd_app_evt_wait();
    }
    

}
开发者ID:Eppo791906066,项目名称:nRF51-ble-bcast-mesh,代码行数:61,代码来源:main.c


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