At least: font code generator, exchange code support for color 128x128
This commit is contained in:
24
LowPower.cpp
24
LowPower.cpp
@@ -25,20 +25,39 @@
|
||||
|
||||
#include "stm32l0xx.h"
|
||||
|
||||
uint32_t wakeups = 0;
|
||||
|
||||
namespace BSP {
|
||||
|
||||
using Common::ReturnCode;
|
||||
|
||||
ReturnCode LowPower::init()
|
||||
{
|
||||
enable_debug();
|
||||
return ReturnCode::OK;
|
||||
}
|
||||
|
||||
ReturnCode LowPower::enable_debug()
|
||||
{
|
||||
/* Enable Clocks */
|
||||
SET(RCC->APB2ENR, RCC_APB2ENR_DBGEN);
|
||||
SET(RCC->APB2SMENR, RCC_APB2SMENR_DBGSMEN);
|
||||
|
||||
// FIXME: Make these configurable, will mess with power consumption
|
||||
SET(DBGMCU->CR, DBGMCU_CR_DBG_STOP);
|
||||
SET(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP);
|
||||
SET(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY);
|
||||
|
||||
return ReturnCode::OK;
|
||||
}
|
||||
|
||||
ReturnCode LowPower::disable_debug()
|
||||
{
|
||||
CLR(DBGMCU->CR, DBGMCU_CR_DBG_STOP);
|
||||
CLR(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP);
|
||||
CLR(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY);
|
||||
|
||||
CLR(RCC->APB2SMENR, RCC_APB2SMENR_DBGSMEN);
|
||||
|
||||
return ReturnCode::OK;
|
||||
}
|
||||
|
||||
@@ -59,8 +78,9 @@ ReturnCode LowPower::stop()
|
||||
SET(SCB->SCR, SCB_SCR_SLEEPDEEP_Msk); // low-power mode = stop mode
|
||||
__WFI(); // enter low-power mode (Wake from interrupt)
|
||||
|
||||
wakeups++;
|
||||
|
||||
return ReturnCode::OK;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user