#include "stm32f103xb.h" #define LED_PIN GPIO_PIN_13 #define LED_PORT GPIOC void delay(uint32_t count) { for(uint32_t i = 0; i < count; i++); } int main(void) { RCC->APB2ENR |= RCC_APB2ENR_IOPCEN; // Enable clock for GPIOC GPIOC->CRH &= ~(GPIO_CRH_CNF13 | GPIO_CRH_MODE13); // Clear CNF and MODE bits for pin 13 GPIOC->CRH |= GPIO_CRH_MODE13_0; // Output mode, max speed 10 MHz while (1) { GPIOC->BSRR = LED_PIN; // Set pin high (turn LED on) delay(1000000); // Delay GPIOC->BSRR = LED_PIN << 16; // Reset pin (turn LED off) delay(1000000); // Delay } }