Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
066332d6
Commit
066332d6
authored
8 years ago
by
Kaspar Schleiser
Browse files
Options
Downloads
Patches
Plain Diff
cpu: stm32f1: add periph/pm support
parent
0fb66a0f
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
cpu/stm32f1/Makefile.features
+1
-0
1 addition, 0 deletions
cpu/stm32f1/Makefile.features
cpu/stm32f1/include/periph_cpu.h
+2
-0
2 additions, 0 deletions
cpu/stm32f1/include/periph_cpu.h
cpu/stm32f1/periph/pm.c
+63
-0
63 additions, 0 deletions
cpu/stm32f1/periph/pm.c
with
66 additions
and
0 deletions
cpu/stm32f1/Makefile.features
0 → 100644
+
1
−
0
View file @
066332d6
FEATURE_PROVIDED
+=
periph_pm
This diff is collapsed.
Click to expand it.
cpu/stm32f1/include/periph_cpu.h
+
2
−
0
View file @
066332d6
...
@@ -123,6 +123,8 @@ typedef struct {
...
@@ -123,6 +123,8 @@ typedef struct {
uint8_t
chan
;
/**< DAC device used for this line */
uint8_t
chan
;
/**< DAC device used for this line */
}
dac_conf_t
;
}
dac_conf_t
;
#define PM_NUM_MODES (2U)
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
This diff is collapsed.
Click to expand it.
cpu/stm32f1/periph/pm.c
0 → 100644
+
63
−
0
View file @
066332d6
/*
* Copyright (C) 2016 Kaspar Schleiser <kaspar@schleiser.de>
* 2015 Engineering-Spirit
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup cpu_stm32f1
* @{
*
* @file
* @brief Implementation of the kernels power management interface
*
* @author Nick v. IJzendoorn <nijzndoorn@engineering-spirit.nl>
* @author Kaspar Schleiser <kaspar@schleiser.de>
*
* @}
*/
#include
"periph/pm.h"
#define ENABLE_DEBUG (1)
#include
"debug.h"
void
pm_set
(
unsigned
mode
)
{
switch
(
mode
)
{
case
0
:
/* STM Sleep mode */
/* Reset SLEEPDEEP bit of system control block */
SCB
->
SCR
&=
~
(
SCB_SCR_SLEEPDEEP_Msk
);
break
;
case
1
:
/* STM Stop mode */
/* Clear PDDS and LPDS bits to enter stop mode on */
/* deepsleep with voltage regulator on */
PWR
->
CR
&=
~
(
PWR_CR_PDDS
|
PWR_CR_LPDS
);
/* Set SLEEPDEEP bit of system control block */
SCB
->
SCR
|=
SCB_SCR_SLEEPDEEP_Msk
;
break
;
default:
DEBUG
(
"pm: invalid power mode selected.
\n
"
);
}
/* Executes a device DSB (Data Synchronization Barrier) */
__DSB
();
/* Enter standby mode */
__WFI
();
}
void
pm_off
(
void
)
{
/* Set PDDS to enter standby mode on deepsleep and clear flags */
PWR
->
CR
|=
(
PWR_CR_PDDS
|
PWR_CR_CWUF
|
PWR_CR_CSBF
);
/* Enable WKUP pin to use for wakeup from standby mode */
PWR
->
CSR
|=
PWR_CSR_EWUP
;
/* Set SLEEPDEEP bit of system control block */
SCB
->
SCR
|=
SCB_SCR_SLEEPDEEP_Msk
;
__DSB
();
__WFI
();
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment