Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
Baitboat
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenSource
Baitboat
Commits
6444b0bd
Commit
6444b0bd
authored
11 years ago
by
Andrew Tridgell
Browse files
Options
Downloads
Patches
Plain Diff
AP_InertialSensor_L3G4200D: a sample is only available if gyro had a sample
parent
eef966c5
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
libraries/AP_InertialSensor/AP_InertialSensor_L3G4200D.cpp
+13
-9
13 additions, 9 deletions
libraries/AP_InertialSensor/AP_InertialSensor_L3G4200D.cpp
with
13 additions
and
9 deletions
libraries/AP_InertialSensor/AP_InertialSensor_L3G4200D.cpp
+
13
−
9
View file @
6444b0bd
...
@@ -324,18 +324,22 @@ void AP_InertialSensor_L3G4200D::_accumulate(void)
...
@@ -324,18 +324,22 @@ void AP_InertialSensor_L3G4200D::_accumulate(void)
num_samples_available
=
fifo_status
&
L3G4200D_REG_FIFO_SRC_ENTRIES_MASK
;
num_samples_available
=
fifo_status
&
L3G4200D_REG_FIFO_SRC_ENTRIES_MASK
;
}
}
// read all the entries in one go, using AUTO_INCREMENT. This saves a lot of time on I2C setup
if
(
num_samples_available
>
0
)
{
int16_t
buffer
[
num_samples_available
][
3
];
// read all the entries in one go, using AUTO_INCREMENT. This saves a lot of time on I2C setup
if
(
hal
.
i2c
->
readRegisters
(
L3G4200D_I2C_ADDRESS
,
L3G4200D_REG_XL
|
L3G4200D_REG_AUTO_INCREMENT
,
int16_t
buffer
[
num_samples_available
][
3
];
sizeof
(
buffer
),
(
uint8_t
*
)
&
buffer
[
0
][
0
])
==
0
)
{
if
(
hal
.
i2c
->
readRegisters
(
L3G4200D_I2C_ADDRESS
,
L3G4200D_REG_XL
|
L3G4200D_REG_AUTO_INCREMENT
,
for
(
uint8_t
i
=
0
;
i
<
num_samples_available
;
i
++
)
{
sizeof
(
buffer
),
(
uint8_t
*
)
&
buffer
[
0
][
0
])
==
0
)
{
_gyro_filtered
=
Vector3f
(
_gyro_filter_x
.
apply
(
buffer
[
i
][
0
]),
for
(
uint8_t
i
=
0
;
i
<
num_samples_available
;
i
++
)
{
_gyro_filter_y
.
apply
(
-
buffer
[
i
][
1
]),
_gyro_filtered
=
Vector3f
(
_gyro_filter_x
.
apply
(
buffer
[
i
][
0
]),
_gyro_filter_z
.
apply
(
-
buffer
[
i
][
2
]));
_gyro_filter_y
.
apply
(
-
buffer
[
i
][
1
]),
_gyro_filter_z
.
apply
(
-
buffer
[
i
][
2
]));
}
}
}
}
}
_sample_available
=
true
;
if
(
num_samples_available
>
0
)
{
_sample_available
=
true
;
}
// give back i2c semaphore
// give back i2c semaphore
i2c_sem
->
give
();
i2c_sem
->
give
();
...
...
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