123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- #ifndef MBED_SERIAL_H
- #define MBED_SERIAL_H
- #include "platform/platform.h"
- #if defined (DEVICE_SERIAL) || defined(DOXYGEN_ONLY)
- #include "Stream.h"
- #include "SerialBase.h"
- #include "PlatformMutex.h"
- #include "serial_api.h"
- #include "platform/NonCopyable.h"
- namespace mbed {
- class Serial : public SerialBase, public Stream, private NonCopyable<Serial> {
- public:
- #if DEVICE_SERIAL_ASYNCH
- using SerialBase::read;
- using SerialBase::write;
- #endif
-
- Serial(PinName tx, PinName rx, const char *name = NULL, int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
-
- Serial(PinName tx, PinName rx, int baud);
-
- bool readable()
- {
- return SerialBase::readable();
- }
- bool writable()
- {
- return SerialBase::writeable();
- }
- bool writeable()
- {
- return SerialBase::writeable();
- }
- protected:
- virtual int _getc();
- virtual int _putc(int c);
- virtual void lock();
- virtual void unlock();
- PlatformMutex _mutex;
- };
- }
- #endif
- #endif
|