summaryrefslogtreecommitdiff
path: root/src/stmf0/ao_arch_funcs.h
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2019-07-16 11:02:56 -0700
committerKeith Packard <keithp@keithp.com>2019-07-16 11:02:56 -0700
commit009d56b4f03c1ba3c9a36bdb54c772ad21844057 (patch)
tree67091b67b767e9d565ebca7212e493aa92499633 /src/stmf0/ao_arch_funcs.h
parente879d739c394602043e8ed512ad1a433fbf96c1c (diff)
altos/stmf0: Leave power interface disabled until needed
We only need the power interface when placing the chip in the lowest power state, so don't power up the power interface clock at startup, instead wait until later. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/stmf0/ao_arch_funcs.h')
-rw-r--r--src/stmf0/ao_arch_funcs.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/stmf0/ao_arch_funcs.h b/src/stmf0/ao_arch_funcs.h
index a0c6e088..591ca8a0 100644
--- a/src/stmf0/ao_arch_funcs.h
+++ b/src/stmf0/ao_arch_funcs.h
@@ -458,6 +458,9 @@ static inline void ao_sleep_mode(void) {
ao_arch_block_interrupts();
+ /* Enable power interface clock */
+ stm_rcc.apb1enr |= (1 << STM_RCC_APB1ENR_PWREN);
+ ao_arch_nop();
stm_scb.scr |= (1 << STM_SCB_SCR_SLEEPDEEP);
ao_arch_nop();
stm_pwr.cr |= (1 << STM_PWR_CR_PDDS) | (1 << STM_PWR_CR_LPDS);