2024-03-18 08:56:08 +08:00

65 lines
2.2 KiB
C

/*---------------------------------------------------------------------*/
/* --- STC MCU Limited ------------------------------------------------*/
/* --- STC 1T Series MCU Demo Programme -------------------------------*/
/* --- Mobile: (86)13922805190 ----------------------------------------*/
/* --- Fax: 86-0513-55012956,55012947,55012969 ------------------------*/
/* --- Tel: 86-0513-55012928,55012929,55012966 ------------------------*/
/* --- Web: www.STCMCU.com --------------------------------------------*/
/* --- Web: www.STCMCUDATA.com ---------------------------------------*/
/* --- QQ: 800003751 -------------------------------------------------*/
/* 如果要在程序中使用此代码,请在程序中注明使用了STC的资料及程序 */
/*---------------------------------------------------------------------*/
#ifndef __GPIO_H
#define __GPIO_H
#include "config.h"
#define GPIO_PullUp 0 // 上拉准双向口
#define GPIO_HighZ 1 // 浮空输入
#define GPIO_OUT_OD 2 // 开漏输出
#define GPIO_OUT_PP 3 // 推挽输出
#define GPIO_Pin_0 0x01 // IO引脚 Px.0
#define GPIO_Pin_1 0x02 // IO引脚 Px.1
#define GPIO_Pin_2 0x04 // IO引脚 Px.2
#define GPIO_Pin_3 0x08 // IO引脚 Px.3
#define GPIO_Pin_4 0x10 // IO引脚 Px.4
#define GPIO_Pin_5 0x20 // IO引脚 Px.5
#define GPIO_Pin_6 0x40 // IO引脚 Px.6
#define GPIO_Pin_7 0x80 // IO引脚 Px.7
#define GPIO_Pin_All 0xFF // IO所有引脚
#define GPIO_P0 0 //
#define GPIO_P1 1
#define GPIO_P2 2
#define GPIO_P3 3
#define GPIO_P4 4
#define GPIO_P5 5
#define GPIO_P6 6
#define GPIO_P7 7
typedef struct {
u8 Mode; // IO模式, GPIO_PullUp,GPIO_HighZ,GPIO_OUT_OD,GPIO_OUT_PP
u8 Pin; // 要设置的端口
} GPIO_InitTypeDef;
#define BUZZER_PIN P11
#define LED4_PIN P37
#define LED8_PIN P10
#define LED3_PIN P35
#define LED7_PIN P36
#define LED2_PIN P33
#define LED6_PIN P34
#define LED1_PIN P54
#define LED5_PIN P17
#define HOTBED_PIN P12
#define HEAT1_PIN P14
#define HEAT2_PIN P13
#define LEDACT_PIN P15
static u8 GPIO_Inilize(u8 GPIO, GPIO_InitTypeDef *GPIOx);
void GPIO_config(void);
#endif