Sub programs of serial_transport, PID and motor contrl.

Dependents:   tracking_ball_0516 tracking_ball_0516

Circle_Buffer_Class.h

Committer:
helenh
Date:
2021-05-30
Revision:
7:fd405402ff8c
Parent:
2:a668eb71516b

File content as of revision 7:fd405402ff8c:

#ifndef __CIRCLE_BUFFER_CLASS_H__
#define __CIRCLE_BUFFER_CLASS_H__
#include "mbed.h"

#define RECV_BUFFER_SIZE 50


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