コード例 #1
0
ファイル: ant_hrm.c プロジェクト: TanekLiang/rt-thread
ret_code_t ant_hrm_sens_init(ant_hrm_profile_t           * p_profile,
                           ant_channel_config_t const  * p_channel_config,
                           ant_hrm_sens_config_t const * p_sens_config)
{
    ASSERT(p_profile != NULL);
    ASSERT(p_channel_config != NULL);
    ASSERT(p_sens_config != NULL);
    ASSERT(p_sens_config->p_cb != NULL);
    ASSERT(p_sens_config->evt_handler != NULL);

    ASSERT((p_sens_config->main_page_number == ANT_HRM_PAGE_0)
           || (p_sens_config->main_page_number == ANT_HRM_PAGE_4));

    p_profile->evt_handler       = p_sens_config->evt_handler;
    p_profile->_cb.p_sens_cb     = p_sens_config->p_cb;

    ant_hrm_sens_cb_t * p_hrm_cb = p_profile->_cb.p_sens_cb;
    p_hrm_cb->page_1_present     = p_sens_config->page_1_present;
    p_hrm_cb->main_page_number   = p_sens_config->main_page_number;
    p_hrm_cb->ext_page_number    = p_hrm_cb->page_1_present ? ANT_HRM_PAGE_1 : ANT_HRM_PAGE_2;
    p_hrm_cb->message_counter    = 0;
    p_hrm_cb->toggle_bit         = true;

    return ant_hrm_init(p_profile, p_channel_config);
}
コード例 #2
0
ファイル: ant_hrm.c プロジェクト: TanekLiang/rt-thread
ret_code_t ant_hrm_disp_init(ant_hrm_profile_t          * p_profile,
                           ant_channel_config_t const * p_channel_config,
                           ant_hrm_evt_handler_t        evt_handler)
{
    ASSERT(p_profile != NULL);
    ASSERT(p_channel_config != NULL);
    ASSERT(evt_handler != NULL);

    p_profile->evt_handler = evt_handler;

    return ant_hrm_init(p_profile, p_channel_config);
}
コード例 #3
0
ファイル: main.c プロジェクト: RobinLin/Espruino
/**
 * @brief Function for HRM profile initialization.
 *
 * @details Initializes the HRM profile and open ANT channel.
 */
static void profile_setup(void)
{
/** @snippet [ANT HRM TX Profile Setup] */
    uint32_t err_code;

    err_code = ant_hrm_init(&m_ant_hrm, &ant_tx_channel_config, &ant_tx_config);
    APP_ERROR_CHECK(err_code);

    m_ant_hrm.page_2.manuf_id     = HRMTX_MFG_ID;
    m_ant_hrm.page_2.serial_num   = HRMTX_SERIAL_NUMBER;
    m_ant_hrm.page_3.hw_version   = HRMTX_HW_VERSION;
    m_ant_hrm.page_3.sw_version   = HRMTX_SW_VERSION;
    m_ant_hrm.page_3.model_num    = HRMTX_MODEL_NUMBER;
    
    err_code = ant_hrm_open(&m_ant_hrm);
    APP_ERROR_CHECK(err_code);
    
    err_code = ant_state_indicator_channel_opened();
    APP_ERROR_CHECK(err_code);
/** @snippet [ANT HRM TX Profile Setup] */
}
コード例 #4
0
ファイル: main.c プロジェクト: mcanos/nRF51
/**@brief Function for HRM profile initialization.
 *
 * @details Initializes the HRM profile and open ANT channel.
 */
static void ant_profile_setup(void)
{
/** @snippet [ANT HRM RX Profile Setup] */
    uint32_t err_code;
        
    err_code = ant_hrm_init(&m_ant_hrm, &ant_rx_channel_config, NULL);
    APP_ERROR_CHECK(err_code);

    err_code = ant_hrm_open(&m_ant_hrm);
    APP_ERROR_CHECK(err_code);

    
    // CAD
    err_code = ant_cad_init(&m_ant_cad, &ant_rx_channel_config2);
    APP_ERROR_CHECK(err_code);

    err_code = ant_cad_open(&m_ant_cad);
    APP_ERROR_CHECK(err_code);

/** @snippet [ANT HRM RX Profile Setup] */
}