AP_HAL: rename Log to Dataflash

* I'd love to build a proper abstraction for logging, but I don't have the
  time to do so right now.
* The dataflash libs need to be pushed into the AP_HAL_AVR anyway, so I'll
  do that now and replace the interface with a better logging driver later.
This commit is contained in:
Pat Hickey 2012-08-31 10:48:37 -07:00 committed by Andrew Tridgell
parent 5d2327f52f
commit 3b697fe299
10 changed files with 53 additions and 54 deletions

View File

@ -10,7 +10,7 @@
#include "SPIDriver.h"
#include "AnalogIn.h"
#include "Storage.h"
#include "Log.h"
#include "Dataflash.h"
#include "GPIO.h"
#include "RCInput.h"
#include "RCOutput.h"

View File

@ -13,7 +13,7 @@ namespace AP_HAL {
class SPIDriver;
class AnalogIn;
class Storage;
class Log;
class Dataflash;
class GPIO;
class RCInput;
class RCOutput;

View File

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

View File

@ -8,7 +8,7 @@
#include "../AP_HAL/SPIDriver.h"
#include "../AP_HAL/AnalogIn.h"
#include "../AP_HAL/Storage.h"
#include "../AP_HAL/Log.h"
#include "../AP_HAL/Dataflash.h"
#include "../AP_HAL/GPIO.h"
#include "../AP_HAL/RCInput.h"
#include "../AP_HAL/RCOutput.h"
@ -23,7 +23,7 @@ public:
AP_HAL::SPIDriver* _spi,
AP_HAL::AnalogIn* _analogIn,
AP_HAL::Storage* _storage,
AP_HAL::Log* _log,
AP_HAL::Dataflash* _dataflash,
AP_HAL::BetterStream* _console,
AP_HAL::GPIO* _gpio,
AP_HAL::RCInput* _rcin,
@ -38,7 +38,7 @@ public:
spi(_spi),
analogIn(_analogIn),
storage(_storage),
log(_log),
dataflash(_dataflash),
console(_console),
gpio(_gpio),
rcin(_rcin),
@ -56,7 +56,7 @@ public:
AP_HAL::SPIDriver* spi;
AP_HAL::AnalogIn* analogIn;
AP_HAL::Storage* storage;
AP_HAL::Log* log;
AP_HAL::Dataflash* dataflash;
AP_HAL::BetterStream* console;
AP_HAL::GPIO* gpio;
AP_HAL::RCInput* rcin;

View File

@ -1,14 +0,0 @@
#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__

View File

@ -9,7 +9,7 @@
#include "SPIDriver.h"
#include "AnalogIn.h"
#include "Storage.h"
#include "Log.h"
#include "Dataflash.h"
#include "GPIO.h"
#include "RCInput.h"
#include "RCOutput.h"
@ -31,8 +31,8 @@ static AVRI2CDriver avrI2CDriver;
static ArduinoSPIDriver arduinoSPIDriver;
static ArduinoAnalogIn arduinoAnalogIn;
static AVREEPROMStorage avrEEPROMStorage;
static DataFlashAPM1Log apm1DataFlashLog;
static DataFlashAPM2Log apm2DataFlashLog;
static APM1Dataflash apm1Dataflash;
static APM2Dataflash apm2Dataflash;
static ArduinoGPIO arduinoGPIO;
static APM1RCInput apm1RCInput;
static APM2RCInput apm2RCInput;
@ -49,7 +49,7 @@ const HAL_AVR AP_HAL_AVR_APM1(
&arduinoSPIDriver,
&arduinoAnalogIn,
&avrEEPROMStorage,
&apm1DataFlashLog,
&apm1Dataflash,
(BetterStream*) &avrUart0Driver,
&arduinoGPIO,
&apm1RCInput,
@ -65,7 +65,7 @@ const HAL_AVR AP_HAL_AVR_APM2(
&arduinoSPIDriver,
&arduinoAnalogIn,
&avrEEPROMStorage,
&apm2DataFlashLog,
&apm2Dataflash,
(BetterStream *) &avrUart0Driver,
&arduinoGPIO,
&apm2RCInput,

View File

@ -10,8 +10,8 @@ namespace AP_HAL_AVR {
class ArduinoSPIDriver;
class ArduinoAnalogIn;
class AVREEPROMStorage;
class DataFlashAPM1Log;
class DataFlashAPM2Log;
class APM1Dataflash;
class APM2Dataflash;
class ArduinoGPIO;
class APM1RCInput;
class APM2RCInput;

View File

@ -0,0 +1,25 @@
#ifndef __AP_HAL_AVR_DATAFLASH_H__
#define __AP_HAL_AVR_DATAFLASH_H__
#include <AP_HAL.h>
#include "AP_HAL_AVR_Namespace.h"
class AP_HAL_AVR::APM1Dataflash : public AP_HAL::Dataflash {
public:
APM1Dataflash() : _init(0) {}
void init(int machtnicht) { _init = 1; }
private:
int _init;
};
class AP_HAL_AVR::APM2Dataflash : public AP_HAL::Dataflash {
public:
APM2Dataflash() : _init(0) {}
void init(int machtnicht) { _init = 2; }
private:
int _init;
};
#endif // __AP_HAL_AVR_DATAFLASH_H__

View File

@ -22,7 +22,7 @@ public:
AP_HAL::SPIDriver* _spi,
AP_HAL::AnalogIn* _analogIn,
AP_HAL::Storage* _storage,
AP_HAL::Log* _log,
AP_HAL::Dataflash* _dataflash,
AP_HAL::BetterStream* _console,
AP_HAL::GPIO* _gpio,
AP_HAL::RCInput* _rcin,
@ -30,7 +30,7 @@ public:
AP_HAL::Scheduler* _scheduler)
: AP_HAL::HAL( _uart0, _uart1, _uart2, _uart3,
_i2c, _spi, _analogIn, _storage,
_log, _console, _gpio, _rcin,
_dataflash, _console, _gpio, _rcin,
_rcout, _scheduler) {}
void init(void* opts) const;

View File

@ -1,25 +0,0 @@
#ifndef __AP_HAL_AVR_LOG_H__
#define __AP_HAL_AVR_LOG_H__
#include <AP_HAL.h>
#include "AP_HAL_AVR_Namespace.h"
class AP_HAL_AVR::DataFlashAPM1Log : public AP_HAL::Log {
public:
DataFlashAPM1Log() : _init(0) {}
void init(int machtnicht) { _init = 1; }
private:
int _init;
};
class AP_HAL_AVR::DataFlashAPM2Log : public AP_HAL::Log {
public:
DataFlashAPM2Log() : _init(0) {}
void init(int machtnicht) { _init = 2; }
private:
int _init;
};
#endif // __AP_HAL_AVR_LOG_H__