Stefan Mueller
/
RS485
Allows RS485 communication using MAX485 chip
RS485.h@0:10a8f9128f73, 2015-11-13 (annotated)
- Committer:
- NeoBelerophon
- Date:
- Fri Nov 13 11:08:15 2015 +0000
- Revision:
- 0:10a8f9128f73
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 <mbed.h> |
NeoBelerophon | 0:10a8f9128f73 | 2 | class RS485 : public Serial |
NeoBelerophon | 0:10a8f9128f73 | 3 | { |
NeoBelerophon | 0:10a8f9128f73 | 4 | public: |
NeoBelerophon | 0:10a8f9128f73 | 5 | /** Create a RS485 Serial port using MAX485, connected to the specified transmit and receive pins |
NeoBelerophon | 0:10a8f9128f73 | 6 | * |
NeoBelerophon | 0:10a8f9128f73 | 7 | * @param tx Transmit pin |
NeoBelerophon | 0:10a8f9128f73 | 8 | * @param rx Receive pin |
NeoBelerophon | 0:10a8f9128f73 | 9 | * @param mode Rx TX Mode pin |
NeoBelerophon | 0:10a8f9128f73 | 10 | * |
NeoBelerophon | 0:10a8f9128f73 | 11 | * @note |
NeoBelerophon | 0:10a8f9128f73 | 12 | * Either tx or rx may be specified as NC if unused |
NeoBelerophon | 0:10a8f9128f73 | 13 | */ |
NeoBelerophon | 0:10a8f9128f73 | 14 | RS485(PinName tx, PinName rx, PinName mode, const char *name=NULL); |
NeoBelerophon | 0:10a8f9128f73 | 15 | |
NeoBelerophon | 0:10a8f9128f73 | 16 | protected: |
NeoBelerophon | 0:10a8f9128f73 | 17 | virtual int _putc(int c); |
NeoBelerophon | 0:10a8f9128f73 | 18 | virtual int _getc(); |
NeoBelerophon | 0:10a8f9128f73 | 19 | |
NeoBelerophon | 0:10a8f9128f73 | 20 | private: |
NeoBelerophon | 0:10a8f9128f73 | 21 | DigitalOut m_modePin; |
NeoBelerophon | 0:10a8f9128f73 | 22 | |
NeoBelerophon | 0:10a8f9128f73 | 23 | }; |