Created
January 17, 2020 18:07
-
-
Save denizzzka/8370e2aea87d0cb298095e06e7a3b8f8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import ldc.llvmasm; | |
| #include <libopencm3/stm32/rcc.h> | |
| #include <libopencm3/stm32/gpio.h> | |
| void main() { | |
| // Enable clock GPIOC | |
| rcc_periph_clock_enable(RCC_GPIOC); | |
| // Configure GPIO13 | |
| gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO13); | |
| while (true) { | |
| // LED ON/OFF | |
| gpio_toggle(GPIOC, GPIO13); | |
| // Delay | |
| for (int i = 0; i < 200000; i++) | |
| __asm("nop", ""); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment