AP_HAL: Don't need a separate Console class, BetterStream will do.

This commit is contained in:
Pat Hickey 2012-08-30 17:28:14 -07:00 committed by Andrew Tridgell
parent 261ef791a7
commit 5d2327f52f
9 changed files with 10 additions and 46 deletions

View File

@ -11,7 +11,6 @@
#include "AnalogIn.h"
#include "Storage.h"
#include "Log.h"
#include "Console.h"
#include "GPIO.h"
#include "RCInput.h"
#include "RCOutput.h"

View File

@ -14,7 +14,6 @@ namespace AP_HAL {
class AnalogIn;
class Storage;
class Log;
class Console;
class GPIO;
class RCInput;
class RCOutput;

View File

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

View File

@ -9,7 +9,6 @@
#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/RCInput.h"
#include "../AP_HAL/RCOutput.h"
@ -25,7 +24,7 @@ public:
AP_HAL::AnalogIn* _analogIn,
AP_HAL::Storage* _storage,
AP_HAL::Log* _log,
AP_HAL::Console* _console,
AP_HAL::BetterStream* _console,
AP_HAL::GPIO* _gpio,
AP_HAL::RCInput* _rcin,
AP_HAL::RCOutput* _rcout,
@ -58,7 +57,7 @@ public:
AP_HAL::AnalogIn* analogIn;
AP_HAL::Storage* storage;
AP_HAL::Log* log;
AP_HAL::Console* console;
AP_HAL::BetterStream* console;
AP_HAL::GPIO* gpio;
AP_HAL::RCInput* rcin;
AP_HAL::RCOutput* rcout;

View File

@ -10,7 +10,6 @@
#include "AnalogIn.h"
#include "Storage.h"
#include "Log.h"
#include "Console.h"
#include "GPIO.h"
#include "RCInput.h"
#include "RCOutput.h"
@ -34,7 +33,6 @@ static ArduinoAnalogIn arduinoAnalogIn;
static AVREEPROMStorage avrEEPROMStorage;
static DataFlashAPM1Log apm1DataFlashLog;
static DataFlashAPM2Log apm2DataFlashLog;
static AVRUARTConsole avrUartConsole(&avrUart0Driver);
static ArduinoGPIO arduinoGPIO;
static APM1RCInput apm1RCInput;
static APM2RCInput apm2RCInput;
@ -52,7 +50,7 @@ const HAL_AVR AP_HAL_AVR_APM1(
&arduinoAnalogIn,
&avrEEPROMStorage,
&apm1DataFlashLog,
&avrUartConsole,
(BetterStream*) &avrUart0Driver,
&arduinoGPIO,
&apm1RCInput,
&apm1RCOutput,
@ -68,7 +66,7 @@ const HAL_AVR AP_HAL_AVR_APM2(
&arduinoAnalogIn,
&avrEEPROMStorage,
&apm2DataFlashLog,
&avrUartConsole,
(BetterStream *) &avrUart0Driver,
&arduinoGPIO,
&apm2RCInput,
&apm2RCOutput,

View File

@ -12,7 +12,6 @@ namespace AP_HAL_AVR {
class AVREEPROMStorage;
class DataFlashAPM1Log;
class DataFlashAPM2Log;
class AVRUARTConsole;
class ArduinoGPIO;
class APM1RCInput;
class APM2RCInput;

View File

@ -1,20 +0,0 @@
#ifndef __AP_HAL_AVR_CONSOLE_H__
#define __AP_HAL_AVR_CONSOLE_H__
#include <AP_HAL.h>
#include "AP_HAL_AVR_Namespace.h"
#include "UARTDriver.h"
class AP_HAL_AVR::AVRUARTConsole : public AP_HAL::Console {
public:
AVRUARTConsole( AVRUARTDriver* driver ) : _driver(driver), _init(0) {}
void init(int machtnicht) { _init = 1; }
private:
const AVRUARTDriver* _driver;
int _init;
};
#endif // __AP_HAL_AVR_CONSOLE_H__

View File

@ -6,6 +6,10 @@ void HAL_AVR::init(void* opts) const {
scheduler->init();
/* uart0 is the serial port used for the console, so lets make sure
* it is initialized at boot */
// XXX maybe this should be 57600?
uart0->begin(115200);
/* The AVR RCInput drivers take an AP_HAL_AVR::ISRRegistry*
* as the init argument */
rcin->init((void*)&isr_registry);

View File

@ -23,7 +23,7 @@ public:
AP_HAL::AnalogIn* _analogIn,
AP_HAL::Storage* _storage,
AP_HAL::Log* _log,
AP_HAL::Console* _console,
AP_HAL::BetterStream* _console,
AP_HAL::GPIO* _gpio,
AP_HAL::RCInput* _rcin,
AP_HAL::RCOutput* _rcout,