优化架构

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
-2
View File
@@ -1,8 +1,6 @@
#ifndef __BSP_H__
#define __BSP_H__
/* Voilet Bsp */
#include "VoiletPort.h"
/* Board */
#include "Board.h"
+27 -5
View File
@@ -16,7 +16,23 @@
typedef enum {
false = 0,
true = 1,
} bool_t;
} BOOL_MAP_T;
/* DI数字信号采集枚举 */
enum {
DI_OFF = 0,
DI_ON
};
/* DO数字信号输出枚举 */
enum {
DO_OFF = 0,
DO_ON
};
/* LED灯输出枚举 */
enum {
LED_OFF = 0,
LED_ON
};
/* Interrupt Irq */
typedef struct {
@@ -181,6 +197,8 @@ typedef struct {
#define GPIO111 {RCC_APB2PeriphClockCmd, RCC_APB2Periph_GPIOG, {GPIOG, GPIO_Pin_15}}
#endif
// #define GPIO_NULL ((COM_CONFIG){0, 0, {0, 0}})
/* COM */
typedef struct {
USART_TypeDef *UartId;
@@ -191,15 +209,19 @@ typedef struct {
void (*ClockCmd)(uint32_t RccPeriph, FunctionalState State);
unsigned int ClockTree;
COM_PERIPH_T Periph;
// GPIO_MAP_T TxRxEn; //收发使能
} COM_MAP_T;
typedef struct {
COM_MAP_T *ComX;
GPIO_MAP_T TxPort;
GPIO_MAP_T RxPort;
GPIOSpeed_TypeDef Speed;
COM_MAP_T *ComX; //串口外设
GPIO_MAP_T TxPort; //发送端口
GPIO_MAP_T RxPort; //接收端口
unsigned char Rs485; //是否是Rs485
GPIO_MAP_T TxRxEn; //收发使能
GPIOSpeed_TypeDef Speed; //IO口速度
}COM_CONFIG;
#define COM_NUM 5
#ifdef USART1
#define COM0 (&(COM_MAP_T){RCC_APB2PeriphClockCmd, RCC_APB2Periph_USART1, {USART1,USART1_IRQn}})
#endif