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
bf3ce68a
Unverified
Commit
bf3ce68a
authored
6 years ago
by
Andreas "Paul" Pauli
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #9025 from Josar/pr/timer_debug_pin
atmega timer: Interrupt Pin
parents
0d3af492
d6c0398f
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/atmega_common/periph/timer.c
+23
-0
23 additions, 0 deletions
cpu/atmega_common/periph/timer.c
with
23 additions
and
0 deletions
cpu/atmega_common/periph/timer.c
+
23
−
0
View file @
bf3ce68a
...
...
@@ -83,6 +83,21 @@ static ctx_t ctx[] = {
*/
int
timer_init
(
tim_t
tim
,
unsigned
long
freq
,
timer_cb_t
cb
,
void
*
arg
)
{
/*
* A debug pin can be used to probe timer interrupts with an oscilloscope or
* other time measurement equipment. Thus, determine when an interrupt occurs
* and how long the timer ISR takes.
* The pin should be defined in the makefile as follows:
* CFLAGS += -DDEBUG_TIMER_PORT=PORTF -DDEBUG_TIMER_DDR=DDRF \
* -DDEBUG_TIMER_PIN=PORTF4
*/
#if defined(DEBUG_TIMER_PORT)
DEBUG_TIMER_DDR
|=
(
1
<<
DEBUG_TIMER_PIN
);
DEBUG_TIMER_PORT
&=
~
(
1
<<
DEBUG_TIMER_PIN
);
DEBUG
(
"Debug Pin: DDR 0x%02x Port 0x%02x Pin 0x%02x
\n
"
,
&
DEBUG_TIMER_DDR
,
&
DEBUG_TIMER_PORT
,(
1
<<
DEBUG_TIMER_PIN
));
#endif
DEBUG
(
"timer.c: freq = %ld
\n
"
,
freq
);
uint8_t
pre
=
0
;
...
...
@@ -162,11 +177,19 @@ void timer_start(tim_t tim)
#ifdef TIMER_NUMOF
static
inline
void
_isr
(
tim_t
tim
,
int
chan
)
{
#if defined(DEBUG_TIMER_PORT)
DEBUG_TIMER_PORT
|=
(
1
<<
DEBUG_TIMER_PIN
);
#endif
__enter_isr
();
*
ctx
[
tim
].
mask
&=
~
(
1
<<
(
chan
+
OCIE1A
));
ctx
[
tim
].
cb
(
ctx
[
tim
].
arg
,
chan
);
#if defined(DEBUG_TIMER_PORT)
DEBUG_TIMER_PORT
&=
~
(
1
<<
DEBUG_TIMER_PIN
);
#endif
__exit_isr
();
}
#endif
...
...
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