MG32F157 Standard Peripherals Firmware Library
Modules | Data Structures | Macros | Enumerations | Functions

GPIO driver modules. More...

Modules

 GPIO_Exported_Constants
 
 GPIO_Private_Defines
 
 GPIO_Private_Functions
 

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))
 

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

GPIO driver modules.

Macro Definition Documentation

◆ IS_GPIO_ALL_PERIPH

#define IS_GPIO_ALL_PERIPH (   PERIPH)
Value:
(((PERIPH) == GPIOA) || \
((PERIPH) == GPIOB) || \
((PERIPH) == GPIOC) || \
((PERIPH) == GPIOD) || \
((PERIPH) == GPIOE))

◆ IS_GPIO_MODE

#define IS_GPIO_MODE (   MODE)
Value:
(((MODE) == GPIO_Mode_AIN) || ((MODE) == GPIO_Mode_IN_FLOATING) || \
((MODE) == GPIO_Mode_IPD) || ((MODE) == GPIO_Mode_IPU) || \
((MODE) == GPIO_Mode_Out_OD) || ((MODE) == GPIO_Mode_Out_PP) || \
((MODE) == GPIO_Mode_AF_OD) || ((MODE) == GPIO_Mode_AF_PP))

◆ IS_GPIO_SPEED

#define IS_GPIO_SPEED (   SPEED)
Value:
(((SPEED) == GPIO_Speed_10MHz) || ((SPEED) == GPIO_Speed_2MHz) || \
((SPEED) == GPIO_Speed_50MHz))

Enumeration Type Documentation

◆ BitAction

enum BitAction

Bit_SET and Bit_RESET enumeration.

◆ GPIOMode_TypeDef

Configuration Mode enumeration.

◆ GPIOSpeed_TypeDef

Output Maximum frequency selection.

Function Documentation

◆ GPIO_AFIODeInit()

void GPIO_AFIODeInit ( void  )

Deinitializes the Alternate Functions (remap, event control and EXTI configuration) registers to their default reset values.

Parameters
None
Returns
None

◆ GPIO_DeInit()

void GPIO_DeInit ( GPIO_TypeDef GPIOx)

Deinitializes the GPIOx peripheral registers to their default reset values.

Parameters
GPIOxwhere x can be (A..G) to select the GPIO peripheral.
Returns
None

◆ GPIO_EventOutputCmd()

void GPIO_EventOutputCmd ( FunctionalState  NewState)

Enables or disables the Event Output.

Parameters
NewStatenew state of the Event output. This parameter can be: ENABLE or DISABLE.
Returns
None

◆ GPIO_EventOutputConfig()

void GPIO_EventOutputConfig ( uint8_t  GPIO_PortSource,
uint8_t  GPIO_PinSource 
)

Selects the GPIO pin used as Event output.

Parameters
GPIO_PortSourceselects the GPIO port to be used as source for Event output. This parameter can be GPIO_PortSourceGPIOx where x can be (A..E).
GPIO_PinSourcespecifies the pin for the Event output. This parameter can be GPIO_PinSourcex where x can be (0..15).
Returns
None

◆ GPIO_EXTILineConfig()

void GPIO_EXTILineConfig ( uint8_t  GPIO_PortSource,
uint8_t  GPIO_PinSource 
)

Selects the GPIO pin used as EXTI Line.

Parameters
GPIO_PortSourceselects the GPIO port to be used as source for EXTI lines. This parameter can be GPIO_PortSourceGPIOx where x can be (A..G).
GPIO_PinSourcespecifies the EXTI line to be configured. This parameter can be GPIO_PinSourcex where x can be (0..15).
Returns
None

◆ GPIO_Init()

void GPIO_Init ( GPIO_TypeDef GPIOx,
GPIO_InitTypeDef GPIO_InitStruct 
)

Initializes the GPIOx peripheral according to the specified parameters in the GPIO_InitStruct.

Parameters
GPIOxwhere x can be (A..G) to select the GPIO peripheral.
GPIO_InitStructpointer to a GPIO_InitTypeDef structure that contains the configuration information for the specified GPIO peripheral.
Returns
None

◆ GPIO_PinLockConfig()

void GPIO_PinLockConfig ( GPIO_TypeDef GPIOx,
uint16_t  GPIO_Pin 
)

Locks GPIO Pins configuration registers.

Parameters
GPIOxwhere x can be (A..G) to select the GPIO peripheral.
GPIO_Pinspecifies the port bit to be written. This parameter can be any combination of GPIO_Pin_x where x can be (0..15).
Returns
None

◆ GPIO_PinRemapConfig()

void GPIO_PinRemapConfig ( uint32_t  GPIO_Remap,
FunctionalState  NewState 
)

Changes the mapping of the specified pin.

Parameters
GPIO_Remapselects the pin to remap. This parameter can be one of the following values:
NewStatenew state of the port pin remapping. This parameter can be: ENABLE or DISABLE.
Returns
None

◆ GPIO_ReadInputData()

uint16_t GPIO_ReadInputData ( GPIO_TypeDef GPIOx)

Reads the specified GPIO input data port.

Parameters
GPIOxwhere x can be (A..G) to select the GPIO peripheral.
Returns
GPIO input data port value.

◆ GPIO_ReadInputDataBit()

uint8_t GPIO_ReadInputDataBit ( GPIO_TypeDef GPIOx,
uint16_t  GPIO_Pin 
)

Reads the specified input port pin.

Parameters
GPIOxwhere x can be (A..G) to select the GPIO peripheral.
GPIO_Pinspecifies the port bit to read. This parameter can be GPIO_Pin_x where x can be (0..15).
Returns
The input port pin value.

◆ GPIO_ReadOutputData()

uint16_t GPIO_ReadOutputData ( GPIO_TypeDef GPIOx)

Reads the specified GPIO output data port.

Parameters
GPIOxwhere x can be (A..G) to select the GPIO peripheral.
Returns
GPIO output data port value.

◆ GPIO_ReadOutputDataBit()

uint8_t GPIO_ReadOutputDataBit ( GPIO_TypeDef GPIOx,
uint16_t  GPIO_Pin 
)

Reads the specified output data port bit.

Parameters
GPIOxwhere x can be (A..G) to select the GPIO peripheral.
GPIO_Pinspecifies the port bit to read. This parameter can be GPIO_Pin_x where x can be (0..15).
Returns
The output port pin value.

◆ GPIO_ResetBits()

void GPIO_ResetBits ( GPIO_TypeDef GPIOx,
uint16_t  GPIO_Pin 
)

Clears the selected data port bits.

Parameters
GPIOxwhere x can be (A..G) to select the GPIO peripheral.
GPIO_Pinspecifies the port bits to be written. This parameter can be any combination of GPIO_Pin_x where x can be (0..15).
Returns
None

◆ GPIO_SetBits()

void GPIO_SetBits ( GPIO_TypeDef GPIOx,
uint16_t  GPIO_Pin 
)

Sets the selected data port bits.

Parameters
GPIOxwhere x can be (A..G) to select the GPIO peripheral.
GPIO_Pinspecifies the port bits to be written. This parameter can be any combination of GPIO_Pin_x where x can be (0..15).
Returns
None

◆ GPIO_StructInit()

void GPIO_StructInit ( GPIO_InitTypeDef GPIO_InitStruct)

Fills each GPIO_InitStruct member with its default value.

Parameters
GPIO_InitStruct: pointer to a GPIO_InitTypeDef structure which will be initialized.
Returns
None

◆ GPIO_ToggleBits()

void GPIO_ToggleBits ( GPIO_TypeDef GPIOx,
uint16_t  GPIO_Pin 
)

Toggle data value for several pin of specified port.

Parameters
GPIOxwhere x can be (A..D) to select the GPIO peripheral.
GPIO_Pinspecifies the pins to be toggled. This parameter can be any combination of GPIO_Pin_x where x can be (0..15).
Returns
None

◆ GPIO_Write()

void GPIO_Write ( GPIO_TypeDef GPIOx,
uint16_t  PortVal 
)

Writes data to the specified GPIO data port.

Parameters
GPIOxwhere x can be (A..G) to select the GPIO peripheral.
PortValspecifies the value to be written to the port output data register.
Returns
None

◆ GPIO_WriteBit()

void GPIO_WriteBit ( GPIO_TypeDef GPIOx,
uint16_t  GPIO_Pin,
BitAction  BitVal 
)

Sets or clears the selected data port bit.

Parameters
GPIOxwhere x can be (A..G) to select the GPIO peripheral.
GPIO_Pinspecifies the port bit to be written. This parameter can be one of GPIO_Pin_x where x can be (0..15).
BitValspecifies the value to be written to the selected bit. This parameter can be one of the BitAction enum values:
  • Bit_RESET: to clear the port pin
  • Bit_SET: to set the port pin
Returns
None