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]);//初始化随机数种子 }
uavcan::Node<0> *UAVCAN_sniffer::get_node() { if (_node == nullptr && get_can_driver() != nullptr) { _node = new uavcan::Node<0>(*get_can_driver(), get_system_clock(), _node_allocator); } return _node; }