#include "stm32l0xx.h"
// Define the LED pin and port
#define LED_PIN (1 << 3) // PA3
#define LED_PORT GPIOA
void SystemClock_Config(void)
{
// Configure the system clock as needed; this is a placeholder
// The default HSI clock configuration should work for this example
}
void initGPIO(void)
{
// Enable GPIOA clock
RCC->IOPENR |= RCC_IOPENR_GPIOAEN;
// Configure PA3 as output
GPIOA->MODER &= ~(GPIO_MODER_MODE3); // Clear mode bits
GPIOA->MODER |= GPIO_MODER_MODE3_0; // Set PA3 as general-purpose output mode
GPIOA->OTYPER &= ~(GPIO_OTYPER_OT_3); // Set PA3 as push-pull
GPIOA->OSPEEDR |= GPIO_OSPEEDER_OSPEED3; // Set PA3 as high speed
GPIOA->PUPDR &= ~(GPIO_PUPDR_PUPD3); // No pull-up, pull-down
}
int main(void)
{
// Initialize system
HAL_Init(); // Initialize HAL (if needed)
SystemClock_Config();
// Initialize GPIO
initGPIO();
// Turn on the LED
GPIOA->ODR |= LED_PIN;
// Main loop
while (1)
{
// Do nothing, LED is on
}
}