modify to nucleo stm32F411

Dependencies:   RingBuffer

Dependents:   MX_control Program_BEAR_Protocol SwitchMode BEAR_Motion ... more

Fork of iSerial by Yoji KURODA

iSerial.h

Committer:
ykuroda
Date:
2012-09-01
Revision:
3:d5353b68105f
Parent:
2:3fc74f4d685a
Child:
4:b38ef9675d39

File content as of revision 3:d5353b68105f:

//
//  iSerial.h ... Serial Driver with Interrupt Rec/Send
//
//  Copyright 2012  Yoji KURODA
//
//  2009.11.13 ... Originally written by Y.Kuroda for Renesas H83664
//  2012.08.31 ... Code convert for mbed in C++
//
#ifndef _ISERIAL_H
#define _ISERIAL_H

#include <string.h>
#include "RingBuffer.h"


class iSerial : public Serial {
  protected:

    RingBuffer txbuf;
    RingBuffer rxbuf;

    void tx_handler(void);
    void rx_handler(void);


  public:

    enum TERMINL_CODES { CR=0x0D, LF=0x0A };

    /*
     *  void init_sci(void)
     *
     *@ƒ|[ƒg‰Šú‰»ŠÖ”DDDD‚·‚ׂĂÌI/O‚̐ݒè‚ðs‚Á‚Ä‚¢‚éD
     *
     *@@ˆø”F‚È‚µ
     *@@–ß‚è’lF‚È‚µ
     *
     */
    iSerial(PinName _tx, PinName _rx, const char *_name=NULL, int _txbufsize=100, int _rxbufsize=100);

    /*
     *  ƒVƒŠƒAƒ‹“ü—Í‚É•¶Žš‚ª‚ ‚é‚©‚Ç‚¤‚©ƒ`ƒFƒbƒN
     *  •Ô’lF    ‚O@@F•¶Žš‚ª‚È‚¢
     *            ‚OˆÈŠOF•¶Žš‚ª—ˆ‚Ä‚¢‚é
     */
    int readable(void);
    
    /*
     *  ƒVƒŠƒAƒ‹‚©‚çˆê•¶Žš“ü—Í
     */
    int getc(void);
    
    /*
     *@ƒVƒŠƒAƒ‹‚ֈꕶŽšo—Í
     */
    void putc(short ch);
    

    /*
     *@ƒVƒŠƒAƒ‹‚Ö•¶Žš—ñ‚ðo—Í
     *@@’Fˆê‰ñ‚̍ő啶Žš”‚ÍLINESIZE
     *@@’F•¶Žš—ñ‚̏I‚í‚è‚ɂ̓kƒ‹•¶Žš‚ª•K—vD
     *
     *@@ˆø”F•¶Žš—ñ‚ւ̃|ƒCƒ“ƒ^
     *@@•Ô’lFo—Í‚µ‚½•¶Žš”
     */
    short int putstr(const char* s);

    /*@void outs(char* s)
     *@ƒVƒŠƒAƒ‹‚Ö•¶Žš—ñ‚ðˆêso—Í
     *@@’FÅŒã‚ɉüsƒR[ƒh‚𑗂鑼‚Íoutstr‚Æ“¯‚¶
     *
     *@@ˆø”F•¶Žš—ñ‚ւ̃|ƒCƒ“ƒ^
     *@@•Ô’lFo—Í‚µ‚½•¶Žš”
     */
    short int puts(const char* s);
};


#endif    /* _SCI_H */