STM32F37 Standard Peripheral bibliotheek  1.0
ST Microelectronics bibliotheek documentatie voor de STM32F37 Standard Peripheral Library
 All Data Structures Files Functions Variables Enumerations Enumerator Groups

GPIO driver modules. More...

Modules

 Configuration_Mode_enumeration
 
 Output_type_enumeration
 
 Output_Maximum_frequency_enumeration
 
 Configuration_Pull-Up_Pull-Down_enumeration
 
 Bit_SET_and_Bit_RESET_enumeration
 
 GPIO_Exported_Constants
 
 GPIO_Private_Functions
 

Data Structures

struct  GPIO_InitTypeDef
 GPIO Init structure definition. More...
 

Macros

#define IS_GPIO_ALL_PERIPH(PERIPH)
 
#define IS_GPIO_LIST_PERIPH(PERIPH)
 

Functions

void GPIO_DeInit (GPIO_TypeDef *GPIOx)
 Deinitializes the GPIOx peripheral 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...
 
void GPIO_PinLockConfig (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
 Locks GPIO Pins configuration registers. 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 input port pin. 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_PinAFConfig (GPIO_TypeDef *GPIOx, uint16_t GPIO_PinSource, uint8_t GPIO_AF)
 Writes data to the specified GPIO data port. More...
 

Detailed Description

GPIO driver modules.

Macro Definition Documentation

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

Function Documentation

void GPIO_DeInit ( GPIO_TypeDef *  GPIOx)

Deinitializes the GPIOx peripheral registers to their default reset values.

Parameters
GPIOx,:where x can be (A, B, C, D, E or F) to select the GPIO peripheral.
Return values
None
void GPIO_Init ( GPIO_TypeDef *  GPIOx,
GPIO_InitTypeDef GPIO_InitStruct 
)

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

Parameters
GPIOx,:where x can be (A, B, C, D, E or F) to select the GPIO peripheral.
GPIO_InitStruct,:pointer to a GPIO_InitTypeDef structure that contains the configuration information for the specified GPIO peripheral.
Note
The configured pins can be: GPIO_Pin_0 -> GPIO_Pin_15 for GPIOA, GPIOC, GPIOD and GPIOE; GPIO_Pin_0 -> GPIO_Pin_10 and GPIO_Pin_14 -> GPIO_Pin_15 for GPIOB; GPIO_Pin_0 -> GPIO_Pin_2, GPIO_Pin_4, GPIO_Pin_6, GPIO_Pin_9 and GPIO_Pin_10 for GPIOF.
Return values
None
void GPIO_PinAFConfig ( GPIO_TypeDef *  GPIOx,
uint16_t  GPIO_PinSource,
uint8_t  GPIO_AF 
)

Writes data to the specified GPIO data port.

Parameters
GPIOx,:where x can be (A, B, C, D, E or F) to select the GPIO peripheral.
GPIO_PinSource,:specifies the pin for the Alternate function. This parameter can be GPIO_PinSourcex where x can be (0..15).
GPIO_AF,:selects the pin to be used as Alternate function. This parameter can be one of the following value:
  • GPIO_AF_0: MCO, JTMS-SWDAT, JTCK-SWCLK, JTDI,JTDO, JTRST, TRACECLK, TRACED, TRACEWO.
  • GPIO_AF_1: TIM2, TIM15, TIM16, TIM17, OUT.
  • GPIO_AF_2: TIM3, TIM4, TIM5, TIM13, TIM14, TIM19.
  • GPIO_AF_3: Touch Sence.
  • GPIO_AF_4: I2C1, I2C2.
  • GPIO_AF_5: SPI1, SPI2, IR_OUT.
  • GPIO_AF_6: SPI1, SPI3, CEC, IR_OUT.
  • GPIO_AF_7: USART1, USART2, USART3, CAN, CEC.
  • GPIO_AF_8: COMP1_OUT, COMP2_OUT.
  • GPIO_AF_9: CAN, TIM12, TIM13, TIM14, TIM15.
  • GPIO_AF_10: TIM2, TIM3, TIM4, TIM12, TIM17.
  • GPIO_AF_11: TIM19.
  • GPIO_AF_14: USBDM, USBDP.
  • GPIO_AF_15: OUT.
Note
The pin should already been configured in Alternate Function mode(AF) using GPIO_InitStruct->GPIO_Mode = GPIO_Mode_AF
Refer to the Alternate function mapping table in the device datasheet for the detailed mapping of the system and peripherals'alternate function I/O pins.
Return values
None
void GPIO_PinLockConfig ( GPIO_TypeDef *  GPIOx,
uint16_t  GPIO_Pin 
)

Locks GPIO Pins configuration registers.

Note
The locked registers are GPIOx_MODER, GPIOx_OTYPER, GPIOx_OSPEEDR, GPIOx_PUPDR, GPIOx_AFRL and GPIOx_AFRH.
The configuration of the locked GPIO pins can no longer be modified until the next device reset.
Parameters
GPIOx,:where x can be (A or B or D) to select the GPIO peripheral.
GPIO_Pin,:specifies the port bit to be written. This parameter can be any combination of GPIO_Pin_x where x can be (0..15).
Return values
None
uint16_t GPIO_ReadInputData ( GPIO_TypeDef *  GPIOx)

Reads the specified input port pin.

Parameters
GPIOx,:where x can be (A, B, C, D, E or F) to select the GPIO peripheral.
Return values
Theinput port pin value.
uint8_t GPIO_ReadInputDataBit ( GPIO_TypeDef *  GPIOx,
uint16_t  GPIO_Pin 
)

Reads the specified input port pin.

Parameters
GPIOx,:where x can be (A, B, C, D, E or F) to select the GPIO peripheral.
GPIO_Pin,:specifies the port bit to read.
Note
This parameter can be GPIO_Pin_x where x can be: (0..15) for GPIOA, GPIOC, GPIOD or GPIOE; (0..10 & 14..15) for GPIOB; (0..2, 4, 6, 9..10) for GPIOF.
Return values
Theinput port pin value.
uint16_t GPIO_ReadOutputData ( GPIO_TypeDef *  GPIOx)

Reads the specified GPIO output data port.

Parameters
GPIOx,:where x can be (A, B, C, D, E or F) to select the GPIO peripheral.
Return values
GPIOoutput data port value.
uint8_t GPIO_ReadOutputDataBit ( GPIO_TypeDef *  GPIOx,
uint16_t  GPIO_Pin 
)

Reads the specified output data port bit.

Parameters
GPIOx,:where x can be (A, B, C, D, E or F) to select the GPIO peripheral.
GPIO_Pin,:Specifies the port bit to read.
Note
This parameter can be GPIO_Pin_x where x can be: (0..15) for GPIOA, GPIOC, GPIOD or GPIOE; (0..10 & 14..15) for GPIOB; (0..2, 4, 6, 9..10) for GPIOF.
Return values
Theoutput port pin value.
void GPIO_ResetBits ( GPIO_TypeDef *  GPIOx,
uint16_t  GPIO_Pin 
)

Clears the selected data port bits.

Parameters
GPIOx,:where x can be (A, B, C, D, E or F) to select the GPIO peripheral.
GPIO_Pin,:specifies the port bits to be written.
Note
This parameter can be GPIO_Pin_x where x can be: (0..15) for GPIOA, GPIOC, GPIOD or GPIOE; (0..10 & 14..15) for GPIOB; (0..2, 4, 6, 9..10) for GPIOF.
Return values
None
void GPIO_SetBits ( GPIO_TypeDef *  GPIOx,
uint16_t  GPIO_Pin 
)

Sets the selected data port bits.

Parameters
GPIOx,:where x can be (A, B, C, D, E or F) to select the GPIO peripheral.
GPIO_Pin,:specifies the port bits to be written.
Note
This parameter can be GPIO_Pin_x where x can be: (0..15) for GPIOA, GPIOC, GPIOD or GPIOE; (0..10 & 14..15) for GPIOB; (0..2, 4, 6, 9..10) for GPIOF.
Return values
None
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.
Return values
None
void GPIO_Write ( GPIO_TypeDef *  GPIOx,
uint16_t  PortVal 
)

Writes data to the specified GPIO data port.

Parameters
GPIOx,:where x can be (A, B, C, D, E or F) to select the GPIO peripheral.
PortVal,:specifies the value to be written to the port output data register.
Return values
None
void GPIO_WriteBit ( GPIO_TypeDef *  GPIOx,
uint16_t  GPIO_Pin,
BitAction  BitVal 
)

Sets or clears the selected data port bit.

Parameters
GPIOx,:where x can be (A, B, C, D, E or F) to select the GPIO peripheral.
GPIO_Pin,:specifies the port bit to be written.
Note
This parameter can be GPIO_Pin_x where x can be: (0..15) for GPIOA, GPIOC, GPIOD or GPIOE; (0..10 & 14..15) for GPIOB; (0..2, 4, 6, 9..10) for GPIOF.
Parameters
BitVal,:specifies the value to be written to the selected bit. This parameter can be one of the BitAction enumeration values:
  • Bit_RESET: to clear the port pin
  • Bit_SET: to set the port pin
Return values
None