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.
CommonLibraries/RingBuffer/RingBuffer.h
- Committer:
- yabahiro
- Date:
- 2019-11-12
- Revision:
- 48:5562a99479e5
- Parent:
- 0:669ef71cba68
File content as of revision 48:5562a99479e5:
/*
* RingBuffer.h
*
* Created: 2016/08/10 12:15:08
* Author: masuk
*/
#ifndef RINGBUFFER_H_
#define RINGBUFFER_H_
#include <stdint.h>
namespace RINGBUFFER
{
//循環型バッファ 使用するバッファの配列と大きさを指定してください
class RingBuffer
{
struct
{
char *data;
int size;
uint8_t top;
uint8_t bottom;
uint8_t length;
bool fullup;
}Buffer;
public:
RingBuffer(char *bufPtr, int size);
//バッファにデータを追加
void PutData(char data, bool ASCIItoNum = false);
void PutData(char *data, int length);
void PutData(const char *str);
//バッファからデータを1byte読み出し
char GetData();
//バッファが飽和しているか確認
bool IsFullup();
//バッファにデータが存在するか確認
bool InAnyData();
};
}
#endif /* RINGBUFFER_H_ */