#include "stm32f4_discovery.h"
#include <stdio.h>
#define LED1_ON GPIO_SetBits(GPIOD,GPIO_Pin_12)
#define LED1_OFF GPIO_ResetBits(GPIOD,GPIO_Pin_12)
#define LED2_ON GPIO_SetBits(GPIOD,GPIO_Pin_13)
#define LED2_OFF GPIO_ResetBits(GPIOD,GPIO_Pin_13)
extern uint8_t NbrOfDataToTransfer;
extern uint8_t NbrOfDataToRead;
extern __IO uint8_t TxCounter;
extern __IO uint16_t RxCounter;
void NVIC_Config(void);
void GPIO_Configuration(void);
void STM_EVAL_COMInit(void);
void USART_Configuration(int BaudRate);
void LED_Config(void);
void Delay(__IO uint32_t nCount);
int main(void)
{
/* Configure the system clocks */
NVIC_Config(); /* NVIC Configuration */
//GPIO_Configuration(); /* Configure the GPIOs */
STM_EVAL_COMInit();
USART_Configuration(115200); /* Configure the USART1 's mode */
/* Enable the EVAL_COM1 Transmit interrupt: this interrupt is generated when the
EVAL_COM1 transmit data register is empty */
USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);
LED_Config();
while (1)
{
Delay(0xfFFFFF);
Delay(0xfFFFFF);
printf("\n\rUSART Printf Example\n\r");
}
}
void Delay(__IO uint32_t nCount)
{
while(nCoun
STM32F407 Discovery uart1串口通信
最新推荐文章于 2025-05-11 15:28:56 发布