HAL GPIO Functions ¶
Initialization/de-initialization functions ¶
- group GPIO_Exported_Functions_Group1
-
¶
This subsection provides a set of functions allowing to initialize/ de-initialize and configure GPIO ports. ¶
Initialize GPIO pins of a dedicated GPIO port using HAL_GPIO_Init(): ¶
-
Provide the GPIO port as a parameter.
-
Specify the GPIO pins to be configured, as a second parameter.
-
Provide the configuration structure containing the configuration to be applied as the third parameter.
De-initialize GPIO pins of a dedicated GPIO port using HAL_GPIO_DeInit(): ¶
-
Provide the GPIO port as a first parameter.
-
Specify the GPIO pins to be de-initialized as a second parameter.
Functions
-
hal_status_t
HAL_GPIO_Init
(
hal_gpio_t
gpiox
,
uint32_t
pins
,
const
hal_gpio_config_t
*
p_config
)
¶
-
Initialize a pin or a set of pins for a GPIO port according to the specified parameters in the p_config.
- Parameters :
-
-
gpiox – HAL_GPIOx or HAL_LPGPIOx: selected GPIO or LPGPIO based on hal_gpio_t .
-
pins – specifies the port pins to be written. This parameter can be a combination of HAL_GPIO_Pin_x where x can be (0..15).
-
p_config – pointer to a hal_gpio_config_t structure that contains the configuration information for the specified GPIO pins.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_config is NULL.
-
HAL_OK – GPIO pins has been correctly configured.
-
-
void
HAL_GPIO_DeInit
(
hal_gpio_t
gpiox
,
uint32_t
pins
)
¶
-
Reset the configuration of a pin or a set of pins for a GPIO port to the default one.
- Parameters :
-
-
gpiox – HAL_GPIOx or HAL_LPGPIOx: selected GPIO or LPGPIO based on hal_gpio_t .
-
pins – specifies the port pins to be written. This parameter can be a combination of HAL_GPIO_Pin_x where x can be (0..15).
-
-
- group GPIO_Exported_Functions_Group1
-
¶
This subsection provides a set of functions allowing to initialize/ de-initialize and configure GPIO ports. ¶
Initialize GPIO pins of a dedicated GPIO port using HAL_GPIO_Init(): ¶
-
Provide the GPIO port as a parameter.
-
Specify the GPIO pins to be configured, as a second parameter.
-
Provide the configuration structure containing the configuration to be applied as the third parameter.
De-initialize GPIO pins of a dedicated GPIO port using HAL_GPIO_DeInit(): ¶
-
Provide the GPIO port as a first parameter.
-
Specify the GPIO pins to be de-initialized as a second parameter.
Functions
-
hal_status_t
HAL_GPIO_Init
(
hal_gpio_t
gpiox
,
uint32_t
pins
,
const
hal_gpio_config_t
*
p_config
)
-
Initialize a pin or a set of pins for a GPIO port according to the specified parameters in the p_config.
- Parameters :
-
-
gpiox – HAL_GPIOx or HAL_LPGPIOx: selected GPIO or LPGPIO based on hal_gpio_t .
-
pins – specifies the port pins to be written. This parameter can be a combination of HAL_GPIO_Pin_x where x can be (0..15).
-
p_config – pointer to a hal_gpio_config_t structure that contains the configuration information for the specified GPIO pins.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_config is NULL.
-
HAL_OK – GPIO pins has been correctly configured.
-
-
void
HAL_GPIO_DeInit
(
hal_gpio_t
gpiox
,
uint32_t
pins
)
-
Reset the configuration of a pin or a set of pins for a GPIO port to the default one.
- Parameters :
-
-
gpiox – HAL_GPIOx or HAL_LPGPIOx: selected GPIO or LPGPIO based on hal_gpio_t .
-
pins – specifies the port pins to be written. This parameter can be a combination of HAL_GPIO_Pin_x where x can be (0..15).
-
-
- group GPIO_Exported_Functions_Group1
-
¶
This subsection provides a set of functions allowing to initialize/ de-initialize and configure GPIO ports. ¶
Initialize GPIO pins of a dedicated GPIO port using HAL_GPIO_Init(): ¶
-
Provide the GPIO port as a parameter.
-
Specify the GPIO pins to be configured, as a second parameter.
-
Provide the configuration structure containing the configuration to be applied as the third parameter.
De-initialize GPIO pins of a dedicated GPIO port using HAL_GPIO_DeInit(): ¶
-
Provide the GPIO port as a first parameter.
-
Specify the GPIO pins to be de-initialized as a second parameter.
Functions
-
hal_status_t
HAL_GPIO_Init
(
hal_gpio_t
gpiox
,
uint32_t
pins
,
const
hal_gpio_config_t
*
p_config
)
-
Initialize a pin or a set of pins for a GPIO port according to the specified parameters in the p_config.
- Parameters :
-
-
gpiox – HAL_GPIOx or HAL_LPGPIOx: selected GPIO or LPGPIO based on hal_gpio_t .
-
pins – specifies the port pins to be written. This parameter can be a combination of HAL_GPIO_Pin_x where x can be (0..15).
-
p_config – pointer to a hal_gpio_config_t structure that contains the configuration information for the specified GPIO pins.
-
- Return values :
-
-
HAL_INVALID_PARAM – p_config is NULL.
-
HAL_OK – GPIO pins has been correctly configured.
-
-
void
HAL_GPIO_DeInit
(
hal_gpio_t
gpiox
,
uint32_t
pins
)
-
Reset the configuration of a pin or a set of pins for a GPIO port to the default one.
- Parameters :
-
-
gpiox – HAL_GPIOx or HAL_LPGPIOx: selected GPIO or LPGPIO based on hal_gpio_t .
-
pins – specifies the port pins to be written. This parameter can be a combination of HAL_GPIO_Pin_x where x can be (0..15).
-
-
IO operation functions ¶
- group GPIO_Exported_Functions_Group2
-
¶
This subsection contains the APIs managing possible I/O operations on the GPIO pins: ¶
Read the input level of a dedicated input port pin using HAL_GPIO_ReadPin(): ¶
-
Provide the GPIO port as a first parameter.
-
Provide the GPIO pin to read as a second parameter.
Set or clear a set of pins of a GPIO port using HAL_GPIO_WritePin(): ¶
-
Provide the GPIO port as a first parameter.
-
Specify the pins to be updated as a second parameter.
-
Enter the pin state to be written to the specified pin as the third parameter.
Set and clear several pins of the same GPIO port in a single cycle using HAL_GPIO_WriteMultipleStatePin(): ¶
-
Provide the GPIO port as the first parameter.
-
Specify the set of pins to be reset as a second parameter.
-
Specify the set of pins to be set as a third parameter.
Toggle a set of pins of a dedicated GPIO port using HAL_GPIO_TogglePin(): ¶
-
Provide the GPIO port as a first parameter.
-
Specify the set of pins to be toggled as a second parameter.
Lock the configuration of a set of pins of a dedicated GPIO port using HAL_GPIO_LockPin(): ¶
-
Provide the GPIO port as a first parameter.
-
Specify the set of pins of which to lock the configuration as a second parameter.
Enable the speed optimization for a set of pins supporting this feature using HAL_GPIO_EnableHighSpeedLowVoltage(): ¶
-
Provide the GPIO port as a first parameter.
-
Specify the set of pins on which to enable the HSLV feature as a second parameter.
Disable the speed optimization feature for a set of pins using HAL_GPIO_DisableHighSpeedLowVoltage(): ¶
-
Provide the GPIO port as a first parameter.
-
Specify the set of pins of which to disable the HSLV feature.
To enable the VddIO2 power domain for the GPIO ports supporting it, use HAL_GPIO_EnableSystemDependencies(): ¶
-
Provide the GPIO port as a first parameter.
-
Specify the set of pins as a second parameter.
Functions
-
hal_gpio_pin_state_t
HAL_GPIO_ReadPin
(
hal_gpio_t
gpiox
,
uint32_t
pin
)
¶
-
Read the specific input pin for a GPIO port.
- Parameters :
-
-
gpiox – HAL_GPIOx or HAL_LPGPIOx: selected GPIO or LPGPIO based on hal_gpio_t .
-
pin – specifies the port pin to read. This parameter can be one of HAL_GPIO_Pin_x where x can be (0..15).
-
- Return values :
-
-
HAL_GPIO_PIN_RESET – when the input port pin is low.
-
HAL_GPIO_PIN_SET – when the input port pin is high.
-
-
void
HAL_GPIO_WritePin
(
hal_gpio_t
gpiox
,
uint32_t
pins
,
hal_gpio_pin_state_t
pin_state
)
¶
-
Set or clear a pin or a set of pins of a GPIO port.
Note
This function uses GPIOx_BSRR/LPGPIOx_BSRR and GPIOx_BRR/LPGPIOx_BRR registers to allow atomic read/modify accesses. In this way, there is no risk of an IRQ occurring between the read and the modify access.
- Parameters :
-
-
gpiox – HAL_GPIOx or HAL_LPGPIOx: selected GPIO or LPGPIO based on hal_gpio_t .
-
pins – specifies the port pins to be written.
-
pin_state – specifies the value to be written to the selected bit. This parameter can be one of the hal_gpio_pin_state_t enum values:
-
HAL_GPIO_PIN_RESET: to clear the port pin.
-
HAL_GPIO_PIN_SET: to set the port pin.
-
-
-
void
HAL_GPIO_WriteMultipleStatePin
(
hal_gpio_t
gpiox
,
uint32_t
pins_reset
,
uint32_t
pins_set
)
¶
-
Set and clear a pin or a set of pins of a GPIO port in same cycle.
Note
This function uses GPIOx_BSRR register to set the level of several pins and reset level of several other pins in the same cycle.
Note
At least one of the two parameters used to set or reset must be different from zero.
Warning
Both pins_reset and pins_set combinations must not get any common bit, else assert would be triggered.
- Parameters :
-
-
gpiox – HAL_GPIOx or HAL_LPGPIOx: selected GPIO or LPGPIO based on hal_gpio_t .
-
pins_reset – specifies the port bits to be reset. This parameter can be any combination of HAL_GPIO_Pin_x where x can be (0..15) or zero.
-
pins_set – specifies the port bits to be set. This parameter can be any combination of HAL_GPIO_Pin_x where x can be (0..15) or zero.
-
-
void
HAL_GPIO_TogglePin
(
hal_gpio_t
gpiox
,
uint32_t
pins
)
¶
-
Toggle a specific pin of a GPIO port.
- Parameters :
-
-
gpiox – HAL_GPIOx or HAL_LPGPIOx: selected GPIO or LPGPIO based on hal_gpio_t .
-
pins – specifies the port pins to be toggled. This parameter can be a combination of HAL_GPIO_Pin_x where x can be (0..15).
-
-
hal_status_t
HAL_GPIO_LockPin
(
hal_gpio_t
gpiox
,
uint32_t
pins
)
¶
-
Lock the configuration of a pin or a set of pins of a GPIO port.
Note
The locked registers are GPIOx_MODER, GPIOx_OTYPER, GPIOx_OSPEEDR, GPIOx_PUPDR, GPIOx_AFRL and GPIOx_AFRH.
Note
The configuration of the locked GPIO pins can no longer be modified until the next reset.
- Parameters :
-
-
gpiox – HAL_GPIOx or HAL_LPGPIOx: selected GPIO or LPGPIO based on hal_gpio_t .
-
pins – specifies the port pins to be locked. This parameter can be any combination of HAL_GPIO_Pin_x where x can be (0..15).
-
- Return values :
-
-
HAL_OK – pins locked successfully.
-
HAL_ERROR – error occurred during pins lock operation.
-
-
void
HAL_GPIO_EnableHighSpeedLowVoltage
(
hal_gpio_t
gpiox
,
uint32_t
pins
)
¶
-
Enable speed optimization for a pin or a set of pins of a GPIO port.
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
The I/O HSLV mode must be used only if the I/O supply (VDD) is below 2.7V to not damage the device
- Parameters :
-
-
gpiox – HAL_GPIOx: selected GPIO based on hal_gpio_t .
-
pins – specifies the port bit to be written This parameter can be any combination of HAL_GPIO_Pin_x where x can be (0..15).
-
-
void
HAL_GPIO_DisableHighSpeedLowVoltage
(
hal_gpio_t
gpiox
,
uint32_t
pins
)
¶
-
Disable speed optimization for a pin or a set of pins of a GPIO port.
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
The I/O HSLV mode must be used only if the I/O supply (VDD) is below 2.7V to not damage the device
- Parameters :
-
-
gpiox – HAL_GPIOx: selected GPIO based on hal_gpio_t .
-
pins – specifies the port bit to be written This parameter can be any combination of HAL_GPIO_Pin_x where x can be (0..15).
-
-
hal_status_t
HAL_GPIO_EnableSystemDependencies
(
hal_gpio_t
gpiox
,
uint32_t
pins
)
¶
-
Function to manage the activation of the: VddIO2 in case of activation of PG[15:2].
Note
Function is defined as weak to allow the user to change the way of enabling the: VddIO2.
- Parameters :
-
-
gpiox – HAL_GPIOx: selected GPIO based on hal_gpio_t .
-
pins – specifies the port bit to be written This parameter can be any combination of HAL_GPIO_Pin_x where x can be (0..15).
-
- Return values :
-
HAL_Status. –
-
- group GPIO_Exported_Functions_Group2
-
¶
This subsection contains the APIs managing possible I/O operations on the GPIO pins: ¶
Read the input level of a dedicated input port pin using HAL_GPIO_ReadPin(): ¶
-
Provide the GPIO port as a first parameter.
-
Provide the GPIO pin to read as a second parameter.
Set or clear a set of pins of a GPIO port using HAL_GPIO_WritePin(): ¶
-
Provide the GPIO port as a first parameter.
-
Specify the pins to be updated as a second parameter.
-
Enter the pin state to be written to the specified pin as the third parameter.
Set and clear several pins of the same GPIO port in a single cycle using HAL_GPIO_WriteMultipleStatePin(): ¶
-
Provide the GPIO port as the first parameter.
-
Specify the set of pins to be reset as a second parameter.
-
Specify the set of pins to be set as a third parameter.
Toggle a set of pins of a dedicated GPIO port using HAL_GPIO_TogglePin(): ¶
-
Provide the GPIO port as a first parameter.
-
Specify the set of pins to be toggled as a second parameter.
Lock the configuration of a set of pins of a dedicated GPIO port using HAL_GPIO_LockPin(): ¶
-
Provide the GPIO port as a first parameter.
-
Specify the set of pins of which to lock the configuration as a second parameter.
Enable the speed optimization for a set of pins supporting this feature using HAL_GPIO_EnableHighSpeedLowVoltage(): ¶
-
Provide the GPIO port as a first parameter.
-
Specify the set of pins on which to enable the HSLV feature as a second parameter.
Disable the speed optimization feature for a set of pins using HAL_GPIO_DisableHighSpeedLowVoltage(): ¶
-
Provide the GPIO port as a first parameter.
-
Specify the set of pins of which to disable the HSLV feature.
To enable the VddIO2 power domain for the GPIO ports supporting it, use HAL_GPIO_EnableSystemDependencies(): ¶
-
Provide the GPIO port as a first parameter.
-
Specify the set of pins as a second parameter.
Functions
-
hal_gpio_pin_state_t
HAL_GPIO_ReadPin
(
hal_gpio_t
gpiox
,
uint32_t
pin
)
-
Read the specific input pin for a GPIO port.
- Parameters :
-
-
gpiox – HAL_GPIOx or HAL_LPGPIOx: selected GPIO or LPGPIO based on hal_gpio_t .
-
pin – specifies the port pin to read. This parameter can be one of HAL_GPIO_Pin_x where x can be (0..15).
-
- Return values :
-
-
HAL_GPIO_PIN_RESET – when the input port pin is low.
-
HAL_GPIO_PIN_SET – when the input port pin is high.
-
-
void
HAL_GPIO_WritePin
(
hal_gpio_t
gpiox
,
uint32_t
pins
,
hal_gpio_pin_state_t
pin_state
)
-
Set or clear a pin or a set of pins of a GPIO port.
Note
This function uses GPIOx_BSRR/LPGPIOx_BSRR and GPIOx_BRR/LPGPIOx_BRR registers to allow atomic read/modify accesses. In this way, there is no risk of an IRQ occurring between the read and the modify access.
- Parameters :
-
-
gpiox – HAL_GPIOx or HAL_LPGPIOx: selected GPIO or LPGPIO based on hal_gpio_t .
-
pins – specifies the port pins to be written.
-
pin_state – specifies the value to be written to the selected bit. This parameter can be one of the hal_gpio_pin_state_t enum values:
-
HAL_GPIO_PIN_RESET: to clear the port pin.
-
HAL_GPIO_PIN_SET: to set the port pin.
-
-
-
void
HAL_GPIO_WriteMultipleStatePin
(
hal_gpio_t
gpiox
,
uint32_t
pins_reset
,
uint32_t
pins_set
)
-
Set and clear a pin or a set of pins of a GPIO port in same cycle.
Note
This function uses GPIOx_BSRR register to set the level of several pins and reset level of several other pins in the same cycle.
Note
At least one of the two parameters used to set or reset must be different from zero.
Warning
Both pins_reset and pins_set combinations must not get any common bit, else assert would be triggered.
- Parameters :
-
-
gpiox – HAL_GPIOx or HAL_LPGPIOx: selected GPIO or LPGPIO based on hal_gpio_t .
-
pins_reset – specifies the port bits to be reset. This parameter can be any combination of HAL_GPIO_Pin_x where x can be (0..15) or zero.
-
pins_set – specifies the port bits to be set. This parameter can be any combination of HAL_GPIO_Pin_x where x can be (0..15) or zero.
-
-
void
HAL_GPIO_TogglePin
(
hal_gpio_t
gpiox
,
uint32_t
pins
)
-
Toggle a specific pin of a GPIO port.
- Parameters :
-
-
gpiox – HAL_GPIOx or HAL_LPGPIOx: selected GPIO or LPGPIO based on hal_gpio_t .
-
pins – specifies the port pins to be toggled. This parameter can be a combination of HAL_GPIO_Pin_x where x can be (0..15).
-
-
hal_status_t
HAL_GPIO_LockPin
(
hal_gpio_t
gpiox
,
uint32_t
pins
)
-
Lock the configuration of a pin or a set of pins of a GPIO port.
Note
The locked registers are GPIOx_MODER, GPIOx_OTYPER, GPIOx_OSPEEDR, GPIOx_PUPDR, GPIOx_AFRL and GPIOx_AFRH.
Note
The configuration of the locked GPIO pins can no longer be modified until the next reset.
- Parameters :
-
-
gpiox – HAL_GPIOx or HAL_LPGPIOx: selected GPIO or LPGPIO based on hal_gpio_t .
-
pins – specifies the port pins to be locked. This parameter can be any combination of HAL_GPIO_Pin_x where x can be (0..15).
-
- Return values :
-
-
HAL_OK – pins locked successfully.
-
HAL_ERROR – error occurred during pins lock operation.
-
-
void
HAL_GPIO_EnableHighSpeedLowVoltage
(
hal_gpio_t
gpiox
,
uint32_t
pins
)
-
Enable speed optimization for a pin or a set of pins of a GPIO port.
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
The I/O HSLV mode must be used only if the I/O supply (VDD) is below 2.7V to not damage the device
- Parameters :
-
-
gpiox – HAL_GPIOx: selected GPIO based on hal_gpio_t .
-
pins – specifies the port bit to be written This parameter can be any combination of HAL_GPIO_Pin_x where x can be (0..15).
-
-
void
HAL_GPIO_DisableHighSpeedLowVoltage
(
hal_gpio_t
gpiox
,
uint32_t
pins
)
-
Disable speed optimization for a pin or a set of pins of a GPIO port.
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
The I/O HSLV mode must be used only if the I/O supply (VDD) is below 2.7V to not damage the device
- Parameters :
-
-
gpiox – HAL_GPIOx: selected GPIO based on hal_gpio_t .
-
pins – specifies the port bit to be written This parameter can be any combination of HAL_GPIO_Pin_x where x can be (0..15).
-
-
hal_status_t
HAL_GPIO_EnableSystemDependencies
(
hal_gpio_t
gpiox
,
uint32_t
pins
)
-
Function to manage the activation of the: VddIO2 in case of activation of PG[15:2].
Note
Function is defined as weak to allow the user to change the way of enabling the: VddIO2.
- Parameters :
-
-
gpiox – HAL_GPIOx: selected GPIO based on hal_gpio_t .
-
pins – specifies the port bit to be written This parameter can be any combination of HAL_GPIO_Pin_x where x can be (0..15).
-
- Return values :
-
HAL_Status. –
-
- group GPIO_Exported_Functions_Group2
-
¶
This subsection contains the APIs managing possible I/O operations on the GPIO pins: ¶
Read the input level of a dedicated input port pin using HAL_GPIO_ReadPin(): ¶
-
Provide the GPIO port as a first parameter.
-
Provide the GPIO pin to read as a second parameter.
Set or clear a set of pins of a GPIO port using HAL_GPIO_WritePin(): ¶
-
Provide the GPIO port as a first parameter.
-
Specify the pins to be updated as a second parameter.
-
Enter the pin state to be written to the specified pin as the third parameter.
Set and clear several pins of the same GPIO port in a single cycle using HAL_GPIO_WriteMultipleStatePin(): ¶
-
Provide the GPIO port as the first parameter.
-
Specify the set of pins to be reset as a second parameter.
-
Specify the set of pins to be set as a third parameter.
Toggle a set of pins of a dedicated GPIO port using HAL_GPIO_TogglePin(): ¶
-
Provide the GPIO port as a first parameter.
-
Specify the set of pins to be toggled as a second parameter.
Lock the configuration of a set of pins of a dedicated GPIO port using HAL_GPIO_LockPin(): ¶
-
Provide the GPIO port as a first parameter.
-
Specify the set of pins of which to lock the configuration as a second parameter.
Enable the speed optimization for a set of pins supporting this feature using HAL_GPIO_EnableHighSpeedLowVoltage(): ¶
-
Provide the GPIO port as a first parameter.
-
Specify the set of pins on which to enable the HSLV feature as a second parameter.
Disable the speed optimization feature for a set of pins using HAL_GPIO_DisableHighSpeedLowVoltage(): ¶
-
Provide the GPIO port as a first parameter.
-
Specify the set of pins of which to disable the HSLV feature.
To enable the VddIO2 power domain for the GPIO ports supporting it, use HAL_GPIO_EnableSystemDependencies(): ¶
-
Provide the GPIO port as a first parameter.
-
Specify the set of pins as a second parameter.
Functions
-
hal_gpio_pin_state_t
HAL_GPIO_ReadPin
(
hal_gpio_t
gpiox
,
uint32_t
pin
)
-
Read the specific input pin for a GPIO port.
- Parameters :
-
-
gpiox – HAL_GPIOx or HAL_LPGPIOx: selected GPIO or LPGPIO based on hal_gpio_t .
-
pin – specifies the port pin to read. This parameter can be one of HAL_GPIO_Pin_x where x can be (0..15).
-
- Return values :
-
-
HAL_GPIO_PIN_RESET – when the input port pin is low.
-
HAL_GPIO_PIN_SET – when the input port pin is high.
-
-
void
HAL_GPIO_WritePin
(
hal_gpio_t
gpiox
,
uint32_t
pins
,
hal_gpio_pin_state_t
pin_state
)
-
Set or clear a pin or a set of pins of a GPIO port.
Note
This function uses GPIOx_BSRR/LPGPIOx_BSRR and GPIOx_BRR/LPGPIOx_BRR registers to allow atomic read/modify accesses. In this way, there is no risk of an IRQ occurring between the read and the modify access.
- Parameters :
-
-
gpiox – HAL_GPIOx or HAL_LPGPIOx: selected GPIO or LPGPIO based on hal_gpio_t .
-
pins – specifies the port pins to be written.
-
pin_state – specifies the value to be written to the selected bit. This parameter can be one of the hal_gpio_pin_state_t enum values:
-
HAL_GPIO_PIN_RESET: to clear the port pin.
-
HAL_GPIO_PIN_SET: to set the port pin.
-
-
-
void
HAL_GPIO_WriteMultipleStatePin
(
hal_gpio_t
gpiox
,
uint32_t
pins_reset
,
uint32_t
pins_set
)
-
Set and clear a pin or a set of pins of a GPIO port in same cycle.
Note
This function uses GPIOx_BSRR register to set the level of several pins and reset level of several other pins in the same cycle.
Note
At least one of the two parameters used to set or reset must be different from zero.
Warning
Both pins_reset and pins_set combinations must not get any common bit, else assert would be triggered.
- Parameters :
-
-
gpiox – HAL_GPIOx or HAL_LPGPIOx: selected GPIO or LPGPIO based on hal_gpio_t .
-
pins_reset – specifies the port bits to be reset. This parameter can be any combination of HAL_GPIO_Pin_x where x can be (0..15) or zero.
-
pins_set – specifies the port bits to be set. This parameter can be any combination of HAL_GPIO_Pin_x where x can be (0..15) or zero.
-
-
void
HAL_GPIO_TogglePin
(
hal_gpio_t
gpiox
,
uint32_t
pins
)
-
Toggle a specific pin of a GPIO port.
- Parameters :
-
-
gpiox – HAL_GPIOx or HAL_LPGPIOx: selected GPIO or LPGPIO based on hal_gpio_t .
-
pins – specifies the port pins to be toggled. This parameter can be a combination of HAL_GPIO_Pin_x where x can be (0..15).
-
-
hal_status_t
HAL_GPIO_LockPin
(
hal_gpio_t
gpiox
,
uint32_t
pins
)
-
Lock the configuration of a pin or a set of pins of a GPIO port.
Note
The locked registers are GPIOx_MODER, GPIOx_OTYPER, GPIOx_OSPEEDR, GPIOx_PUPDR, GPIOx_AFRL and GPIOx_AFRH.
Note
The configuration of the locked GPIO pins can no longer be modified until the next reset.
- Parameters :
-
-
gpiox – HAL_GPIOx or HAL_LPGPIOx: selected GPIO or LPGPIO based on hal_gpio_t .
-
pins – specifies the port pins to be locked. This parameter can be any combination of HAL_GPIO_Pin_x where x can be (0..15).
-
- Return values :
-
-
HAL_OK – pins locked successfully.
-
HAL_ERROR – error occurred during pins lock operation.
-
-
void
HAL_GPIO_EnableHighSpeedLowVoltage
(
hal_gpio_t
gpiox
,
uint32_t
pins
)
-
Enable speed optimization for a pin or a set of pins of a GPIO port.
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
The I/O HSLV mode must be used only if the I/O supply (VDD) is below 2.7V to not damage the device
- Parameters :
-
-
gpiox – HAL_GPIOx: selected GPIO based on hal_gpio_t .
-
pins – specifies the port bit to be written This parameter can be any combination of HAL_GPIO_Pin_x where x can be (0..15).
-
-
void
HAL_GPIO_DisableHighSpeedLowVoltage
(
hal_gpio_t
gpiox
,
uint32_t
pins
)
-
Disable speed optimization for a pin or a set of pins of a GPIO port.
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
The I/O HSLV mode must be used only if the I/O supply (VDD) is below 2.7V to not damage the device
- Parameters :
-
-
gpiox – HAL_GPIOx: selected GPIO based on hal_gpio_t .
-
pins – specifies the port bit to be written This parameter can be any combination of HAL_GPIO_Pin_x where x can be (0..15).
-
-
hal_status_t
HAL_GPIO_EnableSystemDependencies
(
hal_gpio_t
gpiox
,
uint32_t
pins
)
-
Function to manage the activation of the: VddIO2 in case of activation of PG[15:2].
Note
Function is defined as weak to allow the user to change the way of enabling the: VddIO2.
- Parameters :
-
-
gpiox – HAL_GPIOx: selected GPIO based on hal_gpio_t .
-
pins – specifies the port bit to be written This parameter can be any combination of HAL_GPIO_Pin_x where x can be (0..15).
-
- Return values :
-
HAL_Status. –
-