Skip to content
UPEEC

Register-Level Programming

Configure peripherals by reading and writing their registers directly.

Intermediate
Comments 0
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN;      /* clock GPIOA */
GPIOA->MODER  = (GPIOA->MODER & ~(3u << 10)) | (1u << 10);  /* PA5 output */
GPIOA->ODR   ^= (1u << 5);                /* toggle LED */

Smallest and fastest code; you learn exactly how the hardware works.

Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.

Discussion (0)

Sign in or join free to ask questions and discuss this topic.