新建项目
This commit is contained in:
1 parent
5e2e890cfc
commit
633d9b872b
1351 files changed
+730564
No files matched your search
@@ -0,0 +1,53 @@
|
||||
#include "relay-board.h"
|
||||
|
||||
|
||||
|
||||
RelayInfo_t RelayInfo = {
|
||||
{GPIOB, GPIO_PIN_8, GPIO_MODE_OUTPUT_PP,GPIO_PULLUP, GPIO_SPEED_FREQ_VERY_HIGH, NULL}, //PB5
|
||||
{GPIOB, GPIO_PIN_9, GPIO_MODE_OUTPUT_PP,GPIO_PULLUP, GPIO_SPEED_FREQ_VERY_HIGH, NULL}, //PB5
|
||||
};
|
||||
/********************************************
|
||||
函数名称:UartInfoInit
|
||||
输入参数:串口句柄
|
||||
输出参数:NULL
|
||||
功能描述:初始化一个串口
|
||||
********************************************/
|
||||
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);
|
||||
}
|
||||
Reference in new issue
Block a user