Browse Source

AP_HAL: Stub implementations of pure virtual AP_HAL classes

mission-4.1.18
Pat Hickey 13 years ago committed by Andrew Tridgell
parent
commit
dc03b1190f
  1. 23
      libraries/AP_HAL/AP_HAL.h
  2. 40
      libraries/AP_HAL/AP_HAL_Namespace.h
  3. 14
      libraries/AP_HAL/AnalogIn.h
  4. 14
      libraries/AP_HAL/Console.h
  5. 13
      libraries/AP_HAL/GPIO.h
  6. 66
      libraries/AP_HAL/HAL.h
  7. 14
      libraries/AP_HAL/I2CDriver.h
  8. 14
      libraries/AP_HAL/Log.h
  9. 14
      libraries/AP_HAL/PPMInput.h
  10. 14
      libraries/AP_HAL/PWMOutput.h
  11. 14
      libraries/AP_HAL/SPIDriver.h
  12. 14
      libraries/AP_HAL/Storage.h
  13. 19
      libraries/AP_HAL/UARTDriver.h

23
libraries/AP_HAL/AP_HAL.h

@ -0,0 +1,23 @@
#ifndef __AP_HAL_H__
#define __AP_HAL_H__
#include "AP_HAL_Namespace.h"
/* HAL Module Classes (all pure virtual) */
#include "UARTDriver.h"
#include "I2CDriver.h"
#include "SPIDriver.h"
#include "AnalogIn.h"
#include "Storage.h"
#include "Log.h"
#include "Console.h"
#include "GPIO.h"
#include "PPMInput.h"
#include "PWMOutput.h"
/* HAL Class definition */
#include "HAL.h"
#endif // __AP_HAL_H__

40
libraries/AP_HAL/AP_HAL_Namespace.h

@ -0,0 +1,40 @@
#ifndef __AP_HAL_NAMESPACE_H__
#define __AP_HAL_NAMESPACE_H__
namespace AP_HAL {
/* Toplevel pure virtual class Hal.*/
class HAL;
/* Toplevel class names for drivers: */
class UARTDriver;
class I2CDriver;
class SPIDriver;
class AnalogIn;
class Storage;
class Log;
class Console;
class GPIO;
class PPMInput;
class PWMOutput;
/* AVR / Arduino Implementations for APM1 and APM2 */
class AVRUARTDriver;
class AVRI2CDriver;
class ArduinoSPIDriver;
class ArduinoAnalogIn;
class AVREEPROMStorage;
class DataFlashAPM1Log;
class DataFlashAPM2Log;
class AVRUARTConsole;
class ArduinoGPIO;
class APM1PPMInput;
class APM2PPMInput;
class APM1PWMOutput;
class APM2PWMOutput;
}
#endif // __AP_HAL_NAMESPACE_H__

14
libraries/AP_HAL/AnalogIn.h

@ -0,0 +1,14 @@
#ifndef __AP_HAL_ANALOG_IN_H__
#define __AP_HAL_ANALOG_IN_H__
#include "AP_HAL_Namespace.h"
class AP_HAL::AnalogIn {
public:
AnalogIn() {}
virtual void init(int machtnicht) = 0;
};
#endif // __AP_HAL_ANALOG_IN_H__

14
libraries/AP_HAL/Console.h

@ -0,0 +1,14 @@
#ifndef __AP_HAL_CONSOLE_H__
#define __AP_HAL_CONSOLE_H__
#include "AP_HAL_Namespace.h"
class AP_HAL::Console {
public:
Console() {}
virtual void init(int machtnicht) = 0;
};
#endif // __AP_HAL_CONSOLE_H__

13
libraries/AP_HAL/GPIO.h

@ -0,0 +1,13 @@
#ifndef __AP_HAL_GPIO_H__
#define __AP_HAL_GPIO_H__
#include "AP_HAL_Namespace.h"
class AP_HAL::GPIO {
public:
GPIO() {}
virtual void init(int machtnicht) = 0;
};
#endif // __AP_HAL_GPIO_H__

66
libraries/AP_HAL/HAL.h

@ -0,0 +1,66 @@
#ifndef __AP_HAL_HAL_H__
#define __AP_HAL_HAL_H__
#include "AP_HAL_Namespace.h"
#include "../AP_HAL/UARTDriver.h"
#include "../AP_HAL/SPIDriver.h"
#include "../AP_HAL/AnalogIn.h"
#include "../AP_HAL/Storage.h"
#include "../AP_HAL/Log.h"
#include "../AP_HAL/Console.h"
#include "../AP_HAL/GPIO.h"
#include "../AP_HAL/PPMInput.h"
#include "../AP_HAL/PWMOutput.h"
class AP_HAL::HAL {
public:
HAL(AP_HAL::UARTDriver* _uart0,
AP_HAL::UARTDriver* _uart1,
AP_HAL::UARTDriver* _uart2,
AP_HAL::UARTDriver* _uart3,
AP_HAL::I2CDriver* _i2c,
AP_HAL::SPIDriver* _spi,
AP_HAL::AnalogIn* _analogIn,
AP_HAL::Storage* _storage,
AP_HAL::Log* _log,
AP_HAL::Console* _console,
AP_HAL::GPIO* _gpio,
AP_HAL::PPMInput* _ppmin,
AP_HAL::PWMOutput* _pwmout)
:
uart0(_uart0),
uart1(_uart1),
uart2(_uart2),
uart3(_uart3),
i2c(_i2c),
spi(_spi),
analogIn(_analogIn),
storage(_storage),
log(_log),
console(_console),
gpio(_gpio),
ppmin(_ppmin),
pwmout(_pwmout)
{}
AP_HAL::UARTDriver* uart0;
AP_HAL::UARTDriver* uart1;
AP_HAL::UARTDriver* uart2;
AP_HAL::UARTDriver* uart3;
AP_HAL::I2CDriver* i2c;
AP_HAL::SPIDriver* spi;
AP_HAL::AnalogIn* analogIn;
AP_HAL::Storage* storage;
AP_HAL::Log* log;
AP_HAL::Console* console;
AP_HAL::GPIO* gpio;
AP_HAL::PPMInput* ppmin;
AP_HAL::PWMOutput* pwmout;
};
#endif // __AP_HAL_HAL_H__

14
libraries/AP_HAL/I2CDriver.h

@ -0,0 +1,14 @@
#ifndef __AP_HAL_I2C_DRIVER_H__
#define __AP_HAL_I2C_DRIVER_H__
#include "AP_HAL_Namespace.h"
class AP_HAL::I2CDriver {
public:
I2CDriver() {}
virtual void init() = 0;
};
#endif // __AP_HAL_I2C_DRIVER_H__

14
libraries/AP_HAL/Log.h

@ -0,0 +1,14 @@
#ifndef __AP_HAL_LOG_H__
#define __AP_HAL_LOG_H__
#include "AP_HAL_Namespace.h"
class AP_HAL::Log{
public:
Log() {}
virtual void init(int machtnicht) = 0;
};
#endif // __AP_HAL_LOG_H__

14
libraries/AP_HAL/PPMInput.h

@ -0,0 +1,14 @@
#ifndef __AP_HAL_PPM_INPUT_H__
#define __AP_HAL_PPM_INPUT_H__
#include "AP_HAL_Namespace.h"
class AP_HAL::PPMInput {
public:
PPMInput() {}
virtual void init(int machtnicht) = 0;
};
#endif // __AP_HAL_PPM_INPUT_H__

14
libraries/AP_HAL/PWMOutput.h

@ -0,0 +1,14 @@
#ifndef __AP_HAL_PWM_OUTPUT_H__
#define __AP_HAL_PWM_OUTPUT_H__
#include "AP_HAL_Namespace.h"
class AP_HAL::PWMOutput {
public:
PWMOutput() {}
virtual void init(int machtnicht) = 0;
};
#endif // __AP_HAL_PWM_OUTPUT_H__

14
libraries/AP_HAL/SPIDriver.h

@ -0,0 +1,14 @@
#ifndef __AP_HAL_SPI_DRIVER_H__
#define __AP_HAL_SPI_DRIVER_H__
#include "AP_HAL_Namespace.h"
class AP_HAL::SPIDriver {
public:
SPIDriver() {}
virtual void init() = 0;
};
#endif // __AP_HAL_SPI_DRIVER_H__

14
libraries/AP_HAL/Storage.h

@ -0,0 +1,14 @@
#ifndef __AP_HAL_STORAGE_H__
#define __AP_HAL_STORAGE_H__
#include "AP_HAL_Namespace.h"
class AP_HAL::Storage {
public:
Storage() {}
virtual void init(int machtnicht) = 0;
};
#endif // __AP_HAL_STORAGE_H__

19
libraries/AP_HAL/UARTDriver.h

@ -0,0 +1,19 @@
#ifndef __AP_HAL_UART_DRIVER_H__
#define __AP_HAL_UART_DRIVER_H__
#include <stdint.h>
#include "AP_HAL_Namespace.h"
/* Pure virtual UARTDriver class */
class AP_HAL::UARTDriver {
public:
UARTDriver() {}
virtual void init(uint16_t baud) = 0;
/* XXX stub */
};
#endif // __AP_HAL_UART_DRIVER_H__
Loading…
Cancel
Save