2023-05-3

This commit is contained in:
gitea committed 2023-05-03 18:18:03 +08:00
1 parent 633d9b872b
commit 063c3fcc07
74 files changed
+26281 -13954

No files matched your search

+62
View File
@@ -0,0 +1,62 @@
#include "usart-board.h"
UartDrv_t g_DebugDrv; // 调试串口驱动
UartDrv_t g_U4851Drv; // 4851 驱动
UartDrv_t g_U4852Drv; // 4852 驱动
UartDrv_t g_U4853Drv; // 4853 驱动
UartDrv_t g_ViewDrv; // View 驱动
UartDrv_t g_ETH1Drv; // 以太网通道1 驱动
UartDrv_t g_ETH2Drv; // 以太网通道1 驱动
UartDrv_t g_GSMDrv; // 以太网通道1 驱动
UartDrv_t g_LoRaDrv; // LoRa 模块驱动
/********************************************
函数名称:UartInfoInit
输入参数:串口句柄
输出参数:NULL
功能描述:初始化一个串口
********************************************/
void UartInfoInit()
{
}
void RelayInfoInit(void)
{
GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.Mode = RelayInfo.Relay1.mode;
GPIO_InitStruct.Pull = RelayInfo.Relay1.Pull;
GPIO_InitStruct.Speed = RelayInfo.Relay1.Speed;
GPIO_InitStruct.Pin = RelayInfo.Relay1.pin;
HAL_GPIO_Init (RelayInfo.Relay1.GPIOx, &GPIO_InitStruct);
HAL_GPIO_WritePin(RelayInfo.Relay1.GPIOx,RelayInfo.Relay1.pin,GPIO_PIN_RESET);
GPIO_InitStruct.Mode = RelayInfo.Relay2.mode;
GPIO_InitStruct.Pull = RelayInfo.Relay2.Pull;
GPIO_InitStruct.Speed = RelayInfo.Relay2.Speed;
GPIO_InitStruct.Pin = RelayInfo.Relay2.pin;
HAL_GPIO_Init (RelayInfo.Relay2.GPIOx, &GPIO_InitStruct);
HAL_GPIO_WritePin(RelayInfo.Relay2.GPIOx,RelayInfo.Relay2.pin,GPIO_PIN_RESET);
}
void RelayOpenDoor(void)
{
HAL_GPIO_WritePin(RelayInfo.Relay1.GPIOx,RelayInfo.Relay1.pin,GPIO_PIN_SET);
}
void RelayCloseDoor(void)
{
HAL_GPIO_WritePin(RelayInfo.Relay1.GPIOx,RelayInfo.Relay1.pin,GPIO_PIN_RESET);
}
void RelayOpenK2(void)
{
HAL_GPIO_WritePin(RelayInfo.Relay2.GPIOx,RelayInfo.Relay2.pin,GPIO_PIN_SET);
}
void RelayCloseK2(void)
{
HAL_GPIO_WritePin(RelayInfo.Relay2.GPIOx,RelayInfo.Relay2.pin,GPIO_PIN_RESET);
}
+44
View File
@@ -0,0 +1,44 @@
#ifndef _UART_BOARD_H
#define _UART_BOARD_H
#include <stdint.h>
typedef enum UartId_t
{
LpUart1,
LpUart2,
Uart1,
Uart2,
Uart3,
Uart4,
Uart5,
Uart6,
}UartId_t;
typedef enum UartPara_t{
_8N1,
_8E1,
_8O1,
_7O1,
_7E1,
_7N1,
}UartPara_t;
typedef struct UartDrv_t
{
UartId_t Id;// 串口号
uint32_t BaudRate;// 波特率
UartPara_t Para; // 数据位
char * rx_buffer;
uint16_t rx_size;
uint32_t rx_ready;// 接受完成等待处理
}UartDrv_t;
#endif