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