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
6a5da1c1
Commit
6a5da1c1
authored
7 years ago
by
joris
Browse files
Options
Downloads
Patches
Plain Diff
cpu/stm32-common: add RTC support to stm32l0
Signed-off-by:
joris
<
laborde.joris@gmail.com
>
parent
3cdb92aa
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cpu/stm32_common/periph/rtc.c
+15
-7
15 additions, 7 deletions
cpu/stm32_common/periph/rtc.c
with
15 additions
and
7 deletions
cpu/stm32_common/periph/rtc.c
+
15
−
7
View file @
6a5da1c1
...
...
@@ -27,7 +27,8 @@
#if defined(CPU_FAM_STM32F0) || defined(CPU_FAM_STM32F2) || \
defined(CPU_FAM_STM32F3) || defined(CPU_FAM_STM32F4) || \
defined(CPU_FAM_STM32F7) || defined(CPU_FAM_STM32L1)
defined(CPU_FAM_STM32F7) || defined(CPU_FAM_STM32L0) || \
defined(CPU_FAM_STM32L1)
/* guard file in case no RTC device was specified */
#if RTC_NUMOF
...
...
@@ -65,7 +66,7 @@ void rtc_init(void)
PWR
->
CR
|=
PWR_CR_DBP
;
#endif
#if defined(CPU_FAM_STM32L1)
#if defined(CPU_FAM_STM32L1)
|| defined(CPU_FAM_STM32L0)
if
(
!
(
RCC
->
CSR
&
RCC_CSR_RTCEN
))
{
#else
if
(
!
(
RCC
->
BDCR
&
RCC_BDCR_RTCEN
))
{
...
...
@@ -192,9 +193,15 @@ int rtc_set_alarm(struct tm *time, rtc_alarm_cb_t cb, void *arg)
/* Enable RTC write protection */
RTC
->
WPR
=
0xFF
;
#if defined(CPU_FAM_STM32L0)
EXTI
->
IMR
|=
EXTI_IMR_IM17
;
#else
EXTI
->
IMR
|=
EXTI_IMR_MR17
;
#endif
EXTI
->
RTSR
|=
EXTI_RTSR_TR17
;
#if defined(CPU_FAM_STM32F0)
#if defined(CPU_FAM_STM32F0) || defined(CPU_FAM_STM32L0)
NVIC_SetPriority
(
RTC_IRQn
,
10
);
NVIC_EnableIRQ
(
RTC_IRQn
);
#else
...
...
@@ -235,7 +242,7 @@ void rtc_clear_alarm(void)
void
rtc_poweron
(
void
)
{
#if defined(CPU_FAM_STM32L1)
#if defined(CPU_FAM_STM32L1)
|| defined(CPU_FAM_STM32L0)
/* Reset RTC domain */
RCC
->
CSR
|=
RCC_CSR_RTCRST
;
RCC
->
CSR
&=
~
(
RCC_CSR_RTCRST
);
...
...
@@ -274,7 +281,7 @@ void rtc_poweron(void)
void
rtc_poweroff
(
void
)
{
#if defined(CPU_FAM_STM32L1)
#if defined(CPU_FAM_STM32L1)
|| defined(CPU_FAM_STM32L0)
/* Reset RTC domain */
RCC
->
CSR
|=
RCC_CSR_RTCRST
;
RCC
->
CSR
&=
~
(
RCC_CSR_RTCRST
);
...
...
@@ -293,7 +300,7 @@ void rtc_poweroff(void)
#endif
}
#if defined(CPU_FAM_STM32F0)
#if defined(CPU_FAM_STM32F0)
|| defined(CPU_FAM_STM32L0)
void
isr_rtc
(
void
)
#else
void
isr_rtc_alarm
(
void
)
...
...
@@ -331,4 +338,5 @@ static uint8_t byte2bcd(uint8_t value)
#endif
/* defined(CPU_FAM_STM32F0) || defined(CPU_FAM_STM32F2) || \
defined(CPU_FAM_STM32F3) || defined(CPU_FAM_STM32F4) || \
defined(CPU_FAM_STM32F7) || defined(CPU_FAM_STM32L1) */
defined(CPU_FAM_STM32F7) || defined(CPU_FAM_STM32L0) || \
defined(CPU_FAM_STM32L1) */
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