Bluepill port manipulation - need help understanding registers
Posted: Mon Dec 28, 2020 9:23 pm
Hey all,
Trying to work with these pins as quickly as possible, so I need to avoid pinMode and digitalWrite functions. I'm trying to set pins as input and output, but I can't make any sense of how people are using the CRL and CRH functions for it. Like I've seen where writing "GPIOA->CRL = 0x00033003;" somehow makes GPIOA pins 0, 3, and 4 as outputs...but how exactly does that work? 0x00033003 doesn't align with any of those pins in a binary sense...so I don't understand how it works.
If I'm trying to set pins GPIOA 8, 9, 10, 11 and 12 to OUTPUT, and then back to INPUT after a delay, how do I do this? I can't seem to find any examples of port manipulation on the stm32duino that make it clear how to work with these ports directly for faster control.
Any help would be greatly appreciated!
Trying to work with these pins as quickly as possible, so I need to avoid pinMode and digitalWrite functions. I'm trying to set pins as input and output, but I can't make any sense of how people are using the CRL and CRH functions for it. Like I've seen where writing "GPIOA->CRL = 0x00033003;" somehow makes GPIOA pins 0, 3, and 4 as outputs...but how exactly does that work? 0x00033003 doesn't align with any of those pins in a binary sense...so I don't understand how it works.
If I'm trying to set pins GPIOA 8, 9, 10, 11 and 12 to OUTPUT, and then back to INPUT after a delay, how do I do this? I can't seem to find any examples of port manipulation on the stm32duino that make it clear how to work with these ports directly for faster control.
Any help would be greatly appreciated!