可以在程序中这样写:
cpp
复制
编辑
#if defined(DEBUG) || defined(_DEBUG)
// 禁止低功耗用于调试
HAL_DBGMCU_EnableDBGSleepMode();
HAL_DBGMCU_EnableDBGStopMode();
HAL_DBGMCU_EnableDBGStandbyMode();
#endif
或使用 Mbed 的 API(如果仍部分保留 Mbed):
cpp
复制
编辑
sleep_manager_lock_deep_sleep(); // 禁止进入 Deep Sleep(Stop/Standby)
|