mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-02 14:13:42 -04:00
72cd5ef185
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.
16 lines
238 B
C++
16 lines
238 B
C++
#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);
|
|
}
|
|
|
|
}
|