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
002985db
Commit
002985db
authored
9 years ago
by
Hauke Petersen
Browse files
Options
Downloads
Patches
Plain Diff
s test/main: changed num from int to unsigned
parent
8739a2a3
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
tests/periph_timer/main.c
+8
-8
8 additions, 8 deletions
tests/periph_timer/main.c
with
8 additions
and
8 deletions
tests/periph_timer/main.c
+
8
−
8
View file @
002985db
...
@@ -45,7 +45,7 @@ static void cb(int chan)
...
@@ -45,7 +45,7 @@ static void cb(int chan)
fired
++
;
fired
++
;
}
}
static
int
test_timer
(
int
num
)
static
int
test_timer
(
unsigned
num
)
{
{
int
set
=
0
;
int
set
=
0
;
...
@@ -58,14 +58,14 @@ static int test_timer(int num)
...
@@ -58,14 +58,14 @@ static int test_timer(int num)
/* initialize and halt timer */
/* initialize and halt timer */
if
(
timer_init
(
TIMER_DEV
(
num
),
TIM_SPEED
,
cb
)
<
0
)
{
if
(
timer_init
(
TIMER_DEV
(
num
),
TIM_SPEED
,
cb
)
<
0
)
{
printf
(
"TIMER_%
i
: ERROR on initialization - skipping
\n\n
"
,
num
);
printf
(
"TIMER_%
u
: ERROR on initialization - skipping
\n\n
"
,
num
);
return
0
;
return
0
;
}
}
else
{
else
{
printf
(
"TIMER_%
i
: initialization successful
\n
"
,
num
);
printf
(
"TIMER_%
u
: initialization successful
\n
"
,
num
);
}
}
timer_stop
(
TIMER_DEV
(
num
));
timer_stop
(
TIMER_DEV
(
num
));
printf
(
"TIMER_%
i
: stopped
\n
"
,
num
);
printf
(
"TIMER_%
u
: stopped
\n
"
,
num
);
/* set each available channel */
/* set each available channel */
for
(
unsigned
i
=
0
;
i
<
MAX_CHANNELS
;
i
++
)
{
for
(
unsigned
i
=
0
;
i
<
MAX_CHANNELS
;
i
++
)
{
unsigned
timeout
=
((
i
+
1
)
*
CHAN_OFFSET
);
unsigned
timeout
=
((
i
+
1
)
*
CHAN_OFFSET
);
...
@@ -74,15 +74,15 @@ static int test_timer(int num)
...
@@ -74,15 +74,15 @@ static int test_timer(int num)
}
}
else
{
else
{
++
set
;
++
set
;
printf
(
"TIMER_%
i
: set channel %u to %u
\n
"
,
num
,
i
,
timeout
);
printf
(
"TIMER_%
u
: set channel %u to %u
\n
"
,
num
,
i
,
timeout
);
}
}
}
}
if
(
set
==
0
)
{
if
(
set
==
0
)
{
printf
(
"TIMER_%
i
: ERROR setting any channel
\n\n
"
,
num
);
printf
(
"TIMER_%
u
: ERROR setting any channel
\n\n
"
,
num
);
return
0
;
return
0
;
}
}
/* start the timer */
/* start the timer */
printf
(
"TIMER_%
i
: starting
\n
"
,
num
);
printf
(
"TIMER_%
u
: starting
\n
"
,
num
);
timer_start
(
TIMER_DEV
(
num
));
timer_start
(
TIMER_DEV
(
num
));
/* wait for all channels to fire */
/* wait for all channels to fire */
do
{
do
{
...
@@ -90,7 +90,7 @@ static int test_timer(int num)
...
@@ -90,7 +90,7 @@ static int test_timer(int num)
}
while
(
fired
!=
set
);
}
while
(
fired
!=
set
);
/* collect results */
/* collect results */
for
(
int
i
=
0
;
i
<
fired
;
i
++
)
{
for
(
int
i
=
0
;
i
<
fired
;
i
++
)
{
printf
(
"TIMER_%
i
: channel %i fired at SW count %8u"
,
printf
(
"TIMER_%
u
: channel %i fired at SW count %8u"
,
num
,
i
,
(
unsigned
)
timeouts
[
i
]);
num
,
i
,
(
unsigned
)
timeouts
[
i
]);
if
(
i
==
0
)
{
if
(
i
==
0
)
{
printf
(
" - init: %8u
\n
"
,
(
unsigned
)
timeouts
[
i
]);
printf
(
" - init: %8u
\n
"
,
(
unsigned
)
timeouts
[
i
]);
...
...
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