请选择 进入手机版 | 继续访问电脑版

930电子网

 找回密码
 立即注册
艾克姆科技推出最新产品STC32G12K128开发板
查看: 12065|回复: 0

app_timer首次开启RTC1计时器,是从哪启动

[复制链接]

57

主题

80

帖子

366

积分

中级会员

Rank: 3Rank: 3

积分
366
发表于 2020-9-28 17:41:57 | 显示全部楼层 |阅读模式
//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中断
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|官方淘宝店|930电子网 ( 皖ICP备16000695号-2 )

GMT+8, 2024-3-29 13:57 , Processed in 0.062784 second(s), 21 queries .

快速回复 返回顶部 返回列表