cancel
Showing results for 
Search instead for 
Did you mean: 

why LL_GPIO_PIN_... defined with or and Left shift?

hosseinam1370
Associate II


#define LL_GPIO_PIN_6 ((GPIO_BSRR_BS6 << GPIO_PIN_MASK_POS) | 0x00000040U) /*!< Select pin 6 */
#define LL_GPIO_PIN_7 ((GPIO_BSRR_BS7 << GPIO_PIN_MASK_POS) | 0x00000080U) /*!< Select pin 7 */
#define LL_GPIO_PIN_8 ((GPIO_BSRR_BS8 << GPIO_PIN_MASK_POS) | 0x04000001U) /*!< Select pin 8 */
#define LL_GPIO_PIN_9 ((GPIO_BSRR_BS9 << GPIO_PIN_MASK_POS) | 0x04000002U) /*!< Select pin 9 */
#define LL_GPIO_PIN_10 ((GPIO_BSRR_BS10 << GPIO_PIN_MASK_POS) | 0x04000004U) /*!< Select pin 10 */

 

 

hi.

I've run into an issue with the definition in the LL library for selecting pin 8, and I can't figure out what's going on. For example, GPIO_BSRR_BS8 is already defined and set for pin 8, but then it gets shifted left with GPIO_PIN_MASK_POS, which has a value of 8, and more confusingly, it gets OR 'd with the hexadecimal value 0x04000001U. I can't understand why they've done this. No matter how I calculate it, in the registers, bit 8 in both the set and reset registers doesn't get filled with 1. Could you explain why this is done?

 

 

 

 

0 REPLIES 0