#ifndef __GO_M8010_6_H
#define __GO_M8010_6_H
#ifdef __cplusplus
extern "C"{
#endif
#include "main.h"
#include "crc16.h"
#include "usart.h"
#include "string.h"
#include <math.h>
#define GO_NUM 2
/**
 * @brief
 
 * 
 */
typedef struct
{
    uint8_t id     :4;      
    uint8_t status :3;      
    uint8_t none   :1;      
} RIS_Mode_t ;  




typedef struct
{
    int16_t tor_des;        
    int16_t spd_des;        
    int32_t pos_des;        
    uint16_t  k_pos;       
    uint16_t  k_spd;        
    
} RIS_Comd_t;   



/**
 *
 * 
 */
typedef struct
{
    uint8_t head[2];    
    RIS_Mode_t mode;    
    RIS_Comd_t comd;   
    uint16_t   CRC16;  

} ControlData_t;    




typedef struct {              
        unsigned short id;              
        unsigned short mode;            
        uint16_t correct;              
        int MError;                     
        int Temp;                      
        float tar_pos;                  
        float tar_w;                    
        float T;                       
        float W;                       
        float Pos;                     
        int footForce;                  
        uint8_t buffer[17];
        uint8_t Rec_buffer[16];
        ControlData_t  motor_send_data;  
}GO_Motorfield;


void GO_M8010_init(void);


void GO_M8010_send_data(UART_HandleTypeDef *huart,int id, int rev,float T,float W,float Pos,float K_P,float K_W);
void USART6_RxCompleteCallback(void );
void uartTxCB(UART_HandleTypeDef *huart);


void basic_ForceControl (UART_HandleTypeDef *huart, int id, float bias, float length, float mass, 
                        float tar_pos, float tar_w, float K_P,float K_W);


GO_Motorfield* getGoPoint(uint8_t id);

#ifdef __cplusplus
}
#endif
#endif /*__GO_M8010_6_H */
