#include "project.h" extern uint32_t dfu_flag; int main (void) { // rcc_clock_setup_in_hsi_out_48mhz (); //nvic_set_priority_grouping(NVIC_PriorityGroup_4); /*set up pll */ rcc_clock_setup_in_hse_8mhz_out_72mhz (); /*turn on clocks to periferals */ rcc_periph_clock_enable (RCC_GPIOA); rcc_periph_clock_enable (RCC_GPIOB); rcc_periph_clock_enable (RCC_GPIOC); rcc_periph_clock_enable (RCC_AFIO); rcc_periph_clock_enable (RCC_USART1); rcc_periph_clock_enable (RCC_USART1); dwt_enable_cycle_counter (); /*Change interrupt priorities so that USART trumps Timer trumps ATKBD */ nvic_set_priority (NVIC_USART1_IRQ, 0x40); nvic_set_priority (NVIC_SYSTICK_IRQ, 0x80); nvic_set_priority (NVIC_EXTI0_IRQ, 0xc0); usart_init (); ticker_init (); #ifdef DEBUG printf ("USART and ticker started\r\n"); #endif usb_init (); #ifdef DEBUG printf ("USB started\r\n"); #endif atkbd_init (); #ifdef DEBUG printf ("ATKBD i/f started\r\n"); #endif while (ticks < AT_KBD_INIT_TIME) usb_poll (); atkbd_start (); #ifdef DEBUG printf ("Keyboard started\r\n"); #endif usb_run (); return 0; }