From 6ef35fc634f577682da5157fea4653a4c7d65de6 Mon Sep 17 00:00:00 2001 From: Ruben Dashyan Date: Mon, 14 Jan 2019 16:45:40 +0100 Subject: [PATCH] [ion/f730] Under-drive stop mode --- ion/src/f730/power.cpp | 6 ++++-- ion/src/f730/regs/pwr.h | 11 +++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ion/src/f730/power.cpp b/ion/src/f730/power.cpp index 021d75cc6..d18854bf5 100644 --- a/ion/src/f730/power.cpp +++ b/ion/src/f730/power.cpp @@ -20,8 +20,10 @@ void Ion::Power::suspend(bool checkIfPowerKeyReleased) { } Device::shutdownPeripherals(isLEDActive); - PWR.CR()->setLPDS(true); // Turn the regulator off. Takes longer to wake up. - PWR.CR()->setFPDS(true); // Put the flash to sleep. Takes longer to wake up. + PWR.CR1()->setLPDS(true); // Turn the regulator off. Takes longer to wake up. + PWR.CR1()->setFPDS(true); // Put the flash to sleep. Takes longer to wake up. + PWR.CR1()->setLPUDS(true); + PWR.CR1()->setUDEN(PWR::CR1::UnderDrive::Enable); CM4.SCR()->setSLEEPDEEP(!isLEDActive); while (1) { diff --git a/ion/src/f730/regs/pwr.h b/ion/src/f730/regs/pwr.h index 089d72e18..f3cef32d7 100644 --- a/ion/src/f730/regs/pwr.h +++ b/ion/src/f730/regs/pwr.h @@ -5,15 +5,22 @@ class PWR { public: - class CR : Register32 { + class CR1 : Register32 { public: + enum class UnderDrive { + Disable = 0, + Enable = 3 + }; REGS_BOOL_FIELD(LPDS, 0); REGS_BOOL_FIELD(PPDS, 1); REGS_BOOL_FIELD(FPDS, 9); + REGS_BOOL_FIELD(LPUDS, 10); + REGS_BOOL_FIELD(MRUDS, 11); + REGS_FIELD_W(UDEN, UnderDrive, 19, 18); }; constexpr PWR() {}; - REGS_REGISTER_AT(CR, 0x00); + REGS_REGISTER_AT(CR1, 0x00); private: constexpr uint32_t Base() const { return 0x40007000;