mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[ion] Move Power::standbyConfiguration to N0110 folder to prevent anyone
to use it in N0100
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#include <drivers/power.h>
|
||||
#include <drivers/board.h>
|
||||
#include <drivers/power.h>
|
||||
#include <drivers/keyboard.h>
|
||||
#include <regs/regs.h>
|
||||
|
||||
namespace Ion {
|
||||
namespace Power {
|
||||
@@ -17,3 +19,36 @@ void standby() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
namespace Ion {
|
||||
namespace Device {
|
||||
namespace Power {
|
||||
|
||||
// Public Power methods
|
||||
using namespace Device::Regs;
|
||||
|
||||
void standbyConfiguration() {
|
||||
PWR.CR()->setPPDS(true); // Select standby when the CPU enters deepsleep
|
||||
PWR.CR()->setCSBF(true); // Clear Standby flag
|
||||
PWR.CSR()->setBRE(false); // Unable back up RAM (lower power consumption in standby)
|
||||
PWR.CSR()->setEIWUP(false); // Unable RTC (lower power consumption in standby)
|
||||
|
||||
/* The pin A0 is about to be configured as a wakeup pin. However, the matrix
|
||||
* keyboard connects pin A0 (row B) with other pins (column 1, column 3...).
|
||||
* We thus shutdown this pins to avoid the potential pull-up on pin A0 due to
|
||||
* a keyboard event. For example, if the "Home" key is down, pin A0 is
|
||||
* pulled-up so enabling it as the wake up pin would trigger a wake up flag
|
||||
* instantly. */
|
||||
Device::Keyboard::shutdown();
|
||||
#if REGS_PWR_CONFIG_ADDITIONAL_FIELDS
|
||||
PWR.CSR2()->setEWUP1(true); // Enable PA0 as wakeup pin
|
||||
PWR.CR2()->setWUPP1(false); // Define PA0 (wakeup) pin polarity (rising edge)
|
||||
PWR.CR2()->setCWUPF1(true); // Clear wakeup pin flag for PA0 (if device has already been in standby and woke up)
|
||||
#endif
|
||||
|
||||
CORTEX.SCR()->setSLEEPDEEP(true); // Allow Cortex-M7 deepsleep state
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
16
ion/src/device/n0110/drivers/power.h
Normal file
16
ion/src/device/n0110/drivers/power.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef ION_DEVICE_N0110_POWER_H
|
||||
#define ION_DEVICE_N0110_POWER_H
|
||||
|
||||
#include <ion/src/device/shared/drivers/power.h>
|
||||
|
||||
namespace Ion {
|
||||
namespace Device {
|
||||
namespace Power {
|
||||
|
||||
void standbyConfiguration();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -160,28 +160,6 @@ void sleepConfiguration() {
|
||||
CORTEX.SCR()->setSLEEPDEEP(false);
|
||||
}
|
||||
|
||||
void standbyConfiguration() {
|
||||
PWR.CR()->setPPDS(true); // Select standby when the CPU enters deepsleep
|
||||
PWR.CR()->setCSBF(true); // Clear Standby flag
|
||||
PWR.CSR()->setBRE(false); // Unable back up RAM (lower power consumption in standby)
|
||||
PWR.CSR()->setEIWUP(false); // Unable RTC (lower power consumption in standby)
|
||||
|
||||
/* The pin A0 is about to be configured as a wakeup pin. However, the matrix
|
||||
* keyboard connects pin A0 (row B) with other pins (column 1, column 3...).
|
||||
* We thus shutdown this pins to avoid the potential pull-up on pin A0 due to
|
||||
* a keyboard event. For example, if the "Home" key is down, pin A0 is
|
||||
* pulled-up so enabling it as the wake up pin would trigger a wake up flag
|
||||
* instantly. */
|
||||
Device::Keyboard::shutdown();
|
||||
#if REGS_PWR_CONFIG_ADDITIONAL_FIELDS
|
||||
PWR.CSR2()->setEWUP1(true); // Enable PA0 as wakeup pin
|
||||
PWR.CR2()->setWUPP1(false); // Define PA0 (wakeup) pin polarity (rising edge)
|
||||
PWR.CR2()->setCWUPF1(true); // Clear wakeup pin flag for PA0 (if device has already been in standby and woke up)
|
||||
#endif
|
||||
|
||||
CORTEX.SCR()->setSLEEPDEEP(true); // Allow Cortex-M7 deepsleep state
|
||||
}
|
||||
|
||||
void waitUntilOnOffKeyReleased() {
|
||||
/* Wait until power is released to avoid restarting just after suspending */
|
||||
bool isPowerDown = true;
|
||||
|
||||
@@ -11,7 +11,6 @@ void configWakeUp();
|
||||
|
||||
void sleepConfiguration();
|
||||
void stopConfiguration();
|
||||
void standbyConfiguration();
|
||||
|
||||
void waitUntilOnOffKeyReleased();
|
||||
void enterLowPowerMode();
|
||||
|
||||
Reference in New Issue
Block a user