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: tracking_ball_0516 tracking_ball_0516
Revision 7:fd405402ff8c, committed 2021-05-30
- Comitter:
- helenh
- Date:
- Sun May 30 01:39:35 2021 +0000
- Parent:
- 6:76f3f6b641e9
- Commit message:
- e
Changed in this revision
| Circle_Buffer_Class.cpp | Show annotated file Show diff for this revision Revisions of this file |
| Circle_Buffer_Class.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/Circle_Buffer_Class.cpp Sat May 29 17:16:49 2021 +0000
+++ b/Circle_Buffer_Class.cpp Sun May 30 01:39:35 2021 +0000
@@ -2,8 +2,8 @@
Circle_Buffer_Class::Circle_Buffer_Class(int size)
{
- if(size<10) size=50;
- else if(size>200) size=200;
+ if(size<10) size=10;
+ else if(size>50) size=50;
this->buffer_size=size;
this->pbuffer=new unsigned char[size];
Init_Circle_Struct();
--- a/Circle_Buffer_Class.h Sat May 29 17:16:49 2021 +0000
+++ b/Circle_Buffer_Class.h Sun May 30 01:39:35 2021 +0000
@@ -2,22 +2,23 @@
#define __CIRCLE_BUFFER_CLASS_H__
#include "mbed.h"
-#define RECV_BUFFER_SIZE 100
+#define RECV_BUFFER_SIZE 50
-class Circle_Buffer_Class {
+class Circle_Buffer_Class
+{
public:
- Circle_Buffer_Class(int size);
- ~Circle_Buffer_Class();
- unsigned char Write_To(unsigned char infor);
- unsigned char Read_From(unsigned char *p);
+ Circle_Buffer_Class(int size);
+ ~Circle_Buffer_Class();
+ unsigned char Write_To(unsigned char infor);
+ unsigned char Read_From(unsigned char *p);
private:
- void Init_Circle_Struct();
- unsigned char * pbuffer; //接收缓存,用于存储接受的数据
- unsigned char Write_Index; //写入位置(缓存区可写入数据的数组位置索性)
- unsigned char Read_Index; //读取位置 (缓存区可以待读取数据的数组索引)
- unsigned int buffer_size; //缓存区最大长度
-
-} ;
+ void Init_Circle_Struct();
+ unsigned char * pbuffer; //接收缓存,用于存储接受的数据
+ unsigned char Write_Index; //写入位置(缓存区可写入数据的数组位置索性)
+ unsigned char Read_Index; //读取位置 (缓存区可以待读取数据的数组索引)
+ unsigned int buffer_size; //缓存区最大长度
+
+} ;
#endif
\ No newline at end of file