gpio_inittypedefgpio_initstructure;
usart_inittypedefusart_initstructure;
nvic_inittypedefnvic_initstruct;
rcc_ahbperiphclockcmd(rcc_ahbperiph_gpioa,enable);//使能gpioa的时钟
rcc_apb2periphclockcmd(rcc_apb2periph_usart1,enable);//使能usart的时钟
/*usart1的端口配置*/
gpio_pinafconfig(gpioa,gpio_pinsource9,gpio_af_1);//配置pa9成第二功能引脚
txgpio_pinafconfig(gpioa,gpio_pinsource10,gpio_af_1);//配置pa10成第二功能引脚rx
gpio__pingpio_pin_9|gpio_pin_10;
gpio__modegpio_mode_af;
gpio__speedgpio_speed_50mhz;
gpio__otypegpio_otype_pp;
gpio__pupdgpio_pupd_up;
gpio_init(gpioa,gpio_initstructure);/*usart1的都差不多配置*/
usart__baudrate115200;//波特率
usart__wordlengthusart_wordlength_8b;
usart__stopbitsusart_stopbits_1;
usart__parityusart_parity_oh,no;
usart__hardwareflowcontrolusart_hardwareflowcontrol_none;
usart__modeusart_mode_rx|usart_mode_tx;
usart_init(usart1,usart_initstructure);
usart_itconfig(usart1,usart_it_rxne,enable);//使能收不到网络中断
usart_cmd(usart1,enable);//使能usart1
/*usart1的nvic中断配置*/
nvic_initstruct.nvic_irqchannelusart1_irqn;
nvic_initstruct.nvic_irqchannelpriority0x02;
nvic_initstruct.nvic_irqchannelcmdenable;
nvic_init(nvic_initstruct);
(smokinggun)这是一首小众却别有味道的英文歌,只听旋律会有一种感觉,听完旋律再细品看看歌词的含义亦是另一番天地