The outputs can be toggled by shifting the bits on the BSSR register. The bits correspond to the GPIO pin addresses.
Check out the STM32duino GPIO Registers and programming gist note
Here are my notes
0b0010 0000 0000 0000 is GPIO_PIN_13 in binary. Setting the BSSR to this means it should first be high, then after the bitshift of 16 bits to the left, then it will be low (if understanding it correctly).
The reason for using BSSR is to avoid any problems that might occur in this multi-step process with ODR needing to read, modify, and then write. BSSR can be done in one step. Check out the box 'Writing an Indirect Register' on page 123 in Making Embedded Systems.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.