change all usart modules to have same api

This commit is contained in:
NeoZng 2022-11-05 21:59:03 +08:00
parent 95607668e1
commit 4d27bd9b0f
9 changed files with 43 additions and 25 deletions

View File

@ -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
View File

0
modules/algorithm/LQR.h Normal file
View File

View File

@ -4,8 +4,8 @@
* @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
* *
*/ */
#include "Master_process.h" #include "Master_process.h"
@ -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;
} }
/** /**

View File

@ -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

View File

@ -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

View File

View 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);
return &rc_ctrl;
} }
const RC_ctrl_t *get_remote_control_point(void) const *get_remote_control_point(void)
{ {
return &rc_ctrl;
} }

View File

@ -5,10 +5,10 @@
* @brief * @brief
* @version beta * @version beta
* @date 2022-11-01 * @date 2022-11-01
* *
* @copyright Copyright (c) 2016 DJI corp * @copyright Copyright (c) 2016 DJI corp
* @copyright Copyright (c) 2022 HNU YueLu EC all rights reserved * @copyright Copyright (c) 2022 HNU YueLu EC all rights reserved
* *
*/ */
#ifndef REMOTE_CONTROL_H #ifndef REMOTE_CONTROL_H
#define REMOTE_CONTROL_H #define REMOTE_CONTROL_H
@ -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