Skip to main content
Associate
November 21, 2024
Solved

One by one port pin configuration locking

  • November 21, 2024
  • 4 replies
  • 892 views

There is no clear information in the reference manual about port pin configuration locking one by one. For example (desired code):

 

void SomeFunction()
{
 // locking pin configuration one by one
 LL_GPIO_LockPin(GPIOA, LL_GPIO_PIN_0);
 LL_GPIO_LockPin(GPIOA, LL_GPIO_PIN_1);
 LL_GPIO_LockPin(GPIOA, LL_GPIO_PIN_2);
 ...
}

 

 

May I lock pin's configuration one by one, not all at once (see code below)?

 

void OtherFunction()
{
 // locking all pins configuration at once
 LL_GPIO_LockPin(GPIOA, LL_GPIO_PIN_2 | LL_GPIO_PIN_1 | LL_GPIO_PIN_0);
 ...
}

 

Best answer by STTwo-32

Hello @brat0x2 

Yes, you can lock only 1 pin for each call of the LL_GPIO_LockPin.

Best Regards.

STTwo-32 

4 replies

STTwo-32
STTwo-32Best answer
Technical Moderator
November 21, 2024

Hello @brat0x2 

Yes, you can lock only 1 pin for each call of the LL_GPIO_LockPin.

Best Regards.

STTwo-32 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Tesla DeLorean
Guru
November 21, 2024

FYI Full source code to the libraries is provided, so you can review it, and expand upon it.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
mƎALLEm
Technical Moderator
November 21, 2024

Hello @brat0x2 ,

You can do it with both ways, by Oring all pins or one by one, but better to lock them at once for performance reasons.

This is the register:

SofLit_0-1732218368270.png

You can write all the bits at once (by oring).

See also this linkLL_GPIO_PIN_ALL value is the oring of all pins.

 

 

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
brat0x2Author
Associate
November 22, 2024

Thanks a lot, colleagues! In my application it is very convinient one by one way of configuring port pin locking.