Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Frequency_Counter_w_GPS_1PPS FreqCntr_GPS1PPS_F746F4xx_w_recipro
Fork of iSerial by
SerialIntr.h
- Committer:
- ykuroda
- Date:
- 2012-08-31
- Revision:
- 0:1d193cb1a933
File content as of revision 0:1d193cb1a933:
//
// SerialIntr.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 _SERIALINTR_H
#define _SERIALINTR_H
#include <string.h>
#include "RingBuffer.h"
class SerialIntr : 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)
*
* ポート初期化関数....すべてのI/Oの設定を行っている.
*
* 引数:なし
* 戻り値:なし
*
*/
SerialIntr(PinName _tx, PinName _rx, const char *_name=NULL, int _txbufsize=100, int _rxbufsize=100);
/*
* シリアル入力に文字があるかどうかチェック
* 返値: 0 :文字がない
* 0以外:文字が来ている
*/
int readable(void);
/*
* シリアルから一文字入力
*/
int getc(void);
/*
* シリアルへ一文字出力
*/
void putc(short ch);
/*
* シリアルへ文字列を出力
* 注:一回の最大文字数はLINESIZE
* 注:文字列の終わりにはヌル文字が必要.
*
* 引数:文字列へのポインタ
* 返値:出力した文字数
*/
short int putstr(const char* s);
/* void outs(char* s)
* シリアルへ文字列を一行出力
* 注:最後に改行コードを送る他はoutstrと同じ
*
* 引数:文字列へのポインタ
* 返値:出力した文字数
*/
short int puts(const char* s);
};
#endif /* _SCI_H */
