Sub programs of serial_transport, PID and motor contrl.

Dependents:   tracking_ball_0516 tracking_ball_0516

Serial_Transport.h

Committer:
helenh
Date:
2021-05-16
Revision:
0:7f16c88e4047
Child:
1:09e2d1034894

File content as of revision 0:7f16c88e4047:

#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);

void Serial_Porting_Init();
void openmv_init(void);

typedef struct {
   unsigned char Recv_Buffer[RECV_BUFFER_SIZE];  //接收缓存,用于存储接受的数据
   unsigned char Write_Index;      //写入位置(缓存区可写入数据的数组位置索性)
   unsigned char Read_Index;   //读取位置 (缓存区可以待读取数据的数组索引) 
    
}  Circle_Struct;

Circle_Struct  circle_Struct;
unsigned char state=0;
unsigned char count;

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(void);
unsigned char DealRecv( unsigned char * pinfor);

#endif