cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f1xx_ll_gpio.h, wrong LL_GPIO_PIN_x definition

Zanon.Luciano
Senior

Hello the pin definition> 7 in the stm32f1xx_ll_gpio.h file seems to be wrong:

0693W000008wvgvQAA.pngin fact when I use LL_GPIO_PIN_8 with the function HAL_GPIO_WritePin (GPIO_TypeDef * GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState)

the ODR0 bit of the port concerned is moved instead of ODR8.

Also when I try to move the LL_GPIO_PIN_6 pin, the HAL_GPIO_WritePin function moves ODR6 and ODR14 ....

Is it really a mistake or am I making a mistake?

---------------

This group of definitions seems completely wrong to work with HAL_GPIO_WritePin function.

I can't understand what the << GPIO_PIN_MASK_POS (8 bit) scrolling is for, which generates the command on two pins when the selected pin is less than 8.

Furthermore, the following Or is even more mysterious ....

1 ACCEPTED SOLUTION

Accepted Solutions
Mike_ST
ST Employee

>> in fact when I use LL_GPIO_PIN_8 with the function HAL_GPIO_WritePin (GPIO_TypeDef * GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState)

You can't use LL definitions (LL_GPIO_PIN_8) with HAL_GPIO_WritePin, which is a HAL function.

Pin can be a mask like : GPIO_PIN_0 | GPIO_PIN_5 etc...

You need to use what is inside stm32f1xx_hal_gpio.h

If you need to use LL_GPIO_PIN_8, you have to use LL functions.

View solution in original post

2 REPLIES 2
Mike_ST
ST Employee

>> in fact when I use LL_GPIO_PIN_8 with the function HAL_GPIO_WritePin (GPIO_TypeDef * GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState)

You can't use LL definitions (LL_GPIO_PIN_8) with HAL_GPIO_WritePin, which is a HAL function.

Pin can be a mask like : GPIO_PIN_0 | GPIO_PIN_5 etc...

You need to use what is inside stm32f1xx_hal_gpio.h

If you need to use LL_GPIO_PIN_8, you have to use LL functions.

Zanon.Luciano
Senior

Ah.... As often happens, the error was so stupid that it seemed like a difficult problem !!

Thanks Mike_ST