Skip to content

Instantly share code, notes, and snippets.

@ser-mk ser-mk/led.cpp
Last active Jan 13, 2019

Embed
What would you like to do?
C version of led blink
// Step 1: Enable the clock to PORT B
RCC->APB2ENR |= RCC_APB2ENR_IOPCEN;
// Step 2: Change PB0's mode to 0x3 (output) and cfg to 0x0 (push-pull)
GPIOC->CRH = GPIO_CRH_MODE13_0 | GPIO_CRH_MODE13_1;
// Step 3: Set PB0 high
GPIOC->BSRR = GPIO_BSRR_BS13;
// Step 4: Reset PB0 low
GPIOC->BSRR = GPIO_BSRR_BR13;
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.