Stefan Mueller
/
RS485
Allows RS485 communication using MAX485 chip
RS485.cpp@0:10a8f9128f73, 2015-11-13 (annotated)
- Committer:
- NeoBelerophon
- Date:
- Fri Nov 13 11:08:15 2015 +0000
- Revision:
- 0:10a8f9128f73
- Child:
- 1:916e1dd538ce
initial version of a RS485 library for MAX485
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
NeoBelerophon | 0:10a8f9128f73 | 1 | #include "RS485.h" |
NeoBelerophon | 0:10a8f9128f73 | 2 | |
NeoBelerophon | 0:10a8f9128f73 | 3 | RS485::RS485(PinName tx, PinName rx, PinName mode, const char *name) : Serial( tx, rx, name), m_modePin(mode) |
NeoBelerophon | 0:10a8f9128f73 | 4 | { |
NeoBelerophon | 0:10a8f9128f73 | 5 | } |
NeoBelerophon | 0:10a8f9128f73 | 6 | |
NeoBelerophon | 0:10a8f9128f73 | 7 | int RS485::_getc() { |
NeoBelerophon | 0:10a8f9128f73 | 8 | return _base_getc(); |
NeoBelerophon | 0:10a8f9128f73 | 9 | } |
NeoBelerophon | 0:10a8f9128f73 | 10 | |
NeoBelerophon | 0:10a8f9128f73 | 11 | int RS485::_putc(int c) { |
NeoBelerophon | 0:10a8f9128f73 | 12 | m_modePin = 1; |
NeoBelerophon | 0:10a8f9128f73 | 13 | int ret = _base_putc(c); |
NeoBelerophon | 0:10a8f9128f73 | 14 | m_modePin = 0; |
NeoBelerophon | 0:10a8f9128f73 | 15 | return ret; |
NeoBelerophon | 0:10a8f9128f73 | 16 | } |
NeoBelerophon | 0:10a8f9128f73 | 17 |