Myserial Library extends RawSerial
Revision 14:8bd054a87ac5, committed 2014-07-03
- Comitter:
- naao
- Date:
- Thu Jul 03 05:41:39 2014 +0000
- Parent:
- 13:8cf9a9d7d44d
- Child:
- 15:a0b05e764268
- Commit message:
- back to using Serial library
Changed in this revision
MySerial.cpp | Show annotated file Show diff for this revision Revisions of this file |
MySerial.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/MySerial.cpp Thu Jul 03 03:21:33 2014 +0000 +++ b/MySerial.cpp Thu Jul 03 05:41:39 2014 +0000 @@ -1,29 +1,15 @@ #include "MySerial.h" -MySerial::MySerial(PinName tx,PinName rx):SerialBase(tx,rx) //constructor +MySerial::MySerial(PinName tx,PinName rx):Serial(tx,rx) //constructor { fRxStartWait = 0.01; //wait getting a 1st char after interrupted fRxEachWait = 0.001; //wait getting each char } -int MySerial::getc() { - return _base_getc(); -} - -int MySerial::putc(int c) { - return _base_putc(c); -} - -int MySerial::puts(const char *str) { - while (*str) - putc(*str ++); - return 0; -} - void MySerial::SetRxWait(float _fRxStartWait, float _fRxEachWait) { fRxStartWait = _fRxStartWait; //wait getting a 1st char after interrupted - fRxEachWait = _fRxEachWait; //wait getting each char + fRxEachWait = _fRxEachWait; //wait getting each char } int MySerial::GetString(int size, char *cWord) //by pointer
--- a/MySerial.h Thu Jul 03 03:21:33 2014 +0000 +++ b/MySerial.h Thu Jul 03 05:41:39 2014 +0000 @@ -37,7 +37,7 @@ * } * @endcode */ -class MySerial : public SerialBase{ +class MySerial : public Serial{ public: @@ -48,28 +48,6 @@ */ 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