Sub programs of serial_transport, PID and motor contrl.
Dependents: tracking_ball_0516 tracking_ball_0516
Serial_Transport.h
- Committer:
- helenh
- Date:
- 2021-05-24
- Revision:
- 2:a668eb71516b
- Parent:
- 1:09e2d1034894
- Child:
- 3:57962324a4a0
File content as of revision 2:a668eb71516b:
#ifndef _Serial_Transport_H #define _Serial_Transport_H #include "mbed.h" //#define RECV_BUFFER_SIZE 100 #define INFOR_BUFFER_SIZE 20 //Serial openmv_port(D5, D4); //Serial pc(SERIAL_TX, SERIAL_RX); /* typedef struct { unsigned char Recv_Buffer[RECV_BUFFER_SIZE]; //接收缓存,用于存储接受的数据 unsigned char Write_Index; //写入位置(缓存区可写入数据的数组位置索性) unsigned char Read_Index; //读取位置 (缓存区可以待读取数据的数组索引) } Circle_Struct; */ typedef struct{ unsigned char recv_buff[INFOR_BUFFER_SIZE]; unsigned char count; unsigned int value; unsigned char state; } Infor_Struct; class Serial_class{ public: Serial_class(PinName tx, PinName rx); ~Serial_class(); unsigned char HasRecv(void); unsigned int ReadInfor(); private: //Circle_Struct * pcircle_Struct; //Circle_Struct circle_Struct; //unsigned char DealRecv( unsigned char * pinfor); void Add_Char(char recv); void Write_To(unsigned char infor); //unsigned char Read_From(unsigned char *p); //void Init_Circle_Struct(Circle_Struct * pcs); void Do_Recv(); void Init_Infor_struct(void); Infor_Struct infor_struct; //Infor_Struct * pinfor_struct; //信号量 //Mutex rw_mutex; //char buff[RECV_BUFFER_SIZE]; Serial * s_port; }; #endif /*end of Serial_Transport.h*/