Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Firmware
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
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alberto Ruiz Garcia
Firmware
Commits
5aa91b6f
Commit
5aa91b6f
authored
12 years ago
by
Lorenz Meier
Browse files
Options
Downloads
Patches
Plain Diff
Updated MPU test to new driver model
parent
c6eff9eb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/px4/tests/test_sensors.c
+14
-14
14 additions, 14 deletions
apps/px4/tests/test_sensors.c
with
14 additions
and
14 deletions
apps/px4/tests/test_sensors.c
+
14
−
14
View file @
5aa91b6f
...
...
@@ -94,7 +94,7 @@ struct {
{
"bma180"
,
"/dev/bma180"
,
bma180
},
{
"hmc5883l"
,
"/dev/hmc5883l"
,
hmc5883l
},
{
"ms5611"
,
"/dev/ms5611"
,
ms5611
},
{
"mpu6000"
,
"/dev/
mpu6000
"
,
mpu6000
},
{
"mpu6000"
,
"/dev/
accel
"
,
mpu6000
},
// {"lis331", "/dev/lis331", lis331},
{
NULL
,
NULL
,
NULL
}
};
...
...
@@ -334,10 +334,10 @@ mpu6000(int argc, char *argv[])
int16_t
buf
[
6
]
=
{
-
1
,
0
,
-
1
,
0
,
-
1
,
0
};
int
ret
;
fd
=
open
(
"/dev/
mpu6000
"
,
O_RDONLY
);
fd
=
open
(
"/dev/
accel
"
,
O_RDONLY
);
if
(
fd
<
0
)
{
printf
(
"
\t
MPU-6000: open fail
\n
"
);
printf
(
"
\t
MPU-6000: open fail
, run <mpu6000 start> first.
\n
"
);
return
ERROR
;
}
...
...
@@ -347,26 +347,26 @@ mpu6000(int argc, char *argv[])
/* read data - expect samples */
ret
=
read
(
fd
,
buf
,
sizeof
(
buf
));
if
(
ret
!=
sizeof
(
buf
)
)
{
if
(
ret
<
3
)
{
printf
(
"
\t
MPU-6000: read1 fail (%d)
\n
"
,
ret
);
return
ERROR
;
}
else
{
printf
(
"
\t
MPU-6000 values: acc: x:%d
\t
y:%d
\t
z:%d
\t
gyro: r:%d
\t
p:%d
\t
y:%d
\n
"
,
buf
[
0
],
buf
[
1
],
buf
[
2
],
buf
[
3
],
buf
[
4
],
buf
[
5
]);
printf
(
"
\t
MPU-6000 values: acc: x:%d
\t
y:%d
\t
z:%d
"
);
//
\tgyro: r:%d\tp:%d\ty:%d\n", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
}
/* wait at least 10ms, sensor should have data after no more than 2ms */
usleep
(
100000
);
//
/* wait at least 10ms, sensor should have data after no more than 2ms */
//
usleep(100000);
ret
=
read
(
fd
,
buf
,
sizeof
(
buf
));
//
ret = read(fd, buf, sizeof(buf));
if
(
ret
!=
sizeof
(
buf
))
{
printf
(
"
\t
MPU-6000: read2 fail (%d)
\n
"
,
ret
);
return
ERROR
;
//
if (ret != sizeof(buf)) {
//
printf("\tMPU-6000: read2 fail (%d)\n", ret);
//
return ERROR;
}
else
{
printf
(
"
\t
MPU-6000 values: acc: x:%d
\t
y:%d
\t
z:%d
\t
gyro: r:%d
\t
p:%d
\t
y:%d
\n
"
,
buf
[
0
],
buf
[
1
],
buf
[
2
],
buf
[
3
],
buf
[
4
],
buf
[
5
]);
}
//
} else {
//
printf("\tMPU-6000 values: acc: x:%d\ty:%d\tz:%d\tgyro: r:%d\tp:%d\ty:%d\n", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
//
}
/* XXX more tests here */
...
...
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