/**
|
******************************************************************************
|
* @file xl_gpio.h
|
* @author software group
|
* @brief This file contains all the functions prototypes for the GPIO
|
* firmware library.
|
******************************************************************************
|
* @attention
|
*
|
* 2019 by Chipways Communications,Inc. All Rights Reserved.
|
* This software is supplied under the terms of a license
|
* agreement or non-disclosure agreement with Chipways.
|
* Passing on and copying of this document,and communication
|
* of its contents is not permitted without prior written
|
* authorization.
|
*
|
* <h2><center>© COPYRIGHT 2019 Chipways</center></h2>
|
******************************************************************************
|
*/
|
#ifndef __XL_GPIO_H_
|
#define __XL_GPIO_H_
|
|
#ifdef __cplusplus
|
entern "C"{
|
#endif
|
/* Includes ---------------------------------------------------------------*/
|
#include "XL6600.h"
|
/** GPIO - Register Layout Typedef */
|
typedef struct {
|
__IO uint32_t PDOR; /*!< ¶Ë¿ÚÊý¾ÝÊä³ö¼Ä´æÆ÷, offset: 0x0 */
|
__O uint32_t PSOR; /*!< ¶Ë¿ÚÖÃλÊä³ö¼Ä´æÆ÷, offset: 0x4 */
|
__O uint32_t PCOR; /*!< ¶Ë¿ÚÇåÁãÊä³ö¼Ä´æÆ÷, offset: 0x8 */
|
__O uint32_t PTOR; /*!< ¶Ë¿ÚÌø±äÊä³ö¼Ä´æÆ÷, offset: 0xC */
|
__I uint32_t PDIR; /*!< ¶Ë¿ÚÊý¾ÝÊäÈë¼Ä´æÆ÷, offset: 0x10 */
|
__IO uint32_t PDDR; /*!< ¶Ë¿ÚÊý¾Ý·½Ïò¼Ä´æÆ÷, offset: 0x14 */
|
__IO uint32_t PIDR; /*!< ¶Ë¿ÚÊäÈë½ûÓüĴæÆ÷, offset: 0x18 */
|
} GPIO_Type;
|
extern GPIO_Type * GPIOA;
|
extern GPIO_Type * GPIOB;
|
extern GPIO_Type * GPIOC;
|
/** @addtogroup XL6600_StdPeriph_Driver
|
* @{
|
*/
|
|
/** @addtogroup GPIO
|
* @{
|
*/
|
|
|
/* Exported constants --------------------------------------------------------*/
|
/** @defgroup GPIO_Exported_Constants GPIOÄ£¿éʹÓòÎÊý¶¨Òå
|
* @{
|
*/
|
/** @defgroup GPIO_Direction_Seclect GPIO·½Ïò¶¨ÒåÑ¡Ôñ
|
* @{
|
*/
|
typedef enum
|
{
|
GPIO_Direction_Input =0, /*!< Òý½ÅÅäÖÃΪͨÓÃÊäÈë */
|
GPIO_Direction_Output, /*!< Òý½ÅÅäÖÃΪͨÓÃÊä³ö */
|
GPIO_Direction_High_Z /*!< Òý½ÅÅäÖÃΪ¸ß×è̬ */
|
}GPIO_Direction_Mode;
|
/**
|
* @}
|
*/
|
|
/** @defgroup GPIO_OutputLevel_Seclect GPIOÊä³öµçƽ¶¨ÒåÑ¡Ôñ
|
* @{
|
*/
|
typedef enum
|
{
|
GPIO_Output_Low =0, /*!< Êä³öÂß¼0 */
|
GPIO_Output_High /*!< Êä³öÂß¼1 */
|
}GPIO_Output_Level;
|
/**
|
* @}
|
*/
|
|
/** @defgroup GPIO_InputLevel_Seclect GPIOÊäÈëµçƽ¶¨ÒåÑ¡Ôñ
|
* @{
|
*/
|
typedef enum
|
{
|
GPIO_Input_Low =0, /*!< ÊäÈëÂß¼0 */
|
GPIO_Input_High /*!< ÊäÈëÂß¼1 */
|
}GPIO_Input_Def;
|
/**
|
* @}
|
*/
|
|
/** @defgroup GPIO_PINNum_Define GPIOÒý½Å¶¨Òå
|
* @{
|
*/
|
/* in GPIOA register */
|
#define GPIO_PTA0 0 /*!< GPIOÒý½ÅPTA0 */
|
#define GPIO_PTA1 1 /*!< GPIOÒý½ÅPTA1 */
|
#define GPIO_PTA2 2 /*!< GPIOÒý½ÅPTA2 */
|
#define GPIO_PTA3 3 /*!< GPIOÒý½ÅPTA3 */
|
#define GPIO_PTA4 4 /*!< GPIOÒý½ÅPTA4 */
|
#define GPIO_PTA5 5 /*!< GPIOÒý½ÅPTA5 */
|
#define GPIO_PTA6 6 /*!< GPIOÒý½ÅPTA6 */
|
#define GPIO_PTA7 7 /*!< GPIOÒý½ÅPTA7 */
|
#define GPIO_PTB0 8 /*!< GPIOÒý½ÅPTB0 */
|
#define GPIO_PTB1 9 /*!< GPIOÒý½ÅPTB1 */
|
#define GPIO_PTB2 10 /*!< GPIOÒý½ÅPTB2 */
|
#define GPIO_PTB3 11 /*!< GPIOÒý½ÅPTB3 */
|
#define GPIO_PTB4 12 /*!< GPIOÒý½ÅPTB4 */
|
#define GPIO_PTB5 13 /*!< GPIOÒý½ÅPTB5 */
|
#define GPIO_PTB6 14 /*!< GPIOÒý½ÅPTB6 */
|
#define GPIO_PTB7 15 /*!< GPIOÒý½ÅPTB7 */
|
#define GPIO_PTC0 16 /*!< GPIOÒý½ÅPTC0 */
|
#define GPIO_PTC1 17 /*!< GPIOÒý½ÅPTC1 */
|
#define GPIO_PTC2 18 /*!< GPIOÒý½ÅPTC2 */
|
#define GPIO_PTC3 19 /*!< GPIOÒý½ÅPTC3 */
|
#define GPIO_PTC4 20 /*!< GPIOÒý½ÅPTC4 */
|
#define GPIO_PTC5 21 /*!< GPIOÒý½ÅPTC5 */
|
#define GPIO_PTC6 22 /*!< GPIOÒý½ÅPTC6 */
|
#define GPIO_PTC7 23 /*!< GPIOÒý½ÅPTC7 */
|
#define GPIO_PTD0 24 /*!< GPIOÒý½ÅPTD0 */
|
#define GPIO_PTD1 25 /*!< GPIOÒý½ÅPTD1 */
|
#define GPIO_PTD2 26 /*!< GPIOÒý½ÅPTD2 */
|
#define GPIO_PTD3 27 /*!< GPIOÒý½ÅPTD3 */
|
#define GPIO_PTD4 28 /*!< GPIOÒý½ÅPTD4 */
|
#define GPIO_PTD5 29 /*!< GPIOÒý½ÅPTD5 */
|
#define GPIO_PTD6 30 /*!< GPIOÒý½ÅPTD6 */
|
#define GPIO_PTD7 31 /*!< GPIOÒý½ÅPTD7 */
|
/* in GPIOB register */
|
#define GPIO_PTE0 32 /*!< GPIOÒý½ÅPTE0 */
|
#define GPIO_PTE1 33 /*!< GPIOÒý½ÅPTE1 */
|
#define GPIO_PTE2 34 /*!< GPIOÒý½ÅPTE2 */
|
#define GPIO_PTE3 35 /*!< GPIOÒý½ÅPTE3 */
|
#define GPIO_PTE4 36 /*!< GPIOÒý½ÅPTE4 */
|
#define GPIO_PTE5 37 /*!< GPIOÒý½ÅPTE5 */
|
#define GPIO_PTE6 38 /*!< GPIOÒý½ÅPTE6 */
|
#define GPIO_PTE7 39 /*!< GPIOÒý½ÅPTE7 */
|
#define GPIO_PTF0 40 /*!< GPIOÒý½ÅPTF0 */
|
#define GPIO_PTF1 41 /*!< GPIOÒý½ÅPTF1 */
|
#define GPIO_PTF2 42 /*!< GPIOÒý½ÅPTF2 */
|
#define GPIO_PTF3 43 /*!< GPIOÒý½ÅPTF3 */
|
#define GPIO_PTF4 44 /*!< GPIOÒý½ÅPTF4 */
|
#define GPIO_PTF5 45 /*!< GPIOÒý½ÅPTF5 */
|
#define GPIO_PTF6 46 /*!< GPIOÒý½ÅPTF6 */
|
#define GPIO_PTF7 47 /*!< GPIOÒý½ÅPTF7 */
|
#define GPIO_PTG0 48 /*!< GPIOÒý½ÅPTG0 */
|
#define GPIO_PTG1 49 /*!< GPIOÒý½ÅPTG1 */
|
#define GPIO_PTG2 50 /*!< GPIOÒý½ÅPTG2 */
|
#define GPIO_PTG3 51 /*!< GPIOÒý½ÅPTG3 */
|
#define GPIO_PTG4 52 /*!< GPIOÒý½ÅPTG4 */
|
#define GPIO_PTG5 53 /*!< GPIOÒý½ÅPTG5 */
|
#define GPIO_PTG6 54 /*!< GPIOÒý½ÅPTG6 */
|
#define GPIO_PTG7 55 /*!< GPIOÒý½ÅPTG7 */
|
#define GPIO_PTH0 56 /*!< GPIOÒý½ÅPTH0 */
|
#define GPIO_PTH1 57 /*!< GPIOÒý½ÅPTH1 */
|
#define GPIO_PTH2 58 /*!< GPIOÒý½ÅPTH2 */
|
#define GPIO_PTH3 59 /*!< GPIOÒý½ÅPTH3 */
|
#define GPIO_PTH4 60 /*!< GPIOÒý½ÅPTH4 */
|
#define GPIO_PTH5 61 /*!< GPIOÒý½ÅPTH5 */
|
#define GPIO_PTH6 62 /*!< GPIOÒý½ÅPTH6 */
|
#define GPIO_PTH7 63 /*!< GPIOÒý½ÅPTH7 */
|
/* in GPIOC register */
|
#define GPIO_PTI0 64 /*!< GPIOÒý½ÅPTI0 */
|
#define GPIO_PTI1 65 /*!< GPIOÒý½ÅPTI1 */
|
#define GPIO_PTI2 66 /*!< GPIOÒý½ÅPTI2 */
|
#define GPIO_PTI3 67 /*!< GPIOÒý½ÅPTI3 */
|
#define GPIO_PTI4 68 /*!< GPIOÒý½ÅPTI4 */
|
#define GPIO_PTI5 69 /*!< GPIOÒý½ÅPTI5 */
|
#define GPIO_PTI6 70 /*!< GPIOÒý½ÅPTI6 */
|
/**
|
* @}
|
*/
|
|
/**
|
* @}
|
*/
|
|
/* Exported macro ------------------------------------------------------------*/
|
/* Exported functions --------------------------------------------------------*/
|
void GPIO_DeInit(GPIO_Type *GPIOx);
|
void GPIO_SetPinDir(uint8_t gpioPin,GPIO_Direction_Mode GPIO_Mode);
|
void GPIO_SetPinOutput(uint8_t gpioPin, GPIO_Output_Level Output);
|
void GPIO_TogglePin(uint8_t gpioPin);
|
void GPIO_SetPin(uint8_t gpioPin);
|
void GPIO_ClrPin(uint8_t gpioPin);
|
uint32_t GPIO_ReadReg(const GPIO_Type *GPIOx);
|
GPIO_Input_Def GPIO_ReadPin(uint8_t gpioPin);
|
GPIO_Direction_Mode GPIO_ReadPinDir(uint8_t gpioPin);
|
#ifdef __cplusplus
|
}
|
#endif
|
|
|
#endif /*__XL_GPIO_H__ */
|
/**
|
* @}
|
*/
|
|
/**
|
* @}
|
*/
|