void ebox_init(void) { get_system_clock(&cpu.clock); get_chip_info(); cpu.company[0] = 'S'; cpu.company[1] = 'T'; cpu.company[2] = '\0'; SysTick_Config(cpu.clock.core/1000);// 每隔 1ms产生一次中断 SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);//systemticks clock; micro_para = cpu.clock.core/1000000;//减少micros函数计算量 //统计cpu计算能力////////////////// cpu.ability = 0; millis_seconds = 0; do { cpu.ability++;//统计cpu计算能力 } while(millis_seconds < 100); cpu.ability = cpu.ability * 10; //////////////////////////////// ADC1_init(); NVIC_PriorityGroupConfig(NVIC_GROUP_CONFIG); //将pb4默认设置为IO口,禁用jtag RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE); set_systick_user_event_per_sec(1000); random_seed(AD_value[0]);//初始化随机数种子 }
int main(void) { /* Write your code here */ SystemCoreClockUpdate(); lvd_init(); led_sample_init(); mcu_tracer_config(); startup_reason_report(); //Inits FTM_init(); VREF_init(); ADC_init(); ADC1_init(); Si8900_init(); //SI8900_sync(); //led_sample_init(); // printf("SystemBusClock = %ld\n", SystemBusClock); //printf("SystemCoreClock = %ld\n", SystemCoreClock); _taskcall_task_register_time(&task_watchdog_reset,(120000000*2)); _taskcall_task_register_time(&task_led_lauflicht,(120000000*3)); _taskcall_task_register_time(&task_adc_conv_test,(120000000)); _taskcall_start(); while(1){ //put here low priority tasks, like communication mcu_tracer_process(); mainloop_iterations=mainloop_iterations+1; if(mainloop_iterations>1000000) mainloop_iterations=0; } /* This for loop should be replaced. By default this loop allows a single stepping. */ init_leds(); while(1); /* Never leave main */ return 0; }