2016-02-17 21:25:25 -04:00
|
|
|
#pragma once
|
2015-10-19 15:01:24 -03:00
|
|
|
|
|
|
|
#include "HAL.h"
|
|
|
|
|
2015-12-29 03:52:17 -04:00
|
|
|
#if CONFIG_HAL_BOARD == HAL_BOARD_FLYMAPLE
|
2015-10-19 15:01:24 -03:00
|
|
|
#define CONFIG_MAIN_WITHOUT_ARGC_ARGV 1
|
2016-01-20 20:44:46 -04:00
|
|
|
#else
|
|
|
|
#define CONFIG_MAIN_WITHOUT_ARGC_ARGV 0
|
2015-10-19 15:01:24 -03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4 || CONFIG_HAL_BOARD == HAL_BOARD_VRBRAIN
|
|
|
|
#define AP_MAIN __EXPORT ArduPilot_main
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef AP_MAIN
|
|
|
|
#define AP_MAIN main
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if CONFIG_MAIN_WITHOUT_ARGC_ARGV
|
|
|
|
|
|
|
|
#define AP_HAL_MAIN() extern "C" { \
|
2015-10-22 15:34:00 -03:00
|
|
|
int AP_MAIN(void); \
|
2015-10-19 15:01:24 -03:00
|
|
|
int AP_MAIN(void) { \
|
2015-03-24 20:28:26 -03:00
|
|
|
AP_HAL::HAL::FunCallbacks callbacks(setup, loop); \
|
2015-10-19 15:01:24 -03:00
|
|
|
hal.run(0, NULL, &callbacks); \
|
|
|
|
return 0; \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
2015-10-19 15:05:54 -03:00
|
|
|
#define AP_HAL_MAIN_CALLBACKS(CALLBACKS) extern "C" { \
|
2015-10-22 15:34:00 -03:00
|
|
|
int AP_MAIN(void); \
|
2015-10-19 15:05:54 -03:00
|
|
|
int AP_MAIN(void) { \
|
|
|
|
hal.run(0, NULL, CALLBACKS); \
|
|
|
|
return 0; \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
2015-10-19 15:01:24 -03:00
|
|
|
#else
|
|
|
|
|
2016-04-27 01:21:28 -03:00
|
|
|
#define AP_HAL_MAIN() \
|
|
|
|
AP_HAL::HAL::FunCallbacks callbacks(setup, loop); \
|
|
|
|
extern "C" { \
|
2015-10-22 15:34:00 -03:00
|
|
|
int AP_MAIN(int argc, char* const argv[]); \
|
2015-10-19 15:01:24 -03:00
|
|
|
int AP_MAIN(int argc, char* const argv[]) { \
|
|
|
|
hal.run(argc, argv, &callbacks); \
|
|
|
|
return 0; \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
2015-10-19 15:05:54 -03:00
|
|
|
#define AP_HAL_MAIN_CALLBACKS(CALLBACKS) extern "C" { \
|
2015-10-22 15:34:00 -03:00
|
|
|
int AP_MAIN(int argc, char* const argv[]); \
|
2015-10-19 15:05:54 -03:00
|
|
|
int AP_MAIN(int argc, char* const argv[]) { \
|
|
|
|
hal.run(argc, argv, CALLBACKS); \
|
|
|
|
return 0; \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
2015-10-19 15:01:24 -03:00
|
|
|
#endif
|