ardupilot/libraries/AP_HAL_Empty/HAL_Empty_Class.cpp

73 lines
1.7 KiB
C++
Raw Normal View History

#include <AP_HAL/AP_HAL.h>
#if CONFIG_HAL_BOARD == HAL_BOARD_EMPTY
2015-10-19 11:25:59 -03:00
#include <assert.h>
#include "HAL_Empty_Class.h"
#include "AP_HAL_Empty_Private.h"
using namespace Empty;
static EmptyUARTDriver uartADriver;
static EmptyUARTDriver uartBDriver;
static EmptyUARTDriver uartCDriver;
static EmptySemaphore i2cSemaphore;
static EmptyI2CDriver i2cDriver(&i2cSemaphore);
static EmptySPIDeviceManager spiDeviceManager;
static EmptyAnalogIn analogIn;
static EmptyStorage storageDriver;
static EmptyGPIO gpioDriver;
static EmptyRCInput rcinDriver;
static EmptyRCOutput rcoutDriver;
2012-12-17 15:54:55 -04:00
static EmptyScheduler schedulerInstance;
2012-12-18 21:12:41 -04:00
static EmptyUtil utilInstance;
HAL_Empty::HAL_Empty() :
AP_HAL::HAL(
&uartADriver,
&uartBDriver,
&uartCDriver,
2013-11-22 04:16:14 -04:00
NULL, /* no uartD */
2013-12-21 07:26:10 -04:00
NULL, /* no uartE */
&i2cDriver,
NULL, /* only one i2c */
NULL, /* only one i2c */
&spiDeviceManager,
&analogIn,
&storageDriver,
2013-10-05 05:32:35 -03:00
&uartADriver,
&gpioDriver,
&rcinDriver,
&rcoutDriver,
2012-12-18 21:12:41 -04:00
&schedulerInstance,
&utilInstance),
2012-12-17 15:54:55 -04:00
_member(new EmptyPrivateMember(123))
{}
2015-10-19 12:52:17 -03:00
void HAL_Empty::run(int argc, char* const argv[], Callbacks* callbacks) const
{
assert(callbacks);
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. */
scheduler->init(NULL);
uartA->begin(115200);
_member->init();
2015-10-19 11:25:59 -03:00
callbacks->setup();
scheduler->system_initialized();
for (;;) {
callbacks->loop();
}
}
const AP_HAL::HAL& AP_HAL::get_HAL() {
static const HAL_Empty hal;
return hal;
}
#endif