You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
752 B
21 lines
752 B
#ifndef __BSP_RELAY_H
|
|
#define __BSP_RELAY_H
|
|
|
|
#include "stm32f10x.h"
|
|
|
|
#define RELAY1_GPIO_PORT GPIOA /* GPIO端口 */
|
|
#define RELAY1_GPIO_CLK RCC_APB2Periph_GPIOA /* GPIO端口时钟 */
|
|
#define RELAY1_GPIO_PIN GPIO_Pin_4 /* 连接到SCL时钟线的GPIO */
|
|
|
|
/* 继电器控制宏定义 */
|
|
#define RELAY1_ON() GPIO_SetBits(RELAY1_GPIO_PORT, RELAY1_GPIO_PIN)
|
|
#define RELAY1_OFF() GPIO_ResetBits(RELAY1_GPIO_PORT, RELAY1_GPIO_PIN)
|
|
#define RELAY1_TOGGLE() GPIO_WriteBit(RELAY1_GPIO_PORT, RELAY1_GPIO_PIN, \
|
|
(BitAction)(1 - GPIO_ReadOutputDataBit(RELAY1_GPIO_PORT, RELAY1_GPIO_PIN)))
|
|
|
|
void RELAY_GPIO_Config(void);
|
|
void RELAY1_Control(uint8_t state);
|
|
uint8_t RELAY1_GetState(void);
|
|
|
|
#endif
|