Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
Ardupilot
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
Ardupilot
Commits
443023bb
Commit
443023bb
authored
11 years ago
by
Randy Mackay
Browse files
Options
Downloads
Patches
Plain Diff
AP_HAL: add ignore_errors to I2C driver
parent
bbc4cb26
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
libraries/AP_HAL/I2CDriver.h
+3
-0
3 additions, 0 deletions
libraries/AP_HAL/I2CDriver.h
libraries/AP_HAL_AVR/I2CDriver.cpp
+3
-1
3 additions, 1 deletion
libraries/AP_HAL_AVR/I2CDriver.cpp
libraries/AP_HAL_FLYMAPLE/I2CDriver.cpp
+6
-5
6 additions, 5 deletions
libraries/AP_HAL_FLYMAPLE/I2CDriver.cpp
with
12 additions
and
6 deletions
libraries/AP_HAL/I2CDriver.h
+
3
−
0
View file @
443023bb
...
...
@@ -32,7 +32,10 @@ public:
uint8_t
len
,
uint8_t
*
data
)
=
0
;
virtual
uint8_t
lockup_count
()
=
0
;
void
ignore_errors
(
bool
b
)
{
_ignore_errors
=
b
;
}
virtual
AP_HAL
::
Semaphore
*
get_semaphore
()
=
0
;
protected
:
bool
_ignore_errors
;
};
#endif // __AP_HAL_I2C_DRIVER_H__
...
...
This diff is collapsed.
Click to expand it.
libraries/AP_HAL_AVR/I2CDriver.cpp
+
3
−
1
View file @
443023bb
...
...
@@ -133,7 +133,9 @@ uint8_t AVRI2CDriver::writeRegisters(uint8_t addr, uint8_t reg,
if
(
stat
)
goto
error
;
return
stat
;
error
:
_lockup_count
++
;
if
(
!
_ignore_errors
)
{
_lockup_count
++
;
}
return
stat
;
}
...
...
This diff is collapsed.
Click to expand it.
libraries/AP_HAL_FLYMAPLE/I2CDriver.cpp
+
6
−
5
View file @
443023bb
...
...
@@ -127,11 +127,12 @@ uint8_t FLYMAPLEI2CDriver::_transfer(i2c_msg *msgs, uint16 num)
// ALERT: patch to libmaple required for this to work else
// crashes next line due to a bug in latest git libmaple see http://forums.leaflabs.com/topic.php?id=13458
int32
result
=
i2c_master_xfer
(
I2C1
,
msgs
,
num
,
_timeout_ms
);
if
(
result
!=
0
)
{
// Some sort of I2C bus fault, or absent device, reinitialise the bus
_reset
();
_lockup_count
++
;
if
(
result
!=
0
)
{
// Some sort of I2C bus fault, or absent device, reinitialise the bus
_reset
();
if
(
!
_ignore_errors
)
{
_lockup_count
++
;
}
}
return
result
!=
0
;
}
...
...
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