#include #include #include #include #include #include /* * Part number: STM32F030F4C6 */ void tick(void) { for(int i=0; i<50; i++) __asm__("nop"); } int main(void) { RCC->CR |= RCC_CR_HSEON; while (!(RCC->CR&RCC_CR_HSERDY)); RCC->CFGR &= ~RCC_CFGR_PLLMUL_Msk & ~RCC_CFGR_SW_Msk; RCC->CFGR |= (2<CFGR2 &= ~RCC_CFGR2_PREDIV_Msk; /* PREDIV=0 */ RCC->CR |= RCC_CR_PLLON; while (!(RCC->CR&RCC_CR_PLLRDY)); RCC->CFGR |= (2<AHBENR |= RCC_AHBENR_GPIOAEN; RCC->APB2ENR |= RCC_APB2ENR_SPI1EN; GPIOA->MODER |= (2<OSPEEDR |= (3<AFR[0] |= (0<CR1 = SPI_CR1_SSM | SPI_CR1_SSI | SPI_CR1_SPE | (7<CR2 = (7<DR = 1<DR = 0; } while (SPI1->SR & SPI_SR_BSY); tick(); } pos2 += 1; if (pos2 == 8) { pos2 = 0; pos1 += 1; if (pos1 == 6) pos1 = 0; } /* Strobe both LED drivers and aux regs */ GPIOA->BSRR = GPIO_BSRR_BS_9 | GPIO_BSRR_BS_10; tick(); GPIOA->BSRR = GPIO_BSRR_BR_9 | GPIO_BSRR_BR_10; LL_mDelay(1); } } void NMI_Handler(void) { } void HardFault_Handler(void) { for(;;); } void SVC_Handler(void) { } void PendSV_Handler(void) { } void SysTick_Handler(void) { }