Browse Source

AP_HAL_Empty: implement HAL::run()

mission-4.1.18
Caio Marcelo de Oliveira Filho 9 years ago committed by Andrew Tridgell
parent
commit
346ab77c27
  1. 8
      libraries/AP_HAL_Empty/AP_HAL_Empty_Main.h
  2. 16
      libraries/AP_HAL_Empty/HAL_Empty_Class.cpp
  3. 1
      libraries/AP_HAL_Empty/HAL_Empty_Class.h

8
libraries/AP_HAL_Empty/AP_HAL_Empty_Main.h

@ -6,11 +6,9 @@ @@ -6,11 +6,9 @@
#if CONFIG_HAL_BOARD == HAL_BOARD_EMPTY
#define AP_HAL_MAIN() extern "C" {\
int main (void) {\
hal.init(0, NULL); \
setup();\
hal.scheduler->system_initialized(); \
for(;;) loop();\
return 0;\
AP_HAL::HAL::FunCallbacks callbacks(setup, loop); \
hal.run(0, NULL, &callbacks); \
return 0; \
}\
}
#endif // HAL_BOARD_EMPTY

16
libraries/AP_HAL_Empty/HAL_Empty_Class.cpp

@ -2,6 +2,8 @@ @@ -2,6 +2,8 @@
#include <AP_HAL/AP_HAL.h>
#if CONFIG_HAL_BOARD == HAL_BOARD_EMPTY
#include <assert.h>
#include "HAL_Empty_Class.h"
#include "AP_HAL_Empty_Private.h"
@ -52,6 +54,20 @@ void HAL_Empty::init(int argc,char* const argv[]) const { @@ -52,6 +54,20 @@ void HAL_Empty::init(int argc,char* const argv[]) const {
_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() {
static const HAL_Empty hal;
return hal;

1
libraries/AP_HAL_Empty/HAL_Empty_Class.h

@ -11,6 +11,7 @@ class HAL_Empty : public AP_HAL::HAL { @@ -11,6 +11,7 @@ class HAL_Empty : public AP_HAL::HAL {
public:
HAL_Empty();
void init(int argc, char * const * argv) const;
void run(int argc, char* const* argv, Callbacks* callbacks) const override;
private:
Empty::EmptyPrivateMember *_member;
};

Loading…
Cancel
Save