mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-22 08:38:36 -04:00
AP_HAL: expose argc/argv in hal.init()
used for SITL port
This commit is contained in:
parent
ddafd4ffbb
commit
18824c7ef5
@ -42,7 +42,7 @@ public:
|
||||
scheduler(_scheduler)
|
||||
{}
|
||||
|
||||
virtual void init(void* opts) const = 0;
|
||||
virtual void init(int argc, const char *argv[]) const = 0;
|
||||
|
||||
AP_HAL::UARTDriver* uartA;
|
||||
AP_HAL::UARTDriver* uartB;
|
||||
|
@ -13,15 +13,16 @@
|
||||
* and not expose implementation details.
|
||||
*/
|
||||
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_APM1 || CONFIG_HAL_BOARD == HAL_BOARD_APM2
|
||||
#define AP_HAL_MAIN() extern "C" {\
|
||||
int main (void) {\
|
||||
hal.init(NULL);\
|
||||
hal.init(0, NULL); \
|
||||
setup();\
|
||||
for(;;) loop();\
|
||||
return 0;\
|
||||
}\
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // __AP_HAL_AVR_H__
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "HAL_AVR.h"
|
||||
using namespace AP_HAL_AVR;
|
||||
|
||||
void HAL_AVR::init(void* opts) const {
|
||||
void HAL_AVR::init(int argc, const char *argv[]) const {
|
||||
|
||||
scheduler->init((void*)&isr_registry);
|
||||
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
_console, _gpio, _rcin,
|
||||
_rcout, _scheduler) {}
|
||||
|
||||
void init(void* opts) const;
|
||||
void init(int argc, const char *argv[]) const;
|
||||
AP_HAL_AVR::ISRRegistry isr_registry;
|
||||
};
|
||||
#endif // __AP_HAL_AVR_HAL_AVR_H__
|
||||
|
@ -50,7 +50,7 @@ HAL_AVR_APM1::HAL_AVR_APM1() :
|
||||
&avrScheduler )
|
||||
{}
|
||||
|
||||
void HAL_AVR_APM1::init(void* opts) const {
|
||||
void HAL_AVR_APM1::init(int argc, const char *argv[]) const {
|
||||
|
||||
scheduler->init((void*)&isrRegistry);
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
class HAL_AVR_APM1 : public AP_HAL::HAL {
|
||||
public:
|
||||
HAL_AVR_APM1();
|
||||
void init(void* opts) const;
|
||||
void init(int argc, const char *argv[]) const;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -49,7 +49,7 @@ HAL_AVR_APM2::HAL_AVR_APM2() :
|
||||
&avrScheduler )
|
||||
{}
|
||||
|
||||
void HAL_AVR_APM2::init(void* opts) const {
|
||||
void HAL_AVR_APM2::init(int argc, const char *argv[]) const {
|
||||
|
||||
scheduler->init((void*)&isrRegistry);
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
class HAL_AVR_APM2 : public AP_HAL::HAL {
|
||||
public:
|
||||
HAL_AVR_APM2();
|
||||
void init(void* opts) const;
|
||||
void init(int argc, const char *argv[]) const;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -5,5 +5,16 @@
|
||||
#include "AP_HAL_AVR_SITL_Namespace.h"
|
||||
#include "HAL_AVR_SITL_Class.h"
|
||||
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_AVR_SITL
|
||||
#define AP_HAL_MAIN() extern "C" {\
|
||||
int main (int argc, const char *argv[]) { \
|
||||
hal.init(argc, argv); \
|
||||
setup();\
|
||||
for(;;) loop();\
|
||||
return 0;\
|
||||
}\
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __AP_HAL_AVR_SITL_H__
|
||||
|
||||
|
@ -38,7 +38,7 @@ HAL_AVR_SITL::HAL_AVR_SITL() :
|
||||
&sitlScheduler) /* scheduler */
|
||||
{}
|
||||
|
||||
void HAL_AVR_SITL::init(void* machtnichts) const {
|
||||
void HAL_AVR_SITL::init(int argc, const char *argv[]) const {
|
||||
|
||||
scheduler->init(NULL);
|
||||
uartA->begin(115200);
|
||||
|
@ -12,7 +12,7 @@
|
||||
class HAL_AVR_SITL : public AP_HAL::HAL {
|
||||
public:
|
||||
HAL_AVR_SITL();
|
||||
void init(void*) const;
|
||||
void init(int argc, const char *argv[]) const;
|
||||
};
|
||||
|
||||
extern const HAL_AVR_SITL AP_HAL_AVR_SITL;
|
||||
|
Loading…
Reference in New Issue
Block a user