LL GPIO Functions

Port Configuration

group GPIO_LL_EF_Port_Configuration

Functions

void LL_GPIO_SetPinMode ( GPIO_TypeDef * gpiox , uint32_t pin , uint32_t mode )

Configure the GPIO mode for a dedicated pin on a dedicated port.

Reference Manual to LL API cross reference (Register Field Functions)

MODER MODEy LL_GPIO_SetPinMode

Note

I/O mode can be input mode, general-purpose output mode, alternate function mode, or analog mode.

Parameters :
uint32_t LL_GPIO_GetPinMode ( const GPIO_TypeDef * gpiox , uint32_t pin )

Return the GPIO mode for a dedicated pin on a dedicated port.

Reference Manual to LL API cross reference (Register Field Functions)

MODER MODEy LL_GPIO_GetPinMode

Note

I/O mode can be input mode, general-purpose output mode, alternate function mode, or analog mode.

Parameters :
Return values :

Returned – value can be one of the following values:

void LL_GPIO_SetPinOutputType ( GPIO_TypeDef * gpiox , uint32_t pin_mask , uint32_t output_type )

Configure the GPIO output type for several pins on a dedicated port.

Reference Manual to LL API cross reference (Register Field Functions)

OTYPER OTy LL_GPIO_SetPinOutputType

Note

Set the output type when the GPIO pin is in output or alternate mode. Possible types are push-pull or open-drain.

Parameters :
uint32_t LL_GPIO_GetPinOutputType ( const GPIO_TypeDef * gpiox , uint32_t pin )

Return the GPIO output type for several pins on a dedicated port.

Reference Manual to LL API cross reference (Register Field Functions)

OTYPER OTy LL_GPIO_GetPinOutputType

Note

Set the output type when the GPIO pin is in output or alternate mode. Possible types are push-pull or open-drain.

Parameters :
Return values :

Returned – value can be one of the following values:

void LL_GPIO_SetPinSpeed ( GPIO_TypeDef * gpiox , uint32_t pin , uint32_t speed )

Configure the GPIO speed for a dedicated pin on a dedicated port.

Reference Manual to LL API cross reference (Register Field Functions)

OSPEEDR OSPEEDy LL_GPIO_SetPinSpeed

Note

I/O speed can be low, medium, fast, or high speed.

Note

Refer to the datasheet for frequency specifications and the power supply and load conditions for each speed.

Parameters :
uint32_t LL_GPIO_GetPinSpeed ( const GPIO_TypeDef * gpiox , uint32_t pin )

Return the GPIO speed for a dedicated pin on a dedicated port.

Reference Manual to LL API cross reference (Register Field Functions)

OSPEEDR OSPEEDy LL_GPIO_GetPinSpeed

Note

I/O speed can be low, medium, fast, or high speed.

Note

Refer to the datasheet for frequency specifications and the power supply and load conditions for each speed.

Parameters :
Return values :

Returned – value can be one of the following values:

void LL_GPIO_SetPinPull ( GPIO_TypeDef * gpiox , uint32_t pin , uint32_t pull )

Configure GPIO pull-up or pull-down for a dedicated pin on a dedicated port.

Reference Manual to LL API cross reference (Register Field Functions)

PUPDR PUPDy LL_GPIO_SetPinPull

Parameters :
uint32_t LL_GPIO_GetPinPull ( const GPIO_TypeDef * gpiox , uint32_t pin )

Return the GPIO pull-up or pull-down for a dedicated pin on a dedicated port.

Reference Manual to LL API cross reference (Register Field Functions)

PUPDR PUPDy LL_GPIO_GetPinPull

Parameters :
Return values :

Returned – value can be one of the following values:

void LL_GPIO_SetAFPin_0_7 ( GPIO_TypeDef * gpiox , uint32_t pin , uint32_t alternate )

Configure GPIO alternate function of a dedicated pin from 0 to 7 for a dedicated port.

Reference Manual to LL API cross reference (Register Field Functions)

AFRL AFSELy LL_GPIO_SetAFPin_0_7

Note

Possible values are from AF0 to AF15 depending on target.

Parameters :
uint32_t LL_GPIO_GetAFPin_0_7 ( const GPIO_TypeDef * gpiox , uint32_t pin )

Return GPIO alternate function of a dedicated pin from 0 to 7 for a dedicated port.

Reference Manual to LL API cross reference (Register Field Functions)

AFRL AFSELy LL_GPIO_GetAFPin_0_7

Parameters :
Return values :

Returned – value can be one of the following values:

void LL_GPIO_SetAFPin_8_15 ( GPIO_TypeDef * gpiox , uint32_t pin , uint32_t alternate )

Configure GPIO alternate function of a dedicated pin from 8 to 15 for a dedicated port.

Reference Manual to LL API cross reference (Register Field Functions)

AFRH AFSELy LL_GPIO_SetAFPin_8_15

Note

Possible values are from AF0 to AF15 depending on target.

Parameters :
uint32_t LL_GPIO_GetAFPin_8_15 ( const GPIO_TypeDef * gpiox , uint32_t pin )

Return GPIO alternate function of a dedicated pin from 8 to 15 for a dedicated port.

Reference Manual to LL API cross reference (Register Field Functions)

AFRH AFSELy LL_GPIO_GetAFPin_8_15

Note

Possible values are from AF0 to AF15 depending on target.

Parameters :
Return values :

Returned – value can be one of the following values:

void LL_GPIO_LockPin ( GPIO_TypeDef * gpiox , uint32_t pin_mask )

Lock configuration of several pins for a dedicated port.

Reference Manual to LL API cross reference (Register Field Functions)

LCKR LCKK LL_GPIO_LockPin

Note

When the lock sequence has been applied on a port bit, the value of this port bit can no longer be modified until the next reset.

Note

Each lock bit freezes a specific configuration register (control and alternate function registers).

Parameters :
uint32_t LL_GPIO_IsPinLocked ( const GPIO_TypeDef * gpiox , uint32_t pin_mask )

Return 1 if all pins passed as parameters of a dedicated port are locked; otherwise return 0.

Reference Manual to LL API cross reference (Register Field Functions)

LCKR LCKy LL_GPIO_IsPinLocked

Parameters :
Return values :

State – of bit (1 or 0).

uint32_t LL_GPIO_IsAnyPinLocked ( const GPIO_TypeDef * gpiox )

Return 1 if one of the pins of a dedicated port is locked; otherwise return 0.

Reference Manual to LL API cross reference (Register Field Functions)

LCKR LCKK LL_GPIO_IsAnyPinLocked

Parameters :

gpiox – GPIO Port

Return values :

State – of bit (1 or 0).

Data Access

group GPIO_LL_EF_Data_Access

Functions

uint32_t LL_GPIO_ReadInputPort ( const GPIO_TypeDef * gpiox )

Return full input data register value for a dedicated port.

Reference Manual to LL API cross reference (Register Field Functions)

IDR IDy LL_GPIO_ReadInputPort

Parameters :

gpiox – GPIO Port

Return values :

Input – data register value of port

uint32_t LL_GPIO_IsInputPinSet ( const GPIO_TypeDef * gpiox , uint32_t pin_mask )

Return whether the input data level for several pins of a dedicated port is high or low.

Reference Manual to LL API cross reference (Register Field Functions)

IDR IDy LL_GPIO_IsInputPinSet

Parameters :
Return values :

State – of bit (1 or 0).

void LL_GPIO_WriteOutputPort ( GPIO_TypeDef * gpiox , uint32_t port_value )

Write output data register for the port.

Reference Manual to LL API cross reference (Register Field Functions)

ODR ODy LL_GPIO_WriteOutputPort

Parameters :
  • gpiox – GPIO Port

  • port_value – Level value for each pin of the port

uint32_t LL_GPIO_ReadOutputPort ( const GPIO_TypeDef * gpiox )

Return full output data register value for a dedicated port.

Reference Manual to LL API cross reference (Register Field Functions)

ODR ODy LL_GPIO_ReadOutputPort

Parameters :

gpiox – GPIO Port

Return values :

Output – data register value of port

uint32_t LL_GPIO_IsOutputPinSet ( const GPIO_TypeDef * gpiox , uint32_t pin_mask )

Return whether the output data level for several pins of a dedicated port is high or low.

Reference Manual to LL API cross reference (Register Field Functions)

ODR ODy LL_GPIO_IsOutputPinSet

Parameters :
Return values :

State – of bit (1 or 0).

void LL_GPIO_SetOutputPin ( GPIO_TypeDef * gpiox , uint32_t pin_mask )

Set several pins to high level on dedicated gpio port.

Reference Manual to LL API cross reference (Register Field Functions)

BSRR BSy LL_GPIO_SetOutputPin

Parameters :
void LL_GPIO_ResetOutputPin ( GPIO_TypeDef * gpiox , uint32_t pin_mask )

Set several pins to low level on dedicated gpio port.

Reference Manual to LL API cross reference (Register Field Functions)

BRR BRy LL_GPIO_ResetOutputPin

Parameters :
void LL_GPIO_WriteOutputPin ( GPIO_TypeDef * gpiox , uint32_t pin_mask , uint32_t state )

Set or reset selected pins of a GPIO port.

Reference Manual to LL API cross reference (Register Field Functions)

BSRR BSy LL_GPIO_WriteOutputPin

BSRR BRy LL_GPIO_WriteOutputPin

Parameters :
void LL_GPIO_WriteMultipleStatePin ( GPIO_TypeDef * gpiox , uint32_t pins_reset , uint32_t pins_set )

Set and reset selected pins of a GPIO port atomically.

Reference Manual to LL API cross reference (Register Field Functions)

BSRR BSy LL_GPIO_WriteMultipleStatePin

BSRR BRy LL_GPIO_WriteMultipleStatePin

Parameters :
void LL_GPIO_TogglePin ( GPIO_TypeDef * gpiox , uint32_t pin_mask )

Toggle data value for several pin of dedicated port.

Reference Manual to LL API cross reference (Register Field Functions)

ODR ODy LL_GPIO_TogglePin

Parameters :