2023-03-23 17:00:05 +08:00

64 lines
2.1 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.

/*---------------------------------------------------------------------*/
/* --- 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 -------------------------------------------------*/
/* <20><><EFBFBD>Ҫ<EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>ô˴<C3B4><CBB4><EFBFBD>,<2C><><EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>STC<54><43><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD> */
/*---------------------------------------------------------------------*/
#ifndef __GPIO_H
#define __GPIO_H
#include "config.h"
#define GPIO_PullUp 0 //<2F><><EFBFBD><EFBFBD>׼˫<D7BC><CBAB><EFBFBD>
#define GPIO_HighZ 1 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define GPIO_OUT_OD 2 //<2F><>©<EFBFBD><C2A9><EFBFBD>
#define GPIO_OUT_PP 3 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define GPIO_Pin_0 0x01 //IO<49><4F><EFBFBD><EFBFBD> Px.0
#define GPIO_Pin_1 0x02 //IO<49><4F><EFBFBD><EFBFBD> Px.1
#define GPIO_Pin_2 0x04 //IO<49><4F><EFBFBD><EFBFBD> Px.2
#define GPIO_Pin_3 0x08 //IO<49><4F><EFBFBD><EFBFBD> Px.3
#define GPIO_Pin_4 0x10 //IO<49><4F><EFBFBD><EFBFBD> Px.4
#define GPIO_Pin_5 0x20 //IO<49><4F><EFBFBD><EFBFBD> Px.5
#define GPIO_Pin_6 0x40 //IO<49><4F><EFBFBD><EFBFBD> Px.6
#define GPIO_Pin_7 0x80 //IO<49><4F><EFBFBD><EFBFBD> Px.7
#define GPIO_Pin_All 0xFF //IO<49><4F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#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
#define k5 P10
#define k6 P37
#define k7 P36
#define k8 P35
#define k1 P15
#define k2 P16
#define k3 P17
#define k4 P54
#define DIR P12
#define PUL P13
#define EN P14
typedef struct
{
u8 Mode; //IOģʽ, GPIO_PullUp,GPIO_HighZ,GPIO_OUT_OD,GPIO_OUT_PP
u8 Pin; //Ҫ<><D2AA><EFBFBD>õĶ˿<C4B6>
} GPIO_InitTypeDef;
u8 GPIO_Inilize(u8 GPIO, GPIO_InitTypeDef *GPIOx);
void GPIO_config(void);
#endif