You are on page 1of 1

#include "stm32f4xx.

h"
#define AFRL AFR[0]
#define AFRH AFR[1]
#define ON_LED_VERDE (GPIOD->BRRL |= 0x1000)
#define ON_LED_NARANJA (GPIOD->BRRL |= 0x2000)
#define ON_LED_ROJO (GPIOD->BRRL |= 0x4000)
#define ON_LED_AZUL (GPIOD->BRRL |= 0x8000)
void System1nit(void);
int main(void)
{
SystemInit();
// LEDS
RCC->AHB1ENR |= 0x00000008;
GPIOD->MODER |= 0x55000000;
GPIOD->OSPEEDR |= 0XAA000000;
GPIOD->OTYPER |= 0;
GPIOD->PUPDR |= 0x55000000;

ON_LED_VERDE;

// int main(void)
void System1nit(void)
{
int a=0;
RCC->CR |= 0X10000;
while((RCC->CR & 0x20000)==0);
RCC->APB1ENR = 0x10000000;
RCC->CFGR = 0x00009400;
RCC->PLLCFGR = 0x07405408;
RCC->CR|=0x01000000;
while((RCC->CR & 0x02000000)==0);
FLASH->ACR = (0x00000605);
RCC->CFGR |= 2;
for (a=0;a<=500;a++);
}// void System1nit(void)

You might also like