Skip to main content
Explorer II
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);
 ...
}

 

    This topic has been closed for replies.
    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-32Answer
    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 

    Graduate II
    November 21, 2024

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

    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.

     

     

    brat0x2Author
    Explorer II
    November 22, 2024

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