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: iSerial DGWWebServer iSerial Dumb_box_rev2 ... more
RingBuffer.h
00001 // 00002 // RingBuffer.h ... General purpose ring buffer library 00003 // 00004 // Copyright 2012 Yoji KURODA 00005 // 00006 // 2009.11.13 ... Originally written in C by Y.Kuroda for Renesas H83664 00007 // 2012.08.31 ... Code convert for mbed in C++ 00008 // 00009 00010 #ifndef _RINGBUFFER_H 00011 #define _RINGBUFFER_H 00012 00013 class RingBuffer { 00014 00015 protected: 00016 unsigned char* buf; 00017 unsigned char* sp; 00018 unsigned char* ep; 00019 00020 00021 int bufsize; 00022 00023 public: 00024 RingBuffer(int _bufsize=100); 00025 ~RingBuffer(); 00026 00027 int save(unsigned char c); 00028 unsigned char read(void); 00029 int check(void); 00030 int buffersize(void){return bufsize;}; 00031 int full(void){ return (check()>=bufsize-1 ? 1 : 0); }; 00032 }; 00033 00034 00035 #endif /* _RINGBUFFER_H */ 00036 00037
Generated on Tue Jul 19 2022 02:56:40 by
1.7.2