优化架构
This commit is contained in:
+5
-2
@@ -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
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "Bsp.h"
|
||||
|
||||
extern const COM_CONFIG COM_PERIPH[];
|
||||
|
||||
/**
|
||||
* @brief 初始化UART口外设的时钟
|
||||
* @note void
|
||||
|
||||
Reference in New Issue
Block a user