I am currently working on STM32F103RB as a beginner. For that, I am undergoing training from a tutorial where the matter requires this :
Let’s suppose that we want to configure pin 5 of port A as input floating. We must then assign the binary value 0b0100 to bits b23 b22 b21 b20 of the CRL register
Here is the code from the tutorial:
GPIOA->CRL = GPIOA->CRL & ~(0xF << 20); // Set bits b23 b22 to 0 b21 b20 GPIOA->CRL = GPIOA->CRL | (0x1 << 22); // Set b22 to 1
The way shown above taken in the tutorial seems to me strange because I do not see the link with the pin 5 and the b20, b21 b22 and b23. Also About what I have understood, the CRL register is not supposed to contain b20, b21 b22 and b23.
Can someone explain to me how he has understood these two lines?