Sub programs of serial_transport, PID and motor contrl.
Dependents: tracking_ball_0516 tracking_ball_0516
Diff: Circle_Buffer_Class.h
- Revision:
- 2:a668eb71516b
- Child:
- 7:fd405402ff8c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Circle_Buffer_Class.h Mon May 24 08:56:23 2021 +0000 @@ -0,0 +1,23 @@ +#ifndef __CIRCLE_BUFFER_CLASS_H__ +#define __CIRCLE_BUFFER_CLASS_H__ +#include "mbed.h" + +#define RECV_BUFFER_SIZE 100 + + +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); +private: + 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