Skip to content

Instantly share code, notes, and snippets.

@denizzzka
Created January 17, 2020 18:07
Show Gist options
  • Select an option

  • Save denizzzka/8370e2aea87d0cb298095e06e7a3b8f8 to your computer and use it in GitHub Desktop.

Select an option

Save denizzzka/8370e2aea87d0cb298095e06e7a3b8f8 to your computer and use it in GitHub Desktop.
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