Yoji KURODA / iSerial

Dependencies:   RingBuffer

Dependents:   Dumb_box_rev2 mbed_GPSproject

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers iSerial.h Source File

iSerial.h

00001 //
00002 //  iSerial.h ... Serial Driver with Interrupt Rec/Send
00003 //
00004 //  Copyright 2012  Yoji KURODA
00005 //
00006 //  2009.11.13 ... Originally written by Y.Kuroda for Renesas H83664
00007 //  2012.08.31 ... Code convert for mbed in C++
00008 //
00009 #ifndef _ISERIAL_H
00010 #define _ISERIAL_H
00011 
00012 #include <string.h>
00013 #include "RingBuffer.h"
00014 
00015 
00016 class iSerial : public Serial {
00017   protected:
00018 
00019     PinName tx;
00020     PinName rx;
00021     const int txbufsize;
00022     const int rxbufsize;
00023     RingBuffer txbuf;
00024     RingBuffer rxbuf;
00025     char* str;
00026 
00027     void tx_handler(void);
00028     void rx_handler(void);
00029     void enable_uart_irq(void);
00030     void disable_uart_irq(void);
00031 
00032   public:
00033 
00034     enum TERMINL_CODES { CR=0x0D, LF=0x0A };
00035 
00036     iSerial(PinName _tx, PinName _rx, const char *_name=NULL, int _txbufsize=100, int _rxbufsize=100);
00037     virtual ~iSerial();
00038     
00039     short int putstr(const char* s);
00040 
00041     int readable(void);
00042     int getc(void);
00043     void putc(short ch);
00044     short int puts(const char* s);
00045     //void printf();
00046     char* printf(const char* format, ...);
00047 
00048     void flush(void);
00049 };
00050 
00051 
00052 #endif    /* _SCI_H */