【STM32F0开发日志/评测/笔记】+互补PWM波的产生
STM32F030 PB14和PB15无法输出PWM求助
【STM32F030探索套件】序列之五 外部中断
【STM32F0开发日志---二】+ucosii.2.92移植在STM32F030
上传个STM32F0+5110+内部温度传感器的菜鸟实例
【STM32F030探索套件使用问题】STM32F030 SPI方式驱动ST7565LCD失败
求一份STM32F051 I2C驱动LCD 12864的例程
STM32F0 M0 向结构体赋值进入HardFault异常
STM32F0 ADC-DMA方式采集2路数据时出现问题
STM32F030C8T6,TIM16定时慢很多问题?
复用时钟没有开启RCC_APB2Periph_AFIO
我放keil里面把格式调了一下,代码还是很乱。
void usart1_init(unsignedintBaudRate)
GPIO_InitTypeDef GPIO_InitStructure;
USART_InitTypeDef USART_InitStructure;
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);//打开GPIOA时钟
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1//打开usart时钟
//GPIO_DeInit(GPIOA);
GPIO_PinAFConfig(GPIOAGPIO_PinSource9GPIO_AF_1);
GPIO_PinSource10Configurepinspushpull;
GPIO_InitStructure.GPIO_PinGPIO_Pin_9 | GPIO_Pin_10 ;
GPIO_InitStructure.GPIO_ModeGPIO_Mode_AF;
GPIO_InitStructure.GPIO_SpeedGPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_OTypeGPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPdGPIO_PuPd_NOPULL;
GPIO_Init(GPIOA&GPIO_InitStructure);
//USART_DeInit(USART1);
USART_InitStructure.USART_BaudRateBaudRate;
USART_InitStructure.USART_WordLengthUSART_WordLength_8b;
USART_InitStructure.USART_StopBitsUSART_StopBits_1;
USART_InitStructure.USART_ParityUSART_Parity_No;
USART_InitStructure.USART_HardwareFlowControlUSART_HardwareFlowControl_None;
USART_InitStructure.USART_ModeUSART_Mode_RxUSART_Mode_Tx;//使能接收和发送
USART_Init(USART1&USART_InitStructure);
USART_ITConfig(USART1USART_IT_RXNE//使能接收中断
USART_Cmd(USART1USART_ClearFlag(USART1USART_FLAG_TC);