Renjian Hao

Dependencies:   L3G4200D L3GD20 LSM303DLHC LSM303DLM PwmIn Servo mbed

Fork of Fish_2014Fall by Zhan Tu

Committer:
RenjianHao
Date:
Thu Aug 13 18:37:15 2015 +0000
Revision:
5:a5f0395d2fa4
Parent:
0:8f37781c0054
Renjian Hao2015/8/13

Who changed what in which revision?

UserRevisionLine numberNew 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 */