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 GPIO mode for a dedicated pin on 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, alternate function mode or Analog.

Warning

only one pin can be passed as parameter.

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

Return GPIO mode for a dedicated pin on 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, alternate function mode or Analog.

Warning

only one pin can be passed as parameter.

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 GPIO output type for several pins on dedicated port.

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

OTYPER OTy LL_GPIO_SetPinOutputType

Note

Output type as to be set when gpio pin is in output or alternate modes. Possible type are Push-pull or Open-drain.

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

Return GPIO output type for several pins on dedicated port.

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

OTYPER OTy LL_GPIO_GetPinOutputType

Note

Output type as to be set when gpio pin is in output or alternate modes. Possible type are Push-pull or Open-drain.

Warning

only one pin can be passed as parameter.

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 GPIO speed for a dedicated pin on 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 datasheet for frequency specifications and the power supply and load conditions for each speed.

Warning

only one pin can be passed as parameter.

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

Return GPIO speed for a dedicated pin on 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 datasheet for frequency specifications and the power supply and load conditions for each speed.

Warning

only one pin can be passed as parameter.

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

Warning

only one pin can be passed as parameter.

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

Return 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

Warning

only one pin can be passed as parameter.

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.

Warning

only one pin can be passed as parameter.

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.

Warning

only one pin can be passed as parameter.

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 parameter, of a dedicated port, are locked, else 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 pin of a dedicated port is locked. else 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 if input data level for several pins of 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 if input data level for several pins of 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_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 :
void LL_GPIO_EnableHighSpeedLowVoltage ( GPIO_TypeDef * gpiox , uint32_t pin_mask )

Enable speed optimization for several pin of dedicated port.

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

HSLVR HSLVy LL_GPIO_EnableHighSPeedLowVoltage

Note

Not all I/Os support the HSLV mode. Refer to the I/O structure in the corresponding datasheet for the list of I/Os supporting this feature. Other I/Os HSLV configuration must be kept at reset value.

Note

It must be used only if the I/O supply voltage is below 2.7 V.

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

Disable speed optimization for several pin of dedicated port.

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

HSLVR HSLVy LL_GPIO_DisableHighSPeedLowVoltage

Note

Not all I/Os support the HSLV mode. Refer to the I/O structure in the corresponding datasheet for the list of I/Os supporting this feature. Other I/Os HSLV configuration must be kept at reset value.

Note

It must be used only if the I/O supply voltage is below 2.7 V.

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

Return if speed optimization for several pin of dedicated port is enabled or not.

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

HSLVR HSLVy LL_GPIO_IsEnabledHighSPeedLowVoltage

Note

Not all I/Os support the HSLV mode. Refer to the I/O structure in the corresponding datasheet for the list of I/Os supporting this feature. Other I/Os HSLV configuration must be kept at reset value.

Warning

It must be used only if the I/O supply voltage is below 2.7 V.

Parameters :
Return values :

State – of bit (1 or 0).

void LL_GPIO_EnablePinSecure ( GPIO_TypeDef * gpiox , uint32_t pin_mask )

Enable secure write only access for several pin of dedicated port.

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

SECCFGR SECy LL_GPIO_EnablePinSecure

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

Disable secure write only access for several pin of dedicated port.

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

SECCFGR SECy LL_GPIO_DisablePinSecure

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

Return if secure write only access for a dedicated pin on dedicated port is enabled or not.

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

SECCFGR SECy LL_GPIO_IsEnabledPinSecure

Parameters :
Return values :

State – of bit (1 or 0).