Renjian Hao
Dependencies: L3G4200D L3GD20 LSM303DLHC LSM303DLM PwmIn Servo mbed
Fork of Fish_2014Fall by
iSerial/iSerial.h@0:8f37781c0054, 2015-04-17 (annotated)
- Committer:
- tzxl10000
- Date:
- Fri Apr 17 21:13:44 2015 +0000
- Revision:
- 0:8f37781c0054
Fish_2014 with BBBCamshift
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tzxl10000 | 0:8f37781c0054 | 1 | // |
tzxl10000 | 0:8f37781c0054 | 2 | // iSerial.h ... Serial Driver with Interrupt Rec/Send |
tzxl10000 | 0:8f37781c0054 | 3 | // |
tzxl10000 | 0:8f37781c0054 | 4 | // Copyright 2012 Yoji KURODA |
tzxl10000 | 0:8f37781c0054 | 5 | // |
tzxl10000 | 0:8f37781c0054 | 6 | // 2009.11.13 ... Originally written by Y.Kuroda for Renesas H83664 |
tzxl10000 | 0:8f37781c0054 | 7 | // 2012.08.31 ... Code convert for mbed in C++ |
tzxl10000 | 0:8f37781c0054 | 8 | // |
tzxl10000 | 0:8f37781c0054 | 9 | #ifndef _ISERIAL_H |
tzxl10000 | 0:8f37781c0054 | 10 | #define _ISERIAL_H |
tzxl10000 | 0:8f37781c0054 | 11 | |
tzxl10000 | 0:8f37781c0054 | 12 | #include <string.h> |
tzxl10000 | 0:8f37781c0054 | 13 | #include "RingBuffer.h" |
tzxl10000 | 0:8f37781c0054 | 14 | |
tzxl10000 | 0:8f37781c0054 | 15 | |
tzxl10000 | 0:8f37781c0054 | 16 | class iSerial : public Serial { |
tzxl10000 | 0:8f37781c0054 | 17 | protected: |
tzxl10000 | 0:8f37781c0054 | 18 | |
tzxl10000 | 0:8f37781c0054 | 19 | PinName tx; |
tzxl10000 | 0:8f37781c0054 | 20 | PinName rx; |
tzxl10000 | 0:8f37781c0054 | 21 | const int txbufsize; |
tzxl10000 | 0:8f37781c0054 | 22 | const int rxbufsize; |
tzxl10000 | 0:8f37781c0054 | 23 | RingBuffer txbuf; |
tzxl10000 | 0:8f37781c0054 | 24 | RingBuffer rxbuf; |
tzxl10000 | 0:8f37781c0054 | 25 | char* str; |
tzxl10000 | 0:8f37781c0054 | 26 | |
tzxl10000 | 0:8f37781c0054 | 27 | void tx_handler(void); |
tzxl10000 | 0:8f37781c0054 | 28 | void rx_handler(void); |
tzxl10000 | 0:8f37781c0054 | 29 | void enable_uart_irq(void); |
tzxl10000 | 0:8f37781c0054 | 30 | void disable_uart_irq(void); |
tzxl10000 | 0:8f37781c0054 | 31 | |
tzxl10000 | 0:8f37781c0054 | 32 | public: |
tzxl10000 | 0:8f37781c0054 | 33 | |
tzxl10000 | 0:8f37781c0054 | 34 | enum TERMINL_CODES { CR=0x0D, LF=0x0A }; |
tzxl10000 | 0:8f37781c0054 | 35 | |
tzxl10000 | 0:8f37781c0054 | 36 | iSerial(PinName _tx, PinName _rx, int _txbufsize=100, int _rxbufsize=100); |
tzxl10000 | 0:8f37781c0054 | 37 | virtual ~iSerial(); |
tzxl10000 | 0:8f37781c0054 | 38 | |
tzxl10000 | 0:8f37781c0054 | 39 | short int putstr(const char* s); |
tzxl10000 | 0:8f37781c0054 | 40 | |
tzxl10000 | 0:8f37781c0054 | 41 | int readable(void); |
tzxl10000 | 0:8f37781c0054 | 42 | int getc(void); |
tzxl10000 | 0:8f37781c0054 | 43 | void putc(short ch); |
tzxl10000 | 0:8f37781c0054 | 44 | short int puts(const char* s); |
tzxl10000 | 0:8f37781c0054 | 45 | //void printf(); |
tzxl10000 | 0:8f37781c0054 | 46 | char* printf(const char* format, ...); |
tzxl10000 | 0:8f37781c0054 | 47 | |
tzxl10000 | 0:8f37781c0054 | 48 | void flush(void); |
tzxl10000 | 0:8f37781c0054 | 49 | }; |
tzxl10000 | 0:8f37781c0054 | 50 | |
tzxl10000 | 0:8f37781c0054 | 51 | |
tzxl10000 | 0:8f37781c0054 | 52 | #endif /* _SCI_H */ |