mirror of
https://gitee.com/dlmu-cone/bf_original_balance_chassis
synced 2026-07-24 11:37:45 +08:00
change all usart modules to have same api
This commit is contained in:
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -41,6 +41,7 @@
|
|||||||
"complex": "c",
|
"complex": "c",
|
||||||
"usb_device.h": "c",
|
"usb_device.h": "c",
|
||||||
"vofa_protocol.h": "c",
|
"vofa_protocol.h": "c",
|
||||||
"master_process.h": "c"
|
"master_process.h": "c",
|
||||||
|
"stdint-gcc.h": "c"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
0
modules/algorithm/LQR.c
Normal file
0
modules/algorithm/LQR.c
Normal file
0
modules/algorithm/LQR.h
Normal file
0
modules/algorithm/LQR.h
Normal file
@@ -4,7 +4,7 @@
|
|||||||
* @brief module for recv&send vision data
|
* @brief module for recv&send vision data
|
||||||
* @version beta
|
* @version beta
|
||||||
* @date 2022-11-03
|
* @date 2022-11-03
|
||||||
*
|
* @todo 增加对串口调试助手协议的支持,包括vofa和serial debug
|
||||||
* @copyright Copyright (c) 2022
|
* @copyright Copyright (c) 2022
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -27,12 +27,13 @@ static void DecodeVision()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 视觉通信初始化 */
|
/* 视觉通信初始化 */
|
||||||
void VisionInit(UART_HandleTypeDef *handle)
|
Vision_Recv_s* VisionInit(UART_HandleTypeDef *handle)
|
||||||
{
|
{
|
||||||
vision_usart_instance.module_callback = DecodeVision;
|
vision_usart_instance.module_callback = DecodeVision;
|
||||||
vision_usart_instance.recv_buff_size = VISION_RECV_SIZE;
|
vision_usart_instance.recv_buff_size = VISION_RECV_SIZE;
|
||||||
vision_usart_instance.usart_handle = handle;
|
vision_usart_instance.usart_handle = handle;
|
||||||
USARTRegister(&vision_usart_instance);
|
USARTRegister(&vision_usart_instance);
|
||||||
|
return &recv_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,12 +9,19 @@
|
|||||||
#define VISION_SEND_SIZE 36u
|
#define VISION_SEND_SIZE 36u
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 调用此函数初始化和视觉的串口通信
|
* @brief 调用此函数初始化和视觉的串口通信
|
||||||
*
|
*
|
||||||
* @param handle 用于和视觉通信的串口handle(C板上一般为USART1,丝印为USART2,4pin)
|
* @param handle 用于和视觉通信的串口handle(C板上一般为USART1,丝印为USART2,4pin)
|
||||||
*/
|
*/
|
||||||
void VisionInit(UART_HandleTypeDef* handle);
|
Vision_Recv_s* VisionInit(UART_HandleTypeDef* handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 发送视觉视觉
|
* @brief 发送视觉视觉
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* @file referee.h
|
||||||
|
* @author your name (you@domain.com)
|
||||||
|
* @brief
|
||||||
|
* @version 0.1
|
||||||
|
* @date 2022-11-04
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2022
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef REFEREE_H
|
||||||
|
#define REFEREE_H
|
||||||
|
|
||||||
|
#include"bsp_usart.h"
|
||||||
|
#include"usart.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif // !REFEREE_H
|
||||||
0
modules/referee/referee_UI.c
Normal file
0
modules/referee/referee_UI.c
Normal file
@@ -55,15 +55,16 @@ static void ReceiveCallback()
|
|||||||
sbus_to_rc(rc_usart_instance.recv_buff, &rc_ctrl);
|
sbus_to_rc(rc_usart_instance.recv_buff, &rc_ctrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RC_init(UART_HandleTypeDef *rc_usart_handle)
|
RC_ctrl_t* RC_init(UART_HandleTypeDef *rc_usart_handle)
|
||||||
{
|
{
|
||||||
rc_usart_instance.module_callback = ReceiveCallback;
|
rc_usart_instance.module_callback = ReceiveCallback;
|
||||||
rc_usart_instance.usart_handle = rc_usart_handle;
|
rc_usart_instance.usart_handle = rc_usart_handle;
|
||||||
rc_usart_instance.recv_buff_size = REMOTE_CONTROL_FRAME_SIZE;
|
rc_usart_instance.recv_buff_size = REMOTE_CONTROL_FRAME_SIZE;
|
||||||
USARTRegister(&rc_usart_instance);
|
USARTRegister(&rc_usart_instance);
|
||||||
}
|
|
||||||
|
|
||||||
const RC_ctrl_t *get_remote_control_point(void)
|
|
||||||
{
|
|
||||||
return &rc_ctrl;
|
return &rc_ctrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const *get_remote_control_point(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -73,20 +73,6 @@ typedef struct
|
|||||||
* @attention 注意分配正确的串口硬件,遥控器在C板上使用USART3
|
* @attention 注意分配正确的串口硬件,遥控器在C板上使用USART3
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void RC_init(UART_HandleTypeDef *rc_usart_handle);
|
RC_ctrl_t *RC_init(UART_HandleTypeDef *rc_usart_handle);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief 获取遥控器的数据指针
|
|
||||||
*
|
|
||||||
* @return const RC_ctrl_t*
|
|
||||||
*/
|
|
||||||
extern const RC_ctrl_t *get_remote_control_point(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief 检查遥控器数据是否出错
|
|
||||||
*
|
|
||||||
* @return uint8_t
|
|
||||||
*/
|
|
||||||
extern uint8_t RC_data_is_error(void);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user