///*
// * msp_TPLINK.c
// *
// *  Created on: 2024年5月10日
// *      Author: 42961
// */
//#include "MSP/msp_TPLINK.h"
//#include "MSP/msp_Modbus_crc16.h"
//#include "MSP/msp_DH_W_H.h"
//#include "MSP/msp_LeiSai_Motor.h"
//#include "MSP/msp_TL720D.h"
//
//uint8_t TPBUF[8];  //32发送数据给服务器，服务器再发给安卓客户端  所用的数组
//SP_MSP_TPLINK_Parameters *RF_TPLINK;
//UART_HandleTypeDef* Huart_TPLINK;
//uint8_t TPLINK_data[8];
//void RF_TPLINK_Unscramble();
//void GF_MSP_TPLINK_SEND_Timer();
//uint16_t client_speed;    //APP发过来的速度
//uint8_t client_rpm_high;
//uint8_t client_rpm_low;
//uint8_t change_speed_level;
//
//
//
//
////引入外部文件变量
//extern SP_MSP_DH_Handset_Parameters *DH_WH_BING;
//extern SP_MSP_LeiSai_MotorParameters* M_LeiSai;
//extern SP_MSP_RF_TL720D_Parameters *RF_720D;
//extern int16_t speed_level_1;
//extern int16_t speed_level_2;
//extern int16_t speed_level_3;
//extern int16_t speed_level_4;
//extern int16_t speed_level_5;
//extern int16_t speed_level_6;
//extern int16_t speed_level_7;
//extern int16_t speed_level_8;
//extern int16_t speed_level_9;
//extern int16_t speed_level_10;
//extern int32_t compensate_angle;
//extern double change_road_distance;
//
//uint8_t GF_MSP_RF_TPLINK_Init(UART_HandleTypeDef* huart,SP_MSP_TPLINK_Parameters *_RF_TPLINK)
//{
//	Huart_TPLINK=huart;
//	GF_BSP_Interrupt_Add_CallBack(DF_BSP_InterCall_RS485_3_RxCpltCallback, RF_TPLINK_Unscramble);//绑定中断回调函数
//	HAL_UART_Receive_IT(Huart_TPLINK,TPLINK_data,8);
//	RF_TPLINK = _RF_TPLINK;      //同步地址指针，此步极为关键（实际上没用到这个结构体）
//	return 1;
//}
//
//
//void RF_TPLINK_Unscramble()
//{
//	HAL_UART_Receive_IT(Huart_TPLINK,TPLINK_data,8);
//
//	 client_speed=((TPLINK_data[0]-0x30)*10+TPLINK_data[1]-0x30)*70/0.942;
//	 client_rpm_high=client_speed>>8;
//	 client_rpm_low=client_speed;
//	 change_speed_level=TPLINK_data[2]-0x30;
//	 compensate_angle=TPLINK_data[3]-0x30;
//	 change_road_distance=(TPLINK_data[6]-0x30)*10+(TPLINK_data[7]-0x30);
//	 change_road_distance=change_road_distance/10*4;
//
//
//	GF_MSP_TPLINK_SEND_Timer();    //接收到数据后需要马上发送点什么东西回去，不然APP那边容易卡死
//	if(client_rpm_high<=0x0A){
//	 switch(change_speed_level)    //用客户端发来的数据改变对应档位的转速值（设定转速）
//	 {
//
//	  case 1:
//		  speed_level_1=(client_rpm_high<<8)+client_rpm_low;
//		  break;
//	  case 2:
//		  speed_level_2=(client_rpm_high<<8)+client_rpm_low;
//		  break;
//	  case 3:
//		  speed_level_3=(client_rpm_high<<8)+client_rpm_low;
//		  break;
//	  case 4:
//		  speed_level_4=(client_rpm_high<<8)+client_rpm_low;
//		  break;
//	  case 5:
//		  speed_level_5=(client_rpm_high<<8)+client_rpm_low;
//		  break;
//	  case 6:
//		  speed_level_6=(client_rpm_high<<8)+client_rpm_low;
//		  break;
//	  case 7:
//		  speed_level_7=(client_rpm_high<<8)+client_rpm_low;
//		  break;
//	  case 8:
//		  speed_level_8=(client_rpm_high<<8)+client_rpm_low;
//		  break;
//	  case 9:
//		  speed_level_9=(client_rpm_high<<8)+client_rpm_low;
//		  break;
//	  case 10:
//		  speed_level_10=(client_rpm_high<<8)+client_rpm_low;
//		  break;
//	  default:
//			break;
//
//	 }
//	}
//
//
//}
//
//
//void GF_MSP_TPLINK_SEND_Timer()
//{
//	TPBUF[0]=(M_LeiSai[0].Target_Velcity)>>8;
//	TPBUF[1]=M_LeiSai[0].Target_Velcity;
//	TPBUF[2]=(RF_720D->RF_Angle_Roll)/100;
//
//	GF_BSP_UART_Transmit(3, TPBUF, 3);   //发送当前电机转速给APP
//}
