APM:Libraries
HAL_Empty_Class.cpp
Go to the documentation of this file.
1 
2 #include <AP_HAL/AP_HAL.h>
3 #if CONFIG_HAL_BOARD == HAL_BOARD_EMPTY
4 
5 #include <assert.h>
6 
7 #include "HAL_Empty_Class.h"
8 #include "AP_HAL_Empty_Private.h"
9 
10 using namespace Empty;
11 
24 
26  AP_HAL::HAL(
27  &uartADriver,
28  &uartBDriver,
29  &uartCDriver,
30  nullptr, /* no uartD */
31  nullptr, /* no uartE */
32  nullptr, /* no uartF */
33  &spiDeviceManager,
34  &analogIn,
35  &storageDriver,
36  &uartADriver,
37  &gpioDriver,
38  &rcinDriver,
39  &rcoutDriver,
40  &schedulerInstance,
41  &utilInstance,
42  &opticalFlowDriver),
43  _member(new EmptyPrivateMember(123))
44 {}
45 
46 void HAL_Empty::run(int argc, char* const argv[], Callbacks* callbacks) const
47 {
48  assert(callbacks);
49 
50  /* initialize all drivers and private members here.
51  * up to the programmer to do this in the correct order.
52  * Scheduler should likely come first. */
53  scheduler->init();
54  uartA->begin(115200);
55  _member->init();
56 
57  callbacks->setup();
59 
60  for (;;) {
61  callbacks->loop();
62  }
63 }
64 
66  static const HAL_Empty hal;
67  return hal;
68 }
69 
70 #endif
virtual void setup()=0
static AnalogIn analogIn
virtual void loop()=0
static RCInput rcinDriver
static GPIO gpioDriver
virtual void begin(uint32_t baud)=0
static OpticalFlow opticalFlowDriver
static Scheduler schedulerInstance
static Util utilInstance
const AP_HAL::HAL & hal
Definition: UARTDriver.cpp:37
static RCOutput rcoutDriver
static UARTDriver uartBDriver
Empty::PrivateMember * _member
virtual void init()=0
static Storage storageDriver
static UARTDriver uartADriver
const HAL & get_HAL()
static SPIDeviceManager spiDeviceManager
AP_HAL::UARTDriver * uartA
Definition: HAL.h:100
static UARTDriver uartCDriver
void run(int argc, char *const *argv, Callbacks *callbacks) const override
AP_HAL::Scheduler * scheduler
Definition: HAL.h:114
virtual void system_initialized()=0