Fork of SerialHalfDuplex library
Dependents: PR_RobotArm lighthouse_2
Fork of SerialHalfDuplex by
Diff: SerialHalfDuplex.cpp
- Revision:
- 2:5ecc72a47df0
- Parent:
- 1:8fd1fa67565e
- Child:
- 3:ff073057f373
diff -r 8fd1fa67565e -r 5ecc72a47df0 SerialHalfDuplex.cpp --- a/SerialHalfDuplex.cpp Wed Apr 03 16:42:49 2013 +0000 +++ b/SerialHalfDuplex.cpp Tue Apr 01 06:50:02 2014 +0000 @@ -1,4 +1,4 @@ -/* mbed Microcontroller Library + /* mbed Microcontroller Library * Copyright (c) 2006-2012 ARM Limited * * Permission is hereby granted, free of charge, to any person obtaining a copy @@ -22,25 +22,25 @@ * NOTE: This is an unsupported legacy untested library. */ #include "SerialHalfDuplex.h" - + #if DEVICE_SERIAL - + #include "pinmap.h" #include "serial_api.h" #include "gpio_api.h" - + namespace mbed { - + SerialHalfDuplex::SerialHalfDuplex(PinName tx, PinName rx, const char *name) : Serial(tx, rx, name) { _txpin = tx; - //gpio_input(_txpin); // set as input + // set as input gpio_set(_txpin); pin_mode(_txpin, PullNone); // no pull pin_function(_txpin, 0); // set as gpio } - + // To transmit a byte in half duplex mode: // 1. Disable interrupts, so we don't trigger on loopback byte // 2. Set tx pin to UART out @@ -49,7 +49,7 @@ // transmit has occurred, and also clears the byte from the buffer. // 5. Return pin to input mode // 6. Re-enable interrupts - + int SerialHalfDuplex::_putc(int c) { int retc; @@ -67,11 +67,11 @@ return retc; } - + int SerialHalfDuplex::_getc(void) { return Serial::_getc(); } - + } // End namespace - -#endif + +#endif \ No newline at end of file