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
636287a1
Commit
636287a1
authored
10 years ago
by
Hauke Petersen
Browse files
Options
Downloads
Patches
Plain Diff
cpu/nrf51822: adjusted to RTT interface changes
parent
1ae08f84
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/nrf51822/periph/rtt.c
+34
-4
34 additions, 4 deletions
cpu/nrf51822/periph/rtt.c
with
34 additions
and
4 deletions
cpu/nrf51822/periph/rtt.c
+
34
−
4
View file @
636287a1
...
@@ -32,11 +32,25 @@
...
@@ -32,11 +32,25 @@
#if RTT_NUMOF
#if RTT_NUMOF
/*
/*
* callback and argument for an active alarm
* @brief Callback for the active alarm
*/
static
rtt_cb_t
alarm_cb
;
/**
* @brief Argument for the active alarm callback
*/
*/
static
rtt_alarm_cb_t
alarm_cb
;
static
void
*
alarm_arg
;
static
void
*
alarm_arg
;
/**
* @brief Callback for the overflow event
*/
static
rtt_cb_t
overflow_cb
;
/**
* @brief Argument for the overflow callback
*/
static
void
*
overflow_arg
;
void
rtt_init
(
void
)
void
rtt_init
(
void
)
{
{
rtt_poweron
();
rtt_poweron
();
...
@@ -55,6 +69,18 @@ void rtt_init(void)
...
@@ -55,6 +69,18 @@ void rtt_init(void)
RTT_DEV
->
TASKS_START
=
1
;
RTT_DEV
->
TASKS_START
=
1
;
}
}
void
rtt_set_overflow_cb
(
rtt_cb_t
cb
,
void
*
arg
)
{
overflow_cb
=
cb
;
overflow_arg
=
arg
;
RTT_DEV
->
INTENSET
=
RTC_INTENSET_OVRFLW_Msk
;
}
void
rtt_clear_overflow_cb
(
void
)
{
RTT_DEV
->
INTENCLR
=
RTC_INTENCLR_OVRFLW_Msk
;
}
uint32_t
rtt_get_counter
(
void
)
uint32_t
rtt_get_counter
(
void
)
{
{
return
RTT_DEV
->
COUNTER
;
return
RTT_DEV
->
COUNTER
;
...
@@ -65,7 +91,7 @@ void rtt_set_counter(uint32_t counter)
...
@@ -65,7 +91,7 @@ void rtt_set_counter(uint32_t counter)
/* not supported for the NRF51822? -> could not find out how to do this */
/* not supported for the NRF51822? -> could not find out how to do this */
}
}
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
)
{
{
alarm_cb
=
cb
;
alarm_cb
=
cb
;
alarm_arg
=
arg
;
alarm_arg
=
arg
;
...
@@ -95,11 +121,15 @@ void rtt_poweroff(void)
...
@@ -95,11 +121,15 @@ void rtt_poweroff(void)
void
RTT_ISR
(
void
)
void
RTT_ISR
(
void
)
{
{
if
(
RTT_DEV
->
EVENTS_COMPARE
[
0
]
==
1
)
{
if
(
RTT_DEV
->
EVENTS_COMPARE
[
0
]
==
1
)
{
RTT_DEV
->
EVENTS_COMPARE
[
0
]
=
0
;
RTT_DEV
->
EVENTS_COMPARE
[
0
]
=
0
;
RTT_DEV
->
INTENCLR
=
RTC_INTENSET_COMPARE0_Msk
;
RTT_DEV
->
INTENCLR
=
RTC_INTENSET_COMPARE0_Msk
;
alarm_cb
(
alarm_arg
);
alarm_cb
(
alarm_arg
);
}
}
if
(
RTT_DEV
->
EVENTS_OVRFLW
==
1
)
{
RTT_DEV
->
EVENTS_OVRFLW
=
0
;
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