2012-12-14 21:55:38 -04:00
|
|
|
|
2015-08-11 03:28:43 -03:00
|
|
|
#include <AP_HAL/AP_HAL.h>
|
2012-12-19 02:02:57 -04:00
|
|
|
#if CONFIG_HAL_BOARD == HAL_BOARD_EMPTY
|
2012-12-14 21:55:38 -04:00
|
|
|
|
2015-10-19 11:25:59 -03:00
|
|
|
#include <assert.h>
|
|
|
|
|
2012-12-14 21:55:38 -04:00
|
|
|
#include "HAL_Empty_Class.h"
|
|
|
|
#include "AP_HAL_Empty_Private.h"
|
|
|
|
|
|
|
|
using namespace Empty;
|
|
|
|
|
2023-12-10 13:29:32 -04:00
|
|
|
static UARTDriver serial0Driver;
|
|
|
|
static UARTDriver serial1Driver;
|
|
|
|
static UARTDriver serial2Driver;
|
|
|
|
static UARTDriver serial3Driver;
|
2015-12-07 14:53:55 -04:00
|
|
|
static SPIDeviceManager spiDeviceManager;
|
|
|
|
static AnalogIn analogIn;
|
|
|
|
static Storage storageDriver;
|
|
|
|
static GPIO gpioDriver;
|
|
|
|
static RCInput rcinDriver;
|
|
|
|
static RCOutput rcoutDriver;
|
|
|
|
static Scheduler schedulerInstance;
|
|
|
|
static Util utilInstance;
|
2015-11-23 14:58:14 -04:00
|
|
|
static OpticalFlow opticalFlowDriver;
|
2019-03-25 21:14:05 -03:00
|
|
|
static Flash flashDriver;
|
2012-12-14 21:55:38 -04:00
|
|
|
|
|
|
|
HAL_Empty::HAL_Empty() :
|
|
|
|
AP_HAL::HAL(
|
2023-12-10 13:29:32 -04:00
|
|
|
&serial0Driver,
|
|
|
|
&serial1Driver,
|
|
|
|
&serial2Driver,
|
|
|
|
&serial3Driver,
|
|
|
|
nullptr, /* no SERIAL4 */
|
|
|
|
nullptr, /* no SERIAL5 */
|
|
|
|
nullptr, /* no SERIAL6 */
|
|
|
|
nullptr, /* no SERIAL7 */
|
|
|
|
nullptr, /* no SERIAL8 */
|
|
|
|
nullptr, /* no SERIAL9 */
|
2012-12-14 21:55:38 -04:00
|
|
|
&spiDeviceManager,
|
|
|
|
&analogIn,
|
|
|
|
&storageDriver,
|
2023-12-10 13:29:32 -04:00
|
|
|
&serial0Driver,
|
2012-12-14 21:55:38 -04:00
|
|
|
&gpioDriver,
|
|
|
|
&rcinDriver,
|
|
|
|
&rcoutDriver,
|
2012-12-18 21:12:41 -04:00
|
|
|
&schedulerInstance,
|
2015-11-23 14:58:14 -04:00
|
|
|
&utilInstance,
|
2019-03-25 21:14:05 -03:00
|
|
|
&opticalFlowDriver,
|
2019-08-09 13:05:19 -03:00
|
|
|
&flashDriver,
|
|
|
|
nullptr) /* no DSP */
|
2012-12-14 21:55:38 -04:00
|
|
|
{}
|
|
|
|
|
2015-10-19 12:52:17 -03:00
|
|
|
void HAL_Empty::run(int argc, char* const argv[], Callbacks* callbacks) const
|
|
|
|
{
|
2012-12-17 15:54:55 -04:00
|
|
|
/* initialize all drivers and private members here.
|
|
|
|
* up to the programmer to do this in the correct order.
|
|
|
|
* Scheduler should likely come first. */
|
2015-12-02 11:14:20 -04:00
|
|
|
scheduler->init();
|
2020-12-10 21:15:28 -04:00
|
|
|
serial(0)->begin(115200);
|
2012-12-17 15:54:55 -04:00
|
|
|
_member->init();
|
2015-10-19 11:25:59 -03:00
|
|
|
|
|
|
|
callbacks->setup();
|
2020-12-23 07:27:56 -04:00
|
|
|
scheduler->set_system_initialized();
|
2015-10-19 11:25:59 -03:00
|
|
|
|
|
|
|
for (;;) {
|
|
|
|
callbacks->loop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-23 21:56:23 -04:00
|
|
|
static HAL_Empty hal_empty;
|
|
|
|
|
2015-10-16 17:22:11 -03:00
|
|
|
const AP_HAL::HAL& AP_HAL::get_HAL() {
|
2023-11-23 21:56:23 -04:00
|
|
|
return hal_empty;
|
|
|
|
}
|
|
|
|
|
|
|
|
AP_HAL::HAL& AP_HAL::get_HAL_mutable() {
|
|
|
|
return hal_empty;
|
2015-10-16 17:22:11 -03:00
|
|
|
}
|
2012-12-14 21:55:38 -04:00
|
|
|
|
2012-12-19 02:02:57 -04:00
|
|
|
#endif
|