This website works better with JavaScript.
Explore
Help
Register
Sign In
zrzk
/
zr-v4
Watch
1
Star
0
Fork
You've already forked zr-v4
0
Code
Issues
Pull Requests
Projects
Releases
Wiki
Activity
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19358
Commits
10
Branches
0
Tags
227 MiB
Tree:
8db8b9b355
c415-sdk
celiu-4.0
celiu-4.0.17-rc8
master
mission-4.1.18
zr-sdk-4.1.16
zr-sdk-4.3.1
zr-v4.1.17
zr-v5.0
zr-v5.1
Branches
Tags
${ item.name }
Create tag
${ searchTerm }
Create branch
${ searchTerm }
from '8db8b9b355'
${ noResults }
zr-v4
/
libraries
/
AP_HAL_FLYMAPLE
/
system.cpp
10 lines
87 B
Raw
Normal View
History
Unescape
Escape
AP_HAL: create AP_HAL namespace and use for some HAL functionality For certain basic functionality, there aren't much benefit to be able to vary the implementation easily at runtime. So instead of using virtual functions, use regular functions that are "resolved" at link time. The implementation of such functions is provided per board/platform. Examples of functions that fit this include: getting the current time (since boot), panic'ing, getting system information, rebooting. These functions are less likely to benefit from the indirection provided by virtual interfaces. For more complex hardware access APIs the indirection makes more sense and ease the testing (when we have it!). The idea is that instead of calling hal.scheduler->panic("on the streets of london"); now use AP_HAL::panic("on the streets of london"); A less important side-effect is that call-site code gets smaller. Currently the compiler needs to get the hal, get the scheduler pointer, get the right function pointer in the vtable for that scheduler. And the call must include an extra parameter ("this"). Now it will be just a function call, with the address resolved at link time. This patch introduces the first functions that will be in the namespace, further patches will implementations for each board and then switch the call-sites. The extra init() function allow any initial setup needed for the functions to work.
9 years ago
#
include
<AP_HAL/system.h>
namespace
AP_HAL
{
void
init
(
)
{
}
}
// namespace AP_HAL