AnsweredAssumed Answered

How to write a variable value to a GPIO port?

Question asked by Yosmany Hernández Sánchez on Jan 21, 2018
Latest reply on Jan 21, 2018 by John Craven

Hello to all Forum members. I would like to know how can I write a variable (e.g. of 16 bits) directly to any GPIO port using the HAL API provided by STM32Cube Classic HAL.


Currently I'm using Keil uVision. I've created a new project and selected STM32F429ZI device (NUCLEO-F429ZI Board). In the Software components dialog I've selected Device -> STM32Cube Framework (API) -> Classic and inside STM32Cube HAL the sub-components Common, Cortex, GPIO, PWR and RCC. Everything compiles without problems but I'm unable to find a function to write a variable to a port. Previously with Peripheral Libraries I just use the form


uint16_t myVariable = 0xABCD;


GPIO_Write(GPIOB, myVariable);


and everything is ok, but with Cube HAL I cannot found anything similar.


I have used the function HAL_GPIO_WritePin(...) to set/clear groups of bits, but it does not fits my needs in this case.


Any ideas on what to do?


Thanks in advance. Yosmany.