AP_HAL_SITL: implement HAL::run()
This commit is contained in:
parent
346ab77c27
commit
c6292ff097
@ -4,14 +4,10 @@
|
||||
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
|
||||
#define AP_HAL_MAIN() extern "C" {\
|
||||
int main (int argc, char * const argv[]) { \
|
||||
hal.init(argc, argv); \
|
||||
setup(); \
|
||||
hal.scheduler->system_initialized(); \
|
||||
for(;;) { \
|
||||
loop(); \
|
||||
} \
|
||||
return 0;\
|
||||
int main (int argc, char * const argv[]) { \
|
||||
AP_HAL::HAL::FunCallbacks callbacks(setup, loop); \
|
||||
hal.run(argc, argv, &callbacks); \
|
||||
return 0; \
|
||||
}\
|
||||
}
|
||||
#endif
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "AP_HAL_SITL.h"
|
||||
#include "AP_HAL_SITL_Namespace.h"
|
||||
#include "HAL_SITL_Class.h"
|
||||
@ -79,6 +81,20 @@ void HAL_SITL::init(int argc, char * const argv[]) const
|
||||
analogin->init(NULL);
|
||||
}
|
||||
|
||||
void HAL_SITL::run(int argc, char * const argv[], Callbacks* callbacks) const
|
||||
{
|
||||
assert(callbacks);
|
||||
|
||||
init(argc, argv);
|
||||
|
||||
callbacks->setup();
|
||||
scheduler->system_initialized();
|
||||
|
||||
for (;;) {
|
||||
callbacks->loop();
|
||||
}
|
||||
}
|
||||
|
||||
const AP_HAL::HAL& AP_HAL::get_HAL() {
|
||||
static const HAL_SITL hal;
|
||||
return hal;
|
||||
|
@ -14,6 +14,7 @@ class HAL_SITL : public AP_HAL::HAL {
|
||||
public:
|
||||
HAL_SITL();
|
||||
void init(int argc, char * const argv[]) const;
|
||||
void run(int argc, char * const argv[], Callbacks* callbacks) const override;
|
||||
|
||||
private:
|
||||
HALSITL::SITL_State *_sitl_state;
|
||||
|
Loading…
Reference in New Issue
Block a user