mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-26 17:53:59 -04:00
AP_HAL_Empty: implement HAL::run()
This commit is contained in:
parent
72cd5ef185
commit
346ab77c27
@ -6,11 +6,9 @@
|
|||||||
#if CONFIG_HAL_BOARD == HAL_BOARD_EMPTY
|
#if CONFIG_HAL_BOARD == HAL_BOARD_EMPTY
|
||||||
#define AP_HAL_MAIN() extern "C" {\
|
#define AP_HAL_MAIN() extern "C" {\
|
||||||
int main (void) {\
|
int main (void) {\
|
||||||
hal.init(0, NULL); \
|
AP_HAL::HAL::FunCallbacks callbacks(setup, loop); \
|
||||||
setup();\
|
hal.run(0, NULL, &callbacks); \
|
||||||
hal.scheduler->system_initialized(); \
|
return 0; \
|
||||||
for(;;) loop();\
|
|
||||||
return 0;\
|
|
||||||
}\
|
}\
|
||||||
}
|
}
|
||||||
#endif // HAL_BOARD_EMPTY
|
#endif // HAL_BOARD_EMPTY
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
#include <AP_HAL/AP_HAL.h>
|
#include <AP_HAL/AP_HAL.h>
|
||||||
#if CONFIG_HAL_BOARD == HAL_BOARD_EMPTY
|
#if CONFIG_HAL_BOARD == HAL_BOARD_EMPTY
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#include "HAL_Empty_Class.h"
|
#include "HAL_Empty_Class.h"
|
||||||
#include "AP_HAL_Empty_Private.h"
|
#include "AP_HAL_Empty_Private.h"
|
||||||
|
|
||||||
@ -52,6 +54,20 @@ void HAL_Empty::init(int argc,char* const argv[]) const {
|
|||||||
_member->init();
|
_member->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HAL_Empty::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() {
|
const AP_HAL::HAL& AP_HAL::get_HAL() {
|
||||||
static const HAL_Empty hal;
|
static const HAL_Empty hal;
|
||||||
return hal;
|
return hal;
|
||||||
|
@ -11,6 +11,7 @@ class HAL_Empty : public AP_HAL::HAL {
|
|||||||
public:
|
public:
|
||||||
HAL_Empty();
|
HAL_Empty();
|
||||||
void init(int argc, char * const * argv) const;
|
void init(int argc, char * const * argv) const;
|
||||||
|
void run(int argc, char* const* argv, Callbacks* callbacks) const override;
|
||||||
private:
|
private:
|
||||||
Empty::EmptyPrivateMember *_member;
|
Empty::EmptyPrivateMember *_member;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user