Myserial Library extends RawSerial
Diff: MySerial.h
- Revision:
- 9:981384455445
- Parent:
- 7:d5fe75a0a885
- Child:
- 10:930d325f3d31
--- a/MySerial.h Tue Jun 24 03:16:30 2014 +0000 +++ b/MySerial.h Tue Jun 24 08:58:43 2014 +0000 @@ -30,6 +30,9 @@ * int iRtn = pc.GetString(6,cWord); //Serial received chars byref of cWord * } * int main() { + * pc.baud(9600); //set baud rate + * pc.format(8, MySerial::None, 1);//set bits for a byte, parity bit, stop bit + * pc.SetRxWait(0.01, 0.001); //set wait getting chars after interrupted, each char * pc.attach( readbuf, MySerial::RxIrq ); //Set Interrupt by Serial receive * } * @endcode @@ -37,13 +40,20 @@ class MySerial : public RawSerial{ public: - /** get chars received by serial + /** constructor to get chars received by serial * * @param PinName tx * @param PinName rx */ MySerial(PinName tx, PinName rx); + /** set wait getting chars after interrupted + * + * @param float _fRxStartWait wait getting a 1st char after interrupted + * @param float _fRxEachWait wait getting each char + */ + void SetRxWait(float _fRxStartWait, float _fRxEachWait); + /** function to get chars after received shars by serial * * @param int size for get chars @@ -64,7 +74,8 @@ } protected: - + float fRxStartWait; + float fRxEachWait; }; #endif \ No newline at end of file