Browse Source

AP_HAL_VRBRAIN: implement HAL::run()

master
Caio Marcelo de Oliveira Filho 9 years ago committed by Andrew Tridgell
parent
commit
fe1dd1be25
  1. 3
      libraries/AP_HAL_VRBRAIN/AP_HAL_VRBRAIN_Main.h
  2. 9
      libraries/AP_HAL_VRBRAIN/HAL_VRBRAIN_Class.cpp
  3. 1
      libraries/AP_HAL_VRBRAIN/HAL_VRBRAIN_Class.h

3
libraries/AP_HAL_VRBRAIN/AP_HAL_VRBRAIN_Main.h

@ -6,7 +6,8 @@ @@ -6,7 +6,8 @@
#define AP_HAL_MAIN() \
extern "C" __EXPORT int SKETCH_MAIN(int argc, char * const argv[]); \
int SKETCH_MAIN(int argc, char * const argv[]) { \
hal.init(argc, argv); \
AP_HAL::HAL::FunCallbacks callbacks(setup, loop); \
hal.run(argc, argv, &callbacks); \
return OK; \
}

9
libraries/AP_HAL_VRBRAIN/HAL_VRBRAIN_Class.cpp

@ -4,6 +4,8 @@ @@ -4,6 +4,8 @@
#if CONFIG_HAL_BOARD == HAL_BOARD_VRBRAIN
#include <assert.h>
#include "AP_HAL_VRBRAIN.h"
#include "AP_HAL_VRBRAIN_Namespace.h"
#include "HAL_VRBRAIN_Class.h"
@ -339,6 +341,13 @@ void HAL_VRBRAIN::init(int argc, char * const argv[]) const @@ -339,6 +341,13 @@ void HAL_VRBRAIN::init(int argc, char * const argv[]) const
exit(1);
}
void HAL_VRBRAIN::run(int argc, char * const argv[], Callbacks* callbacks) const
{
assert(callbacks);
g_callbacks = callbacks;
init(argc, argv);
}
const AP_HAL::HAL& AP_HAL::get_HAL() {
static const HAL_VRBRAIN hal_vrbrain;
return hal_vrbrain;

1
libraries/AP_HAL_VRBRAIN/HAL_VRBRAIN_Class.h

@ -15,6 +15,7 @@ class HAL_VRBRAIN : public AP_HAL::HAL { @@ -15,6 +15,7 @@ class HAL_VRBRAIN : public AP_HAL::HAL {
public:
HAL_VRBRAIN();
void init(int argc, char * const argv[]) const;
void run(int argc, char* const argv[], Callbacks* callbacks) const override;
};
extern const HAL_VRBRAIN AP_HAL_VRBRAIN;

Loading…
Cancel
Save