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
65520865
Commit
65520865
authored
10 years ago
by
Hauke Petersen
Browse files
Options
Downloads
Patches
Plain Diff
cpu/stm32f1: adjusted to RTT interface changes
parent
636287a1
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cpu/stm32f1/periph/rtt.c
+30
-2
30 additions, 2 deletions
cpu/stm32f1/periph/rtt.c
with
30 additions
and
2 deletions
cpu/stm32f1/periph/rtt.c
+
30
−
2
View file @
65520865
...
@@ -42,9 +42,15 @@ inline void _rtt_leave_config_mode(void);
...
@@ -42,9 +42,15 @@ inline void _rtt_leave_config_mode(void);
/*
/*
* callback and argument for an active alarm
* callback and argument for an active alarm
*/
*/
static
rtt_
alarm_
cb_t
alarm_cb
;
static
rtt_cb_t
alarm_cb
;
static
void
*
alarm_arg
;
static
void
*
alarm_arg
;
/*
* callback and argument for overflow callback
*/
static
rtt_cb_t
overflow_cb
;
static
void
*
overflow_arg
;
void
rtt_init
(
void
)
void
rtt_init
(
void
)
{
{
rtt_poweron
();
rtt_poweron
();
...
@@ -69,6 +75,24 @@ void rtt_init(void)
...
@@ -69,6 +75,24 @@ void rtt_init(void)
_rtt_leave_config_mode
();
_rtt_leave_config_mode
();
}
}
void
rtt_set_overflow_cb
(
rtt_cb_t
cb
,
void
*
arg
)
{
overflow_cb
=
cb
;
overflow_arg
=
arg
;
_rtt_enter_config_mode
();
/* Enable overflow interrupt */
RTT_DEV
->
CRH
|=
RTC_CRH_OWIE
;
_rtt_leave_config_mode
();
}
void
rtt_clear_overflow_cb
(
void
)
{
_rtt_enter_config_mode
();
/* Clear overflow interrupt */
RTT_DEV
->
CRH
&=
~
(
RTC_CRH_OWIE
);
_rtt_leave_config_mode
();
}
uint32_t
rtt_get_counter
(
void
)
uint32_t
rtt_get_counter
(
void
)
{
{
/* wait for syncronization */
/* wait for syncronization */
...
@@ -97,7 +121,7 @@ uint32_t rtt_get_alarm(void)
...
@@ -97,7 +121,7 @@ uint32_t rtt_get_alarm(void)
return
(((
uint32_t
)
RTT_DEV
->
ALRH
<<
16
)
|
(
uint32_t
)(
RTT_DEV
->
ALRL
));
return
(((
uint32_t
)
RTT_DEV
->
ALRH
<<
16
)
|
(
uint32_t
)(
RTT_DEV
->
ALRL
));
}
}
void
rtt_set_alarm
(
uint32_t
alarm
,
rtt_
alarm_
cb_t
cb
,
void
*
arg
)
void
rtt_set_alarm
(
uint32_t
alarm
,
rtt_cb_t
cb
,
void
*
arg
)
{
{
_rtt_enter_config_mode
();
_rtt_enter_config_mode
();
...
@@ -169,6 +193,10 @@ void RTT_ISR(void)
...
@@ -169,6 +193,10 @@ void RTT_ISR(void)
RTT_DEV
->
CRL
&=
~
(
RTC_CRL_ALRF
);
RTT_DEV
->
CRL
&=
~
(
RTC_CRL_ALRF
);
alarm_cb
(
alarm_arg
);
alarm_cb
(
alarm_arg
);
}
}
if
(
RTT_DEV
->
CRL
&
RTC_CRL_OWF
)
{
RTT_DEV
->
CRL
&=
~
(
RTC_CRL_OWF
);
overflow_cb
(
overflow_arg
);
}
if
(
sched_context_switch_request
)
{
if
(
sched_context_switch_request
)
{
thread_yield
();
thread_yield
();
}
}
...
...
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