Sub programs of serial_transport, PID and motor contrl.

Dependents:   tracking_ball_0516 tracking_ball_0516

Serial_Transport.h

Committer:
helenh
Date:
2021-05-17
Revision:
1:09e2d1034894
Parent:
0:7f16c88e4047
Child:
2:a668eb71516b

File content as of revision 1:09e2d1034894:

#ifndef _Serial_Transport_H
#define _Serial_Transport_H 

#include "mbed.h"
#define RECV_BUFFER_SIZE 100

//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;

class Serial_class{   
    
public:
 Serial_class(PinName tx, PinName rx,PinName tx1, PinName rx1);
 void Serial_Porting_Init(PinName tx, PinName rx);
 void openmv_init(PinName tx, PinName rx);
 void Init_Circle_Struct(Circle_Struct * pcs);
 unsigned char IsEmputy(void);
 void Write_To(unsigned char infor);
 unsigned char Read_From(unsigned char *p);
 void Do_Recv();
 unsigned char DealRecv( unsigned char * pinfor);
 void InterruptAttach(void (* fp)(void));
 private:
   Circle_Struct *  pcircle_Struct;
   unsigned char state;
   unsigned char count;
   Serial * openmv_port; 
   Serial * pc;
    
};

#endif /*end of Serial_Transport.h*/