MG32F157 Standard Peripherals Firmware Library
Data Structures | Macros | Enumerations | Functions
mg32f157_gpio.h File Reference

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

#include "mg32f157.h"

Go to the source code of this file.

Data Structures

struct  GPIO_InitTypeDef
 GPIO Init structure definition. More...
 

Macros

#define IS_GPIO_ALL_PERIPH(PERIPH)
 
#define IS_GPIO_SPEED(SPEED)
 
#define IS_GPIO_MODE(MODE)
 
#define IS_GPIO_BIT_ACTION(ACTION)   (((ACTION) == Bit_RESET) || ((ACTION) == Bit_SET))
 
#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_8   ((uint16_t)0x0100)
 
#define GPIO_Pin_9   ((uint16_t)0x0200)
 
#define GPIO_Pin_10   ((uint16_t)0x0400)
 
#define GPIO_Pin_11   ((uint16_t)0x0800)
 
#define GPIO_Pin_12   ((uint16_t)0x1000)
 
#define GPIO_Pin_13   ((uint16_t)0x2000)
 
#define GPIO_Pin_14   ((uint16_t)0x4000)
 
#define GPIO_Pin_15   ((uint16_t)0x8000)
 
#define GPIO_Pin_All   ((uint16_t)0xFFFF)
 
#define IS_GPIO_PIN(PIN)   ((((PIN) & (uint16_t)0x00) == 0x00) && ((PIN) != (uint16_t)0x00))
 
#define IS_GET_GPIO_PIN(PIN)
 
#define GPIO_Remap_SPI1   ((uint32_t)0x00000001)
 
#define GPIO_Remap_I2C1   ((uint32_t)0x00000002)
 
#define GPIO_Remap_USART1   ((uint32_t)0x00000004)
 
#define GPIO_Remap_USART2   ((uint32_t)0x00000008)
 
#define GPIO_PartialRemap_USART3   ((uint32_t)0x00140010)
 
#define GPIO_FullRemap_USART3   ((uint32_t)0x00140030)
 
#define GPIO_PartialRemap_TIM1   ((uint32_t)0x00160040)
 
#define GPIO_FullRemap_TIM1   ((uint32_t)0x001600C0)
 
#define GPIO_PartialRemap1_TIM2   ((uint32_t)0x00180100)
 
#define GPIO_PartialRemap2_TIM2   ((uint32_t)0x00180200)
 
#define GPIO_FullRemap_TIM2   ((uint32_t)0x00180300)
 
#define GPIO_PartialRemap_TIM3   ((uint32_t)0x001A0800)
 
#define GPIO_FullRemap_TIM3   ((uint32_t)0x001A0C00)
 
#define GPIO_Remap_TIM4   ((uint32_t)0x00001000)
 
#define GPIO_Remap1_CAN1   ((uint32_t)0x001D4000)
 
#define GPIO_Remap2_CAN1   ((uint32_t)0x001D6000)
 
#define GPIO_Remap_PD01   ((uint32_t)0x00008000)
 
#define GPIO_Remap_TIM5CH4_LSI   ((uint32_t)0x00200001)
 
#define GPIO_Remap_ADC1_ETRGINJ   ((uint32_t)0x00200002)
 
#define GPIO_Remap_ADC1_ETRGREG   ((uint32_t)0x00200004)
 
#define GPIO_Remap_ADC2_ETRGINJ   ((uint32_t)0x00200008)
 
#define GPIO_Remap_ADC2_ETRGREG   ((uint32_t)0x00200010)
 
#define GPIO_Remap_SWJ_NoJTRST   ((uint32_t)0x00300100)
 
#define GPIO_Remap_SWJ_JTAGDisable   ((uint32_t)0x00300200)
 
#define GPIO_Remap_SWJ_Disable   ((uint32_t)0x00300400)
 
#define GPIO_Remap_OPA1   ((uint32_t)0x00202000)
 
#define GPIO_Remap_OPA2   ((uint32_t)0x00204000)
 
#define GPIO_Remap_OPA3   ((uint32_t)0x00208000)
 
#define IS_GPIO_REMAP(REMAP)
 
#define GPIO_PortSourceGPIOA   ((uint8_t)0x00)
 
#define GPIO_PortSourceGPIOB   ((uint8_t)0x01)
 
#define GPIO_PortSourceGPIOC   ((uint8_t)0x02)
 
#define GPIO_PortSourceGPIOD   ((uint8_t)0x03)
 
#define GPIO_PortSourceGPIOE   ((uint8_t)0x04)
 
#define IS_GPIO_EVENTOUT_PORT_SOURCE(PORTSOURCE)
 
#define IS_GPIO_EXTI_PORT_SOURCE(PORTSOURCE)
 
#define GPIO_PinSource0   ((uint8_t)0x00)
 
#define GPIO_PinSource1   ((uint8_t)0x01)
 
#define GPIO_PinSource2   ((uint8_t)0x02)
 
#define GPIO_PinSource3   ((uint8_t)0x03)
 
#define GPIO_PinSource4   ((uint8_t)0x04)
 
#define GPIO_PinSource5   ((uint8_t)0x05)
 
#define GPIO_PinSource6   ((uint8_t)0x06)
 
#define GPIO_PinSource7   ((uint8_t)0x07)
 
#define GPIO_PinSource8   ((uint8_t)0x08)
 
#define GPIO_PinSource9   ((uint8_t)0x09)
 
#define GPIO_PinSource10   ((uint8_t)0x0A)
 
#define GPIO_PinSource11   ((uint8_t)0x0B)
 
#define GPIO_PinSource12   ((uint8_t)0x0C)
 
#define GPIO_PinSource13   ((uint8_t)0x0D)
 
#define GPIO_PinSource14   ((uint8_t)0x0E)
 
#define GPIO_PinSource15   ((uint8_t)0x0F)
 
#define IS_GPIO_PIN_SOURCE(PINSOURCE)
 
#define GPIO_ETH_MediaInterface_MII   ((u32)0x00000000)
 
#define GPIO_ETH_MediaInterface_RMII   ((u32)0x00000001)
 
#define IS_GPIO_ETH_MEDIA_INTERFACE(INTERFACE)
 

Enumerations

enum  GPIOSpeed_TypeDef { GPIO_Speed_10MHz = 1, GPIO_Speed_2MHz, GPIO_Speed_50MHz }
 Output Maximum frequency selection. More...
 
enum  GPIOMode_TypeDef {
  GPIO_Mode_AIN = 0x0, GPIO_Mode_IN_FLOATING = 0x04, GPIO_Mode_IPD = 0x28, GPIO_Mode_IPU = 0x48,
  GPIO_Mode_Out_OD = 0x14, GPIO_Mode_Out_PP = 0x10, GPIO_Mode_AF_OD = 0x1C, GPIO_Mode_AF_PP = 0x18
}
 Configuration Mode enumeration. More...
 
enum  BitAction { Bit_RESET = 0, Bit_SET }
 Bit_SET and Bit_RESET enumeration. More...
 

Functions

void GPIO_DeInit (GPIO_TypeDef *GPIOx)
 Deinitializes the GPIOx peripheral registers to their default reset values. More...
 
void GPIO_AFIODeInit (void)
 Deinitializes the Alternate Functions (remap, event control and EXTI configuration) registers to their default reset values. More...
 
void GPIO_Init (GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_InitStruct)
 Initializes the GPIOx peripheral according to the specified parameters in the GPIO_InitStruct. More...
 
void GPIO_StructInit (GPIO_InitTypeDef *GPIO_InitStruct)
 Fills each GPIO_InitStruct member with its default value. 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_PinLockConfig (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
 Locks GPIO Pins configuration registers. More...
 
void GPIO_EventOutputConfig (uint8_t GPIO_PortSource, uint8_t GPIO_PinSource)
 Selects the GPIO pin used as Event output. More...
 
void GPIO_EventOutputCmd (FunctionalState NewState)
 Enables or disables the Event Output. More...
 
void GPIO_PinRemapConfig (uint32_t GPIO_Remap, FunctionalState NewState)
 Changes the mapping of the specified pin. More...
 
void GPIO_EXTILineConfig (uint8_t GPIO_PortSource, uint8_t GPIO_PinSource)
 Selects the GPIO pin used as EXTI Line. More...
 

Detailed Description

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

Author
MegawinTech Application Team
Version
V0.0.4
Date
16-June-2023