2025-07-25 21:27:22 +08:00

63 lines
1.2 KiB
C

#ifndef __GPIO_H__
#define __GPIO_H__
/* MCU_GPIO_INFO */
#define GPIO_PORT_NUM 7 //共7组GPIO
#define GPIO_PIN_NUM 16 //每组16个Pin
//数组信号输出开关
#define DO_ON 0
#define DO_OFF 1
//LED灯开关
#define LED_ON 0
#define LED_OFF 1
//GPIO结构体
typedef struct
{
GPIO_TypeDef* GpioPort;
unsigned short GpioPin;
uint8_t DefaultStatus;
}GPIO_ST, *GPIO_ST_PTR;
/* **********SystemClock相关********** */
// GPIO
#define GPIO_ENABLE
#ifdef GPIO_ENABLE
#define USE_GPIOA
#define USE_GPIOB
#define USE_GPIOC
#define USE_GPIOD
#define USE_GPIOE
#define USE_GPIOF
#define USE_GPIOG
#endif
/* **********GPIO DO DI相关********** */
// 数字输出
#undef USE_DIGITAL_OUTPUT
#ifdef USE_DIGITAL_OUTPUT
#define DO_NUM 2
#define DO1 0
#define DO2 1
#endif
// 数字输入
#undef USE_DIGITAL_INPUT
#ifdef USE_DIGITAL_INPUT
#define DI_NUM 2
#define DI1 0
#define DI2 1
#endif
// LED灯
#define USE_LED
#ifdef USE_LED
#define LED_NUM 2
#define LED0 0
#define LED1 1
#endif
#endif