示例#1
0
void nrf_drv_timer_uninit(nrf_drv_timer_t const * const p_instance)
{
    uint32_t i;

    nrf_drv_common_irq_disable(p_instance->irq);

    m_timer_event_handlers[p_instance->instance_id] = NULL;

    nrf_drv_timer_disable(p_instance);
    
    //lint -save -e655
    nrf_timer_shorts_clear(p_instance->p_reg, NRF_TIMER_SHORTS_COMPARE0_STOP_MASK  |
                                           NRF_TIMER_SHORTS_COMPARE1_STOP_MASK  |
                                           NRF_TIMER_SHORTS_COMPARE2_STOP_MASK  |
                                           NRF_TIMER_SHORTS_COMPARE3_STOP_MASK  |
                                           NRF_TIMER_SHORTS_COMPARE0_CLEAR_MASK |
                                           NRF_TIMER_SHORTS_COMPARE1_CLEAR_MASK |
                                           NRF_TIMER_SHORTS_COMPARE2_CLEAR_MASK |
                                           NRF_TIMER_SHORTS_COMPARE3_CLEAR_MASK);
    //lint -restore
    
    for(i=0; i<TIMER_CHANNEL_NUMBER; i++)
    {   
        nrf_timer_int_disable(p_instance->p_reg, NRF_TIMER_INT_COMPARE0_MASK << i);
    }
    
    m_cb[p_instance->instance_id].state = NRF_DRV_STATE_UNINITIALIZED;
}
示例#2
0
void nrf_drv_timer_uninit(nrf_drv_timer_t const * const p_instance)
{
    nrf_drv_common_irq_disable(nrf_drv_get_IRQn(p_instance->p_reg));

    #define DISABLE_ALL UINT32_MAX
    nrf_timer_shorts_disable(p_instance->p_reg, DISABLE_ALL);
    nrf_timer_int_disable(p_instance->p_reg, DISABLE_ALL);
    #undef DISABLE_ALL

    nrf_drv_timer_disable(p_instance);

    m_cb[p_instance->instance_id].state = NRF_DRV_STATE_UNINITIALIZED;
}
示例#3
0
void nrf_drv_timer_uninit(nrf_drv_timer_t const * const p_instance)
{
    nrf_drv_common_irq_disable(nrf_drv_get_IRQn(p_instance->p_reg));

    #define DISABLE_ALL UINT32_MAX
    nrf_timer_shorts_disable(p_instance->p_reg, DISABLE_ALL);
    nrf_timer_int_disable(p_instance->p_reg, DISABLE_ALL);
    #undef DISABLE_ALL

    if (m_cb[p_instance->instance_id].state == NRF_DRV_STATE_POWERED_ON)
    {
        nrf_drv_timer_disable(p_instance);
    }

    m_cb[p_instance->instance_id].state = NRF_DRV_STATE_UNINITIALIZED;
    NRF_LOG_INFO("Uninitialized instance: %d.\r\n", p_instance->instance_id);
}