nRF52832起来之后测试是上电还是休眠唤醒的方法

void fu_state_machine_init(void)
{
    /*
        NRF_POWER_RESETREAS_SREQ_MASK   JLINK DOWNLOAD / POWER ON can cause this reason
    */
    if(nrf_power_resetreas_get() & NRF_POWER_RESETREAS_OFF_MASK)//读取是掉电重启还是按键唤醒
    {//按键唤醒
        //if(KEY_POWER_PRESSED)
        //{
        //    key_smokekey_enable();
        //}
        
        eStateMachine = E_SM_IDLE;
        eStateMachine_pre = E_SM_NONE;
    }
    else
    {//掉电重启
        eStateMachine = E_SM_PowerOn;
        eStateMachine_pre = E_SM_NONE;
    }
    uMachine_V.heating_num = 0;
    uMachine_V.next_time_EN = 0;
    nrf_power_resetreas_clear(0xFFFFFFFF);

    app_timer_create(&m_state_machine_id,
                                APP_TIMER_MODE_REPEATED,
                                _state_machine_handler);
    state_machine_Timer_STAT();
}
经验再多也只能看作加法,而经过理论升华的经验,就可以看作乘法!
原文地址:https://www.cnblogs.com/TorryLong/p/13812907.html