Mavlink bridge for Mbed devices

Dependents:   AIT_UWB_Range

Files at this revision

API Documentation at this revision

Comitter:
bhepp
Date:
Mon Apr 04 11:18:57 2016 +0000
Parent:
9:6f782c9f1850
Commit message:
nop

Changed in this revision

uart_interface.h Show diff for this revision Revisions of this file
--- a/uart_interface.h	Tue Mar 29 10:00:09 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-#pragma once
-
-#ifdef __MBED__
-#include "mbed.h"
-#include "BufferedSerial.h"
-#endif
-
-namespace ait {
-
-class UART_Interface {
-public:
-    virtual bool writeChar(uint8_t c) = 0;
-    virtual bool isCharAvailable() = 0;
-    virtual uint8_t readChar(bool* err_flag = NULL) = 0;
-};
-
-#ifdef __MBED__
-class UART_Mbed : public UART_Interface {
-    BufferedSerial* serial_;
-
-public:
-    UART_Mbed(BufferedSerial* serial)
-            : serial_(serial) {
-    }
-
-    virtual bool writeChar(uint8_t c) {
-        int ret = serial_->putc(c);
-        if (ret == -1) {
-            return false;
-            //throw std::exception("Unable to write on serial port");
-        }
-        return true;
-    }
-
-    virtual bool isCharAvailable() {
-        return serial_->readable();
-    }
-
-    virtual uint8_t readChar(bool* err_flag = NULL) {
-        int c = serial_->getc();
-        if (err_flag != NULL) {
-            if (c == -1)
-                *err_flag = true;
-            else
-                *err_flag = false;
-        }
-        return static_cast<uint8_t>(c);
-    }
-};
-#endif // __MBED__
-
-}