Myserial Library extends RawSerial
Diff: MySerial.h
- Revision:
- 12:02b3877b48c6
- Parent:
- 11:34ae126807a0
- Child:
- 13:8cf9a9d7d44d
--- a/MySerial.h Thu Jul 03 02:37:41 2014 +0000 +++ b/MySerial.h Thu Jul 03 03:19:26 2014 +0000 @@ -38,17 +38,40 @@ * } * @endcode */ -class MySerial : public Serial{ +class MySerial : public SerialBase{ public: - /** constructor to get chars received by serial + + /** constructor to get chars received by serial * * @param PinName tx * @param PinName rx */ - MySerial(PinName tx, PinName rx, char *name); - - /** set wait getting chars after interrupted + MySerial(PinName tx, PinName rx); + + /** Write a char to the serial port + * + * @param c The char to write + * + * @returns The written char or -1 if an error occured + */ + int putc(int c); + + /** Read a char from the serial port + * + * @returns The char read from the serial port + */ + int getc(); + + /** Write a string to the serial port + * + * @param str The string to write + * + * @returns 0 if the write succeeds, EOF for error + */ + int puts(const char *str); + + /** set wait getting chars after interrupted * * @param float _fRxStartWait wait getting a 1st char after interrupted * @param float _fRxEachWait wait getting each char