Pat Hickey
13 years ago
committed by
Andrew Tridgell
13 changed files with 273 additions and 0 deletions
@ -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__
|
||||||
|
|
@ -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__
|
@ -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__
|
||||||
|
|
@ -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__
|
||||||
|
|
@ -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__
|
@ -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__
|
||||||
|
|
@ -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__
|
||||||
|
|
@ -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__
|
||||||
|
|
@ -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__
|
||||||
|
|
@ -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__
|
||||||
|
|
@ -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__
|
||||||
|
|
@ -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__
|
||||||
|
|
@ -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…
Reference in new issue