mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
Diff: targets/TARGET_NUVOTON/TARGET_M480/sleep.c
- Revision:
- 188:bcfe06ba3d64
- Parent:
- 176:447f873cad2f
--- a/targets/TARGET_NUVOTON/TARGET_M480/sleep.c Thu Sep 06 13:40:20 2018 +0100 +++ b/targets/TARGET_NUVOTON/TARGET_M480/sleep.c Thu Nov 08 11:46:34 2018 +0000 @@ -22,6 +22,11 @@ #include "device.h" #include "objects.h" #include "PeripheralPins.h" +#include <stdbool.h> + +#if DEVICE_SERIAL +bool serial_can_deep_sleep(void); +#endif /** * Enter idle mode, in which just CPU is halted. @@ -38,6 +43,12 @@ */ void hal_deepsleep(void) { +#if DEVICE_SERIAL + if (!serial_can_deep_sleep()) { + return; + } +#endif + SYS_UnlockReg(); CLK_PowerDown(); SYS_LockReg();