|
//RTC1中断处理函数
void drv_rtc_rtc_1_irq_handler(void)
{
m_handlers[DRV_RTC_RTC1_INST_IDX](m_cb[DRV_RTC_RTC1_INST_IDX].p_instance);
}
//开启app_timer
ret_code_t app_timer_start(app_timer_t * p_timer, uint32_t timeout_ticks, void * p_context)
{
ASSERT(p_timer);
app_timer_t * p_t = (app_timer_t *) p_timer;
if (p_t->active)
{
return NRF_SUCCESS;
}
p_t->p_context = p_context;
p_t->end_val = get_now() + timeout_ticks;
if (p_t->repeat_period)
{
p_t->repeat_period = timeout_ticks;
}
return timer_req_schedule(TIMER_REQ_START, p_t);
}
static ret_code_t timer_req_schedule(app_timer_req_type_t type, app_timer_t * p_timer)
{
nrf_atfifo_item_put_t fifo_ctx;
timer_req_t * p_req;
#if APP_TIMER_WITH_PROFILER
CRITICAL_REGION_ENTER();
#endif
p_req = nrf_atfifo_item_alloc(m_req_fifo, &fifo_ctx);
#if APP_TIMER_WITH_PROFILER
if (p_req)
{
++m_current_user_op_queue_utilization;
}
CRITICAL_REGION_EXIT();
#endif /* APP_TIMER_WITH_PROFILER */
if (p_req)
{
p_req->type = type;
p_req->p_timer = p_timer;
if (nrf_atfifo_item_put(m_req_fifo, &fifo_ctx))
{
timer_request_proc_trigger();
}
else
{
NRF_LOG_WARNING("Scheduling interrupted another scheduling.");
}
return NRF_SUCCESS;
}
else
{
return NRF_ERROR_NO_MEM;
}
}
static inline void timer_request_proc_trigger(void)
{
drv_rtc_irq_trigger(&m_rtc_inst);
}
void drv_rtc_irq_trigger(drv_rtc_t const * const p_instance)
{
NVIC_SetPendingIRQ(p_instance->irq);
}
分析app_timer_start函数,发现最后NVIC_SetPendingIRQ(p_instance->irq);挂起中断,但是没有开启中断。因此,启动app_timer后,在哪里开启了RTC1中断
|
|