Last active
January 13, 2019 23:22
-
-
Save ser-mk/ad66c99b9deba4bb6e937c05d6d3920f to your computer and use it in GitHub Desktop.
C version of led blink
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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