From 8e7d9bb4640174d304e97c74e9e6f1796abaa9c7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 5 Oct 2013 18:32:35 +1000 Subject: [PATCH] HAL_Empty: removed Console driver --- .../AP_HAL_Empty/AP_HAL_Empty_Namespace.h | 1 - libraries/AP_HAL_Empty/AP_HAL_Empty_Private.h | 1 - libraries/AP_HAL_Empty/Console.cpp | 51 ------------------- libraries/AP_HAL_Empty/Console.h | 26 ---------- libraries/AP_HAL_Empty/HAL_Empty_Class.cpp | 3 +- 5 files changed, 1 insertion(+), 81 deletions(-) delete mode 100644 libraries/AP_HAL_Empty/Console.cpp delete mode 100644 libraries/AP_HAL_Empty/Console.h diff --git a/libraries/AP_HAL_Empty/AP_HAL_Empty_Namespace.h b/libraries/AP_HAL_Empty/AP_HAL_Empty_Namespace.h index 2fc1dcb385..19d901ddc3 100644 --- a/libraries/AP_HAL_Empty/AP_HAL_Empty_Namespace.h +++ b/libraries/AP_HAL_Empty/AP_HAL_Empty_Namespace.h @@ -15,7 +15,6 @@ namespace Empty { class EmptyAnalogSource; class EmptyAnalogIn; class EmptyStorage; - class EmptyConsoleDriver; class EmptyGPIO; class EmptyDigitalSource; class EmptyRCInput; diff --git a/libraries/AP_HAL_Empty/AP_HAL_Empty_Private.h b/libraries/AP_HAL_Empty/AP_HAL_Empty_Private.h index 87a9bfdb7d..4d79468766 100644 --- a/libraries/AP_HAL_Empty/AP_HAL_Empty_Private.h +++ b/libraries/AP_HAL_Empty/AP_HAL_Empty_Private.h @@ -11,7 +11,6 @@ #include "SPIDriver.h" #include "AnalogIn.h" #include "Storage.h" -#include "Console.h" #include "GPIO.h" #include "RCInput.h" #include "RCOutput.h" diff --git a/libraries/AP_HAL_Empty/Console.cpp b/libraries/AP_HAL_Empty/Console.cpp deleted file mode 100644 index 309ac962f5..0000000000 --- a/libraries/AP_HAL_Empty/Console.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include -#include "Console.h" - -using namespace Empty; - -EmptyConsoleDriver::EmptyConsoleDriver(AP_HAL::BetterStream* delegate) : - _d(delegate) -{} - -void EmptyConsoleDriver::init(void* machtnichts) -{} - -void EmptyConsoleDriver::backend_open() -{} - -void EmptyConsoleDriver::backend_close() -{} - -size_t EmptyConsoleDriver::backend_read(uint8_t *data, size_t len) { - return 0; -} - -size_t EmptyConsoleDriver::backend_write(const uint8_t *data, size_t len) { - return 0; -} - -int16_t EmptyConsoleDriver::available() { - return _d->available(); -} - -int16_t EmptyConsoleDriver::txspace() { - return _d->txspace(); -} - -int16_t EmptyConsoleDriver::read() { - return _d->read(); -} - -size_t EmptyConsoleDriver::write(uint8_t c) { - return _d->write(c); -} - - -size_t EmptyConsoleDriver::write(const uint8_t *buffer, size_t size) -{ - size_t n = 0; - while (size--) { - n += write(*buffer++); - } - return n; -} diff --git a/libraries/AP_HAL_Empty/Console.h b/libraries/AP_HAL_Empty/Console.h deleted file mode 100644 index 4aba7fe63f..0000000000 --- a/libraries/AP_HAL_Empty/Console.h +++ /dev/null @@ -1,26 +0,0 @@ - -#ifndef __AP_HAL_EMPTY_CONSOLE_H__ -#define __AP_HAL_EMPTY_CONSOLE_H__ - -#include - -class Empty::EmptyConsoleDriver : public AP_HAL::ConsoleDriver { -public: - EmptyConsoleDriver(AP_HAL::BetterStream* delegate); - void init(void* machtnichts); - void backend_open(); - void backend_close(); - size_t backend_read(uint8_t *data, size_t len); - size_t backend_write(const uint8_t *data, size_t len); - - int16_t available(); - int16_t txspace(); - int16_t read(); - - size_t write(uint8_t c); - size_t write(const uint8_t *buffer, size_t size); -private: - AP_HAL::BetterStream *_d; -}; - -#endif // __AP_HAL_EMPTY_CONSOLE_H__ diff --git a/libraries/AP_HAL_Empty/HAL_Empty_Class.cpp b/libraries/AP_HAL_Empty/HAL_Empty_Class.cpp index 20bc2ea115..d234016f5f 100644 --- a/libraries/AP_HAL_Empty/HAL_Empty_Class.cpp +++ b/libraries/AP_HAL_Empty/HAL_Empty_Class.cpp @@ -15,7 +15,6 @@ static EmptyI2CDriver i2cDriver(&i2cSemaphore); static EmptySPIDeviceManager spiDeviceManager; static EmptyAnalogIn analogIn; static EmptyStorage storageDriver; -static EmptyConsoleDriver consoleDriver(&uartADriver); static EmptyGPIO gpioDriver; static EmptyRCInput rcinDriver; static EmptyRCOutput rcoutDriver; @@ -31,7 +30,7 @@ HAL_Empty::HAL_Empty() : &spiDeviceManager, &analogIn, &storageDriver, - &consoleDriver, + &uartADriver, &gpioDriver, &rcinDriver, &rcoutDriver,