The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Revision:
145:64910690c574
Parent:
128:9bcdf88f62b0
Child:
146:22da6e220af6
--- a/drivers/Serial.h	Thu Jun 08 14:53:05 2017 +0100
+++ b/drivers/Serial.h	Wed Jun 21 17:31:38 2017 +0100
@@ -18,7 +18,7 @@
 
 #include "platform/platform.h"
 
-#if DEVICE_SERIAL
+#if defined (DEVICE_SERIAL) || defined(DOXYGEN_ONLY)
 
 #include "Stream.h"
 #include "SerialBase.h"
@@ -27,14 +27,13 @@
 
 namespace mbed {
 /** \addtogroup drivers */
-/** @{*/
 
 /** A serial port (UART) for communication with other serial devices
  *
  * Can be used for Full Duplex communication, or Simplex by specifying
  * one pin as NC (Not Connected)
  *
- * @Note Synchronization level: Thread safe
+ * @note Synchronization level: Thread safe
  *
  * Example:
  * @code
@@ -48,6 +47,7 @@
  *     pc.printf("Hello World\n");
  * }
  * @endcode
+ * @ingroup drivers
  */
 class Serial : public SerialBase, public Stream {
 
@@ -81,6 +81,23 @@
      */
     Serial(PinName tx, PinName rx, int baud);
 
+    /* Stream gives us a FileHandle with non-functional poll()/readable()/writable. Pass through
+     * the calls from the SerialBase instead for backwards compatibility. This problem is
+     * part of why Stream and Serial should be deprecated.
+     */
+    bool readable()
+    {
+        return SerialBase::readable();
+    }
+    bool writable()
+    {
+        return SerialBase::writeable();
+    }
+    bool writeable()
+    {
+        return SerialBase::writeable();
+    }
+
 protected:
     virtual int _getc();
     virtual int _putc(int c);
@@ -95,5 +112,3 @@
 #endif
 
 #endif
-
-/** @}*/