Skip to content

Instantly share code, notes, and snippets.

@thehans thehans/setdata.c Secret
Last active Jan 9, 2020

Embed
What would you like to do?
Example concept of setting multiple disparate pins on STM32. (updated for separate GPIOA/B/C)
GPIOB->regs->ODR ^= (((data >> 0) & 3) ^ ((GPIOB->regs->ODR >> 8) & 3)) << 8;
GPIOC->regs->ODR ^= (((data >> 2) & 7) ^ ((GPIOC->regs->ODR >>13) & 7)) <<13;
GPIOA->regs->ODR ^= (((data >> 5) & 7) ^ ((GPIOA->regs->ODR >> 0) & 7)) << 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.