Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
micropython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
micropython
Commits
c6365ffb
Commit
c6365ffb
authored
Dec 05, 2018
by
Damien George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stm32/powerctrl: Add support for standby mode on L4 MCUs.
This maps to machine.deepsleep() which is now supported.
parent
a1c81761
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
6 deletions
+4
-6
ports/stm32/modmachine.c
ports/stm32/modmachine.c
+0
-4
ports/stm32/powerctrl.c
ports/stm32/powerctrl.c
+4
-2
No files found.
ports/stm32/modmachine.c
View file @
c6365ffb
...
...
@@ -330,11 +330,7 @@ STATIC mp_obj_t machine_sleep(void) {
MP_DEFINE_CONST_FUN_OBJ_0
(
machine_sleep_obj
,
machine_sleep
);
STATIC
mp_obj_t
machine_deepsleep
(
void
)
{
#if defined(STM32L4)
printf
(
"machine.deepsleep not supported yet
\n
"
);
#else
powerctrl_enter_standby_mode
();
#endif
return
mp_const_none
;
}
MP_DEFINE_CONST_FUN_OBJ_0
(
machine_deepsleep_obj
,
machine_deepsleep
);
...
...
ports/stm32/powerctrl.c
View file @
c6365ffb
...
...
@@ -340,7 +340,6 @@ void powerctrl_enter_stop_mode(void) {
enable_irq
(
irq_state
);
}
#if !defined(STM32L4)
void
powerctrl_enter_standby_mode
(
void
)
{
rtc_init_finalise
();
...
...
@@ -376,6 +375,10 @@ void powerctrl_enter_standby_mode(void) {
PWR
->
CR2
|=
PWR_CR2_CWUPF6
|
PWR_CR2_CWUPF5
|
PWR_CR2_CWUPF4
|
PWR_CR2_CWUPF3
|
PWR_CR2_CWUPF2
|
PWR_CR2_CWUPF1
;
#elif defined(STM32H7)
// TODO
#elif defined(STM32L4)
// clear all wake-up flags
PWR
->
SCR
|=
PWR_SCR_CWUF5
|
PWR_SCR_CWUF4
|
PWR_SCR_CWUF3
|
PWR_SCR_CWUF2
|
PWR_SCR_CWUF1
;
// TODO
#else
// clear global wake-up flag
PWR
->
CR
|=
PWR_CR_CWUF
;
...
...
@@ -388,4 +391,3 @@ void powerctrl_enter_standby_mode(void) {
HAL_PWR_EnterSTANDBYMode
();
// we never return; MCU is reset on exit from standby
}
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment