g0b1vetx-board/Board/usart-board.c
2023-05-03 18:18:03 +08:00

63 lines
1.7 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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);
}