优化架构

This commit is contained in:
2026-05-31 20:05:50 +08:00
parent 0516210c95
commit cfad5acd82
4 changed files with 34 additions and 9 deletions
+5 -2
View File
@@ -25,8 +25,8 @@ const GPIO_CONFIG DO_PERIPH[] = {
#endif
//串口配置表
const COM_CONFIG COM_PERIPH[] = {
{COM0,.TxPort = GPIO9, .RxPort =GPIO10, .Speed = GPIO_Speed_50MHz},
{COM1,.TxPort = GPIO2, .RxPort = GPIO3, .Speed = GPIO_Speed_50MHz},
{COM0,.TxPort = GPIO9, .RxPort =GPIO10, .Speed = GPIO_Speed_50MHz,.Rs485 = false},
{COM1,.TxPort = GPIO2, .RxPort = GPIO3, .Speed = GPIO_Speed_50MHz,.Rs485 = true,.TxRxEn = GPIO55},
};
void BspExtraInit(void);
@@ -80,6 +80,9 @@ void BspInit(void) {
for (i = 0;i < ARRAY_LEN(COM_PERIPH);i++) {
GpioConfig(&COM_PERIPH[i].TxPort, GPIO_Mode_AF_PP, COM_PERIPH[i].Speed);
GpioConfig(&COM_PERIPH[i].RxPort, GPIO_Mode_IPU, COM_PERIPH[i].Speed);
if (COM_PERIPH[i].Rs485 == true) {
GpioConfig(&COM_PERIPH[i].TxRxEn, GPIO_Mode_AF_PP, COM_PERIPH[i].Speed);
}
}
INTERRUPT_ENABLE
+2
View File
@@ -1,5 +1,7 @@
#include "Bsp.h"
extern const COM_CONFIG COM_PERIPH[];
/**
* @brief 初始化UART口外设的时钟
* @note void