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