MG32L003 Standard Peripherals Firmware Library
Macros | Enumerations | Functions
mg32l003_gpio.h File Reference

This file contains all the functions prototypes for the GPIO firmware library. More...

#include "mg32l003.h"

Go to the source code of this file.

Macros

#define GPIO_Pin_0   ((uint16_t)0x0001)
 
#define GPIO_Pin_1   ((uint16_t)0x0002)
 
#define GPIO_Pin_2   ((uint16_t)0x0004)
 
#define GPIO_Pin_3   ((uint16_t)0x0008)
 
#define GPIO_Pin_4   ((uint16_t)0x0010)
 
#define GPIO_Pin_5   ((uint16_t)0x0020)
 
#define GPIO_Pin_6   ((uint16_t)0x0040)
 
#define GPIO_Pin_7   ((uint16_t)0x0080)
 
#define GPIO_Pin_All   ((uint16_t)0x00FF)
 
#define GPIO_MODE_IN   ((uint32_t)0x00000000U)
 
#define GPIO_MODE_OUT   ((uint32_t)0x10000000U)
 
#define GPIO_OTYPE_PP   ((uint32_t)0x00000000U)
 
#define GPIO_OTYPE_OD   ((uint32_t)0x01000000U)
 
#define GPIO_SPEED_LOW   ((uint32_t)0x00000000U)
 
#define GPIO_SPEED_HIGH   ((uint32_t)0x00100000U)
 
#define GPIO_PUPD_NOPULL   ((uint32_t)0x00000000U)
 
#define GPIO_PUPD_UP   ((uint32_t)0x00010000U)
 
#define GPIO_PUPD_DOWN   ((uint32_t)0x00020000U)
 
#define GPIO_DRV_HIGH   ((uint32_t)0x00000000U)
 
#define GPIO_DRV_LOW   ((uint32_t)0x00001000U)
 
#define GPIO_EXTI_IT_DISABLE   ((uint32_t)0x00000000U)
 
#define GPIO_EXTI_IT_ENABLE   ((uint32_t)0x00000100U)
 
#define GPIO_EXTI_TRIGGER_EDGE   ((uint32_t)0x00000000U)
 
#define GPIO_EXTI_TRIGGER_LEVEL   ((uint32_t)0x00000200U)
 
#define GPIO_EXTI_TRIGGER_LOW   ((uint32_t)0x00000000U)
 
#define GPIO_EXTI_TRIGGER_HIGH   ((uint32_t)0x00000400U)
 
#define GPIO_EXTI_TRIGGER_FALLING   ((uint32_t)0x00000000U)
 
#define GPIO_EXTI_TRIGGER_RISSING   ((uint32_t)0x00000400U)
 
#define GPIO_EXTI_TRIGGER_RISSING_FALLING   ((uint32_t)0x00000800U)
 
#define GPIO_EXTI_Mask   ((uint32_t)0x00000F00U)
 
#define GPIO_DB_DISABLE   ((uint32_t)0x00000000U)
 
#define GPIO_DB_ENABLE   ((uint32_t)0x00000010U)
 
#define GPIO_DB_SYNC_DISABLE   ((uint32_t)0x00000000U)
 
#define GPIO_DB_SYNC_ENABLE   ((uint32_t)0x00000020U)
 
#define GPIO_DB_CLK_DIV_1   ((uint32_t)0x00000000U)
 
#define GPIO_DB_CLK_DIV_2   ((uint32_t)0x00000001U)
 
#define GPIO_DB_CLK_DIV_4   ((uint32_t)0x00000002U)
 
#define GPIO_DB_CLK_DIV_8   ((uint32_t)0x00000003U)
 
#define GPIO_DB_CLK_DIV_16   ((uint32_t)0x00000004U)
 
#define GPIO_DB_CLK_DIV_32   ((uint32_t)0x00000005U)
 
#define GPIO_DB_CLK_DIV_64   ((uint32_t)0x00000006U)
 
#define GPIO_DB_CLK_DIV_128   ((uint32_t)0x00000007U)
 
#define GPIO_DB_CLK_DIV_256   ((uint32_t)0x00000008U)
 
#define GPIO_DB_CLK_DIV_512   ((uint32_t)0x00000009U)
 
#define GPIO_DB_CLK_DIV_1024   ((uint32_t)0x0000000AU)
 
#define GPIO_DB_CLK_DIV_2048   ((uint32_t)0x0000000BU)
 
#define GPIO_DB_CLK_DIV_4096   ((uint32_t)0x0000000CU)
 
#define GPIO_DB_CLK_DIV_8192   ((uint32_t)0x0000000DU)
 
#define GPIO_DB_CLK_DIV_16384   ((uint32_t)0x0000000EU)
 
#define GPIO_DB_CLK_DIV_32768   ((uint32_t)0x0000000FU)
 
#define GPIO_DB_Mask   ((uint32_t)0x000000FFU)
 
#define GPIO_AF0   ((uint32_t)0x00000000U)
 
#define GPIO_AF1   ((uint32_t)0x00000001U)
 
#define GPIO_AF2   ((uint32_t)0x00000002U)
 
#define GPIO_AF3   ((uint32_t)0x00000003U)
 
#define GPIO_AF4   ((uint32_t)0x00000004U)
 
#define GPIO_AF5   ((uint32_t)0x00000005U)
 
#define GPIO_AF6   ((uint32_t)0x00000006U)
 
#define GPIO_AF7   ((uint32_t)0x00000007U)
 
#define GPIO_AF8   ((uint32_t)0x00000008U)
 
#define GPIO_AF9   ((uint32_t)0x00000009U)
 
#define GPIO_AF10   ((uint32_t)0x0000000AU)
 
#define GPIO_AF11   ((uint32_t)0x0000000BU)
 
#define GPIO_AF12   ((uint32_t)0x0000000CU)
 
#define GPIO_AF13   ((uint32_t)0x0000000DU)
 
#define GPIO_AF14   ((uint32_t)0x0000000EU)
 
#define GPIO_AF15   ((uint32_t)0x0000000FU)
 
#define GPIO_AF_Mask   ((uint32_t)0x0000000FU)
 
#define IS_GPIO_ALL_PERIPH(PERIPH)
 
#define IS_GET_GPIO_PIN(PIN)
 
#define IS_GPIO_PIN(PIN)   (((PIN) & 0x000000FF) != (uint32_t)0x00)
 
#define IS_GPIO_BIT_ACTION(ACTION)   (((ACTION) == Bit_RESET) || ((ACTION) == Bit_SET))
 

Enumerations

enum  BitAction { Bit_RESET = 0, Bit_SET }
 GPIO Bit SET and Bit RESET enumeration.
 

Functions

void GPIO_DeInit (GPIO_TypeDef *GPIOx)
 De-initializes the GPIOx peripheral registers to their default reset values. More...
 
void GPIO_Init (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, uint32_t PinConfig)
 Initializes the GPIOx peripheral according to the PinConfig. More...
 
void GPIO_SetAFPin (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, uint32_t Alternate)
 Configure gpio alternate function of any pins for a dedicated port. More...
 
uint8_t GPIO_ReadInputDataBit (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
 Reads the specified input port pin. More...
 
uint16_t GPIO_ReadInputData (GPIO_TypeDef *GPIOx)
 Reads the specified GPIO input data port. More...
 
uint8_t GPIO_ReadOutputDataBit (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
 Reads the specified output data port bit. More...
 
uint16_t GPIO_ReadOutputData (GPIO_TypeDef *GPIOx)
 Reads the specified GPIO output data port. More...
 
void GPIO_SetBits (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
 Sets the selected data port bits. More...
 
void GPIO_ResetBits (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
 Clears the selected data port bits. More...
 
void GPIO_WriteBit (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, BitAction BitVal)
 Sets or clears the selected data port bit. More...
 
void GPIO_Write (GPIO_TypeDef *GPIOx, uint16_t PortVal)
 Writes data to the specified GPIO data port. More...
 
void GPIO_ToggleBits (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
 Toggle data value for several pin of specified port. More...
 
void GPIO_DriveCurrentConfig (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, uint32_t Current)
 Configure the drive current of several pins for a specified port. More...
 
void GPIO_EXTIConfig (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, uint32_t EXTI_Config)
 Handles the configuration of GPIO_Pin's EXTI. More...
 
void GPIO_DebounceConfig (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, uint32_t DebounceConfig)
 Handles the configuration of GPIO debounce. More...
 
FlagStatus GPIO_EXTI_GetFlagStatus (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
 Checks whether the specified GPIO_Pin's EXTI line flag is set or not. More...
 
void GPIO_EXTI_ClearFlag (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
 Clears the GPIO_Pin's EXTI line pending flags. More...
 
ITStatus GPIO_EXTI_GetIT (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
 Checks that the interrupt of the EXTI line for the specified GPIO Pin is enabled. More...
 
void GPIO_EXTI_ClearIT (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
 Clears the GPIO_Pin's EXTI line pending bits. More...
 

Detailed Description

This file contains all the functions prototypes for the GPIO firmware library.

Author
megawinTech Application Team
Version
V0.0.5
Date
13-August-2024