Sub programs of serial_transport, PID and motor contrl.
Dependents: tracking_ball_0516 tracking_ball_0516
Circle_Buffer_Class.h@7:fd405402ff8c, 2021-05-30 (annotated)
- Committer:
- helenh
- Date:
- Sun May 30 01:39:35 2021 +0000
- Revision:
- 7:fd405402ff8c
- Parent:
- 2:a668eb71516b
e
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
helenh | 2:a668eb71516b | 1 | #ifndef __CIRCLE_BUFFER_CLASS_H__ |
helenh | 2:a668eb71516b | 2 | #define __CIRCLE_BUFFER_CLASS_H__ |
helenh | 2:a668eb71516b | 3 | #include "mbed.h" |
helenh | 2:a668eb71516b | 4 | |
helenh | 7:fd405402ff8c | 5 | #define RECV_BUFFER_SIZE 50 |
helenh | 2:a668eb71516b | 6 | |
helenh | 2:a668eb71516b | 7 | |
helenh | 7:fd405402ff8c | 8 | class Circle_Buffer_Class |
helenh | 7:fd405402ff8c | 9 | { |
helenh | 2:a668eb71516b | 10 | public: |
helenh | 7:fd405402ff8c | 11 | Circle_Buffer_Class(int size); |
helenh | 7:fd405402ff8c | 12 | ~Circle_Buffer_Class(); |
helenh | 7:fd405402ff8c | 13 | unsigned char Write_To(unsigned char infor); |
helenh | 7:fd405402ff8c | 14 | unsigned char Read_From(unsigned char *p); |
helenh | 2:a668eb71516b | 15 | private: |
helenh | 7:fd405402ff8c | 16 | void Init_Circle_Struct(); |
helenh | 7:fd405402ff8c | 17 | unsigned char * pbuffer; //接收缓存,用于存储接受的数据 |
helenh | 7:fd405402ff8c | 18 | unsigned char Write_Index; //写入位置(缓存区可写入数据的数组位置索性) |
helenh | 7:fd405402ff8c | 19 | unsigned char Read_Index; //读取位置 (缓存区可以待读取数据的数组索引) |
helenh | 7:fd405402ff8c | 20 | unsigned int buffer_size; //缓存区最大长度 |
helenh | 7:fd405402ff8c | 21 | |
helenh | 7:fd405402ff8c | 22 | } ; |
helenh | 2:a668eb71516b | 23 | |
helenh | 2:a668eb71516b | 24 | #endif |