Sub programs of serial_transport, PID and motor contrl.
Dependents: tracking_ball_0516 tracking_ball_0516
Diff: Serial_Transport.h
- Revision:
- 5:9f066f9abe5d
- Parent:
- 4:82765e1fd9db
diff -r 82765e1fd9db -r 9f066f9abe5d Serial_Transport.h --- a/Serial_Transport.h Sat May 29 12:58:14 2021 +0000 +++ b/Serial_Transport.h Sat May 29 17:13:20 2021 +0000 @@ -3,14 +3,11 @@ #include "mbed.h" //#include "Serial.h" -#include "Thread.h" +//#include "Thread.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]; //接收缓存,用于存储接受的数据 @@ -28,14 +25,18 @@ unsigned char state; } Infor_Struct; +// class Serial_class{ public: - Serial_class(PinName tx, PinName rx); + Serial_class(PinName ptx, PinName prx,int baud); ~Serial_class(); unsigned char HasRecv(void); unsigned int ReadInfor(); + //void Setcallback(); + //void WriteInfor(char * pw,unsigned char length); + private: //Circle_Struct * pcircle_Struct; @@ -46,6 +47,8 @@ //unsigned char Read_From(unsigned char *p); //void Init_Circle_Struct(Circle_Struct * pcs); void Do_Recv(); + void Do_Recv_T(); + void Do_Recv_E(UnbufferedSerial * pserial); void Init_Infor_struct(void); void printtouart(char * pb,unsigned char length); Infor_Struct infor_struct; @@ -53,8 +56,7 @@ //信号量 //Mutex rw_mutex; //char buff[RECV_BUFFER_SIZE]; - UnbufferedSerial * s_port; - + UnbufferedSerial * s_port; DigitalOut * pled; Thread m_thread; UnbufferedSerial *pc; @@ -63,12 +65,7 @@ }; -/* -FileHandle *mbed::mbed_override_console(int fd) -{ - return &serial_port; -} -*/ + #endif /*end of Serial_Transport.h*/