yuto kawamura
/
George_Slave_BOTHMOVE
right and left move at the same time
Diff: KondoServoLibrary/SerialHalfDuplex_HM/SerialHalfDuplex.cpp
- Revision:
- 0:411ab20ce87d
diff -r 000000000000 -r 411ab20ce87d KondoServoLibrary/SerialHalfDuplex_HM/SerialHalfDuplex.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/KondoServoLibrary/SerialHalfDuplex_HM/SerialHalfDuplex.cpp Fri Apr 26 11:34:44 2019 +0000 @@ -0,0 +1,31 @@ +/* mbed Microcontroller Library - SerialHalfDuplex + * Copyright (c) 2010-2011 ARM Limited. All rights reserved. + * written and changed by Hiroki Mineshita at 2016-04-12 + * by https://github.com/mbedmicro/mbed/tree/master/libraries/tests/libs/SerialHalfDuplex + */ +#include "SerialHalfDuplex.h" + +#if DEVICE_SERIAL + +namespace mbed { + +SerialHalfDuplex::SerialHalfDuplex(PinName tx, PinName rx,const char *name) + : Serial(tx,rx,name) { +} + +int SerialHalfDuplex::_putc(int c) { + int retc; + Serial::_putc(c); + if(Serial::readable())retc = Serial::getc(); // reading also clears any interrupt + else retc=-1000; + return retc; +} + +int SerialHalfDuplex::_getc(void) { + if(Serial::readable()) return Serial::_getc(); + else return -1000; +} + +} // End namespace + +#endif \ No newline at end of file