Browse Source
Add run method, that encapsulate any mainloop logic on behalf of the client code. The setup/loop functions are passed via a HAL::Callbacks interface. The AP_HAL_MAIN() macro should be kept as trivial as possible. This interface should be implemented by the existing vehicle objects. To make easy for the examples (that don't have the equivalent of vehicle objects), a FunCallbacks was added to bridge to the functions directly.master
2 changed files with 34 additions and 0 deletions
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
#include <assert.h> |
||||
|
||||
#include "HAL.h" |
||||
|
||||
namespace AP_HAL { |
||||
|
||||
HAL::FunCallbacks::FunCallbacks(void (*setup_fun)(void), void (*loop_fun)(void)) |
||||
: _setup(setup_fun) |
||||
, _loop(loop_fun) |
||||
{ |
||||
assert(setup_fun); |
||||
assert(loop_fun); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue