当前位置: 首页>>代码示例>>C++>>正文


C++ USART_ClearFlag函数代码示例

本文整理汇总了C++中USART_ClearFlag函数的典型用法代码示例。如果您正苦于以下问题:C++ USART_ClearFlag函数的具体用法?C++ USART_ClearFlag怎么用?C++ USART_ClearFlag使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了USART_ClearFlag函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: RS232_Config

/*====================================================================================================*/
void RS232_Config( void )
{
  GPIO_InitTypeDef GPIO_InitStruct;
  NVIC_InitTypeDef NVIC_InitStruct;
  USART_InitTypeDef USART_InitStruct;

  /* UART Clk Init *************************************************************/
  RCC_APB2PeriphClockCmd(USARTx_CLK, ENABLE);
  RCC_AHBPeriphClockCmd(USARTx_TX_GPIO_CLK | USARTx_RX_GPIO_CLK, ENABLE);

  GPIO_PinAFConfig(USARTx_TX_GPIO_PORT, USARTx_TX_SOURCE, USARTx_TX_AF);
  GPIO_PinAFConfig(USARTx_RX_GPIO_PORT, USARTx_RX_SOURCE, USARTx_RX_AF);

  /* UART NVIC Config **********************************************************/
  NVIC_InitStruct.NVIC_IRQChannel = USARTx_IRQ;
  NVIC_InitStruct.NVIC_IRQChannelPriority = 2;
  NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStruct);

  /* USARTx Tx PA9 */
  GPIO_InitStruct.GPIO_Pin = USARTx_TX_PIN;
  GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF;
  GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;
  GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_UP;
  GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_Init(USARTx_TX_GPIO_PORT, &GPIO_InitStruct);
  /* USARTx Rx PA10 */
  GPIO_InitStruct.GPIO_Pin = USARTx_RX_PIN;
  GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF;
  GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;
  GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_UP;
  GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_Init(USARTx_RX_GPIO_PORT, &GPIO_InitStruct);

  /* UART Init *****************************************************************/
  USART_InitStruct.USART_BaudRate = USARTx_BAUDRATE;
  USART_InitStruct.USART_WordLength = USARTx_BYTESIZE;
  USART_InitStruct.USART_StopBits = USARTx_STOPBITS;
  USART_InitStruct.USART_Parity = USARTx_PARITY;
  USART_InitStruct.USART_HardwareFlowControl = USARTx_HARDWARECTRL;
  USART_InitStruct.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
  USART_Init(USARTx, &USART_InitStruct);

  USART_ITConfig(USARTx, USART_IT_RXNE, ENABLE);
  USART_Cmd(USARTx, ENABLE);

  USART_ClearFlag(USARTx, USART_FLAG_TC);
}
开发者ID:dongruibin,项目名称:MungBeanSprout,代码行数:49,代码来源:module_rs232.c

示例2: printf3

void printf3(char *fmt, ...) 
 { 
 char buffer[BUF_USART3+1];  
 u8 i = 0; 
 va_list arg_ptr; 
 va_start(arg_ptr, fmt);   
 vsnprintf(buffer,BUF_USART3+1,fmt,arg_ptr); 
 USART_ClearFlag(USART3,USART_FLAG_TC);

 while ((i <BUF_USART3) && buffer[i]) 
 { 
         USART_SendData(USART3, (u8) buffer[i++]); 
 while (USART_GetFlagStatus(USART3, USART_FLAG_TC) == RESET);  
 } 
 va_end(arg_ptr); 
 } 
开发者ID:EnestFlyer,项目名称:ControlPlatform,代码行数:16,代码来源:usart.c

示例3: USART1_IRQHandler

void USART1_IRQHandler(void)
#endif
{
    if(USART_GetITStatus( GPRS_USART, USART_IT_RXNE) == SET)
    {
        gprs_receive_process_event(USART_ReceiveData( GPRS_USART));
        USART_ClearITPendingBit( GPRS_USART,USART_IT_RXNE);
    }

    //溢出,如果发生溢出需要先读SR,再读DR寄存器可清除不再进入中断的问题
    if(USART_GetFlagStatus( GPRS_USART,USART_FLAG_ORE) == SET)
    {
        gprs_receive_process_event(USART_ReceiveData( GPRS_USART));
        USART_ClearFlag( GPRS_USART,USART_FLAG_ORE);
    }
}
开发者ID:sundhhy,项目名称:dtu,代码行数:16,代码来源:gprs_uart.c

示例4: USART1_IRQHandler

/*******************************************************************************
* Function Name  : USART1_IRQHandler
* Description    : This function handles USART1 global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void USART1_IRQHandler(void)
{  
  debugpins_isr_set();
  if(USART_GetFlagStatus(USART1, USART_FLAG_RXNE) != RESET)
  {
    USART_ClearFlag(USART1, USART_FLAG_RXNE);
    
    uart_rx_isr();
  }

  if(USART_GetFlagStatus(USART1, USART_FLAG_TXE) != RESET)
  { 
    uart_tx_isr(); 
  }
  debugpins_isr_clr();
}
开发者ID:barriquello,项目名称:iotstack,代码行数:23,代码来源:stm32f10x_it.c

示例5: Usart1_Send

/**
*************************************************
 @Function     :Usart_Send()
 @Return_Value :Null
 @Peremater    :
 @Brief        :
***************************************************/
u8 Usart1_Send(char *pBuffer,u32 SendNumber)
{ 
// 
if(USART_GetFlagStatus(USART1,USART_FLAG_TC) == SET)
  {
	 DMA_Cmd(DMA1_Channel4,DISABLE); 
	 DMA_ClearFlag(DMA1_FLAG_TC4);
	 USART_ClearFlag(USART1,USART_FLAG_TC);
	 DMA1_Channel4->CNDTR =SendNumber;
	 DMA1_Channel4->CMAR=(u32)pBuffer;
	 DMA_Cmd(DMA1_Channel4,ENABLE);
	 
	 return 1;
  }
 return 0;
}
开发者ID:LinCaiCan,项目名称:LCC,代码行数:23,代码来源:stm32f10x_bus.c

示例6: EXTI9_5_IRQHandler

/*******************************************************************************
* Function Name  : EXTI9_5_IRQHandler
* Description    : This function handles External lines 9 to 5 interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void EXTI9_5_IRQHandler(void)
{
  if(EXTI_GetITStatus(EXTI_LINE_KEY_BUTTON) != RESET)
  {
    /* Flush DR register */    
    USART_ReceiveData(USART2);
    /* Clear the USART2 RXNE Flag */
    USART_ClearFlag(USART2, USART_FLAG_RXNE);

    /* Enable the USART2 mute mode*/
    USART_ReceiverWakeUpCmd(USART2, ENABLE);

    /* Clear Key Button EXTI Line Pending Bit */
    EXTI_ClearITPendingBit(EXTI_LINE_KEY_BUTTON); 
  }
}
开发者ID:AkeelAli,项目名称:microprocessorsystems,代码行数:23,代码来源:stm32f10x_it.c

示例7: USART1_Config

void USART1_Config(USART_TypeDef* USARTx,INT32U bandrate)
{	
    USART_InitTypeDef USART_InitStructure;

	RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1,ENABLE);
    USART_InitStructure.USART_BaudRate = bandrate;					
    USART_InitStructure.USART_WordLength = USART_WordLength_8b;		
    USART_InitStructure.USART_StopBits = USART_StopBits_1;			
    USART_InitStructure.USART_Parity = USART_Parity_No;				
    USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;   
    USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;					
    USART_Init(USARTx, &USART_InitStructure);							

	USART_ClearFlag(USARTx,USART_FLAG_TC);
    USART_Cmd(USARTx, ENABLE);	
}
开发者ID:294250581,项目名称:TMCS,代码行数:16,代码来源:utBoard.c

示例8: USART1_IRQHandler

void USART1_IRQHandler(void)
{
	int i=0;
	int status=SUCCESS;

   if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET)				//interrupt called in when you receive a char on usart1
  {
       GPIO_WriteBit(GPIOA,GPIO_Pin_12,Bit_SET); //pause the RF trasmission
	   USART_ITConfig(USART1, USART_IT_RXNE, DISABLE);//disable the RXNE interrupts


	   for (i=0;i<32;i++){
	       GPIO_WriteBit(GPIOA,GPIO_Pin_12,Bit_SET);				//pause the RF trasmission
   		   status=UsartGetTimed(USART1, &Receivedpackage.bytes[i]);	//Receive the char in the buffer
   		   GPIO_WriteBit(GPIOA,GPIO_Pin_12,Bit_RESET);				//Restart the RF trasmission
   		   if (status==ERROR) break;								//if the tramission Timed out than break
   		   }

	   	if (status==SUCCESS){										//if you received 32 chars
	   		 if(checkDatagram(&Receivedpackage))					//and the datagram is correct parse it
	   			status=parseDatagram(&Receivedpackage);
	   		 else status=ERROR;
	   	   }

	     USART_ClearFlag(USART1, USART_IT_RXNE);
	     USART_ClearITPendingBit(USART1, USART_IT_RXNE);
	     USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);
	     GPIO_WriteBit(GPIOA,GPIO_Pin_12,Bit_RESET); //Restart the RF trasmission

	     if (status==SUCCESS)										//if everything is correct than send ACK
	    	 sendAck();
	     else														//If not send NACK
	    	 sendNack();

  	 }

  /*if(USART_GetITStatus(USART1, USART_IT_TXE) != RESET)
  {
    /* Write one byte to the transmit data register //
    USART_SendData(USART1, TxBuffer[TxCount++]);

    if(TxCount == NbrOfDataToTransfer)
    {
      // Disable the USART1 Transmit interrupt
      USART_ITConfig(USART1, USART_IT_TXE, DISABLE);
    } */
}
开发者ID:Broentech,项目名称:Vri_fog_device,代码行数:47,代码来源:interHandler.c

示例9: Serial_Config

/*====================================================================================================*/
void Serial_Config( void )
{
  GPIO_InitTypeDef GPIO_InitStruct;
  USART_InitTypeDef UART_InitStruct;
  NVIC_InitTypeDef NVIC_InitStruct;

  /* UART Clk ******************************************************************/
  UARTx_CLK_ENABLE();

  /* UART AF *******************************************************************/
  GPIO_PinAFConfig(UARTx_TX_GPIO_PORT, UARTx_TX_SOURCE, UARTx_TX_AF);
  GPIO_PinAFConfig(UARTx_RX_GPIO_PORT, UARTx_RX_SOURCE, UARTx_RX_AF);

  /* UART Pin ******************************************************************/
  GPIO_InitStruct.GPIO_Mode  = GPIO_Mode_AF;
  GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;
  GPIO_InitStruct.GPIO_Speed = GPIO_Speed_100MHz;
  GPIO_InitStruct.GPIO_PuPd  = GPIO_PuPd_UP;

  GPIO_InitStruct.GPIO_Pin   = UARTx_TX_PIN;
  GPIO_Init(UARTx_TX_GPIO_PORT, &GPIO_InitStruct);

  GPIO_InitStruct.GPIO_Pin   = UARTx_RX_PIN;
  GPIO_Init(UARTx_RX_GPIO_PORT, &GPIO_InitStruct);

  /* UART IT *******************************************************************/
  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
  NVIC_InitStruct.NVIC_IRQChannel                   = UARTx_IRQn;
  NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority = 0x000F;
  NVIC_InitStruct.NVIC_IRQChannelSubPriority        = 0;
  NVIC_InitStruct.NVIC_IRQChannelCmd                = ENABLE;
  NVIC_Init(&NVIC_InitStruct);

  /* UART Init *****************************************************************/
  UART_InitStruct.USART_BaudRate            = UARTx_BAUDRATE;
  UART_InitStruct.USART_WordLength          = UARTx_BYTESIZE;
  UART_InitStruct.USART_StopBits            = UARTx_STOPBITS;
  UART_InitStruct.USART_Parity              = UARTx_PARITY;
  UART_InitStruct.USART_HardwareFlowControl = UARTx_HARDWARECTRL;
  UART_InitStruct.USART_Mode                = UARTx_MODE;
  USART_Init(UARTx, &UART_InitStruct);

  /* UART Enable ***************************************************************/
  USART_ITConfig(UARTx, USART_IT_RXNE, ENABLE);
  USART_Cmd(UARTx, ENABLE);
  USART_ClearFlag(UARTx, USART_FLAG_TC);
}
开发者ID:KitSprout,项目名称:KDWM1000,代码行数:48,代码来源:module_serial.c

示例10: Uart1_Init

/*
	函数原型:Uart1_Init(u32 bound)
	参数说明:bound:波特率参数
	功能描述:设置UART1串口
	返回状态: 
	备注:  	开启串口1接收中断	,需要改变宏定义USART1_RX_IRQ_ENABLE的值	
*/
void Uart1_Init(u32 bound)
{
   //GPIO端口设置
  GPIO_InitTypeDef GPIO_InitStructure;
	USART_InitTypeDef USART_InitStructure;
	NVIC_InitTypeDef NVIC_InitStructure;
	
	RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA,ENABLE); //使能GPIOA时钟
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1,ENABLE);//使能USART1时钟
	
	USART_DeInit(USART1);         //串口复位,一般外设使用之前都要进行复位	
	
	//串口1对应引脚复用映射
	GPIO_PinAFConfig(GPIOA,GPIO_PinSource9,GPIO_AF_USART1); //GPIOA9复用为USART1
	GPIO_PinAFConfig(GPIOA,GPIO_PinSource10,GPIO_AF_USART1); //GPIOA10复用为USART1
	
	//USART1端口配置
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9 | GPIO_Pin_10; //GPIOA9与GPIOA10
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;//复用功能
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;	//速度50MHz
	GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推挽复用输出
	GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; //上拉
	GPIO_Init(GPIOA,&GPIO_InitStructure); //初始化PA9,PA10

   //USART1 初始化设置
	USART_InitStructure.USART_BaudRate = bound;//波特率设置
	USART_InitStructure.USART_WordLength = USART_WordLength_8b;//字长为8位数据格式
	USART_InitStructure.USART_StopBits = USART_StopBits_1;//一个停止位
	USART_InitStructure.USART_Parity = USART_Parity_No;//无奇偶校验位
	USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;//无硬件数据流控制
	USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;	//收发模式
  USART_Init(USART1, &USART_InitStructure); //初始化串口1
	
#if USART1_RX_IRQ_ENABLE
	//Usart1 NVIC 配置
  NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;//串口1中断通道
	NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=3;//抢占优先级3
	NVIC_InitStructure.NVIC_IRQChannelSubPriority =3;		//子优先级3
	NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;			//IRQ通道使能
	NVIC_Init(&NVIC_InitStructure);	//根据指定的参数初始化VIC寄存器、
	
	USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);//开启相关中断
#endif	

  USART_Cmd(USART1, ENABLE);  //使能串口1 
	USART_ClearFlag(USART1, USART_FLAG_TC);		//避免第一个字节发送失败
}
开发者ID:244753440,项目名称:STM32F407,代码行数:54,代码来源:usart.c

示例11: USART1_Init_Config

/*******************************************************************************
* 函数名  : USART1_Init_Config
* 描述    : USART1初始化配置
* 输入    : bound:波特率(常用:2400、4800、9600、19200、38400、115200等)
* 输出    : 无
* 返回    : 无 
* 说明    : 无
*******************************************************************************/
void USART1_Init_Config(u32 bound)
{
	GPIO_InitTypeDef  GPIO_InitStructure;
	USART_InitTypeDef USART_InitStructure;
	NVIC_InitTypeDef  NVIC_InitStructure;
	
	/*使能USART1和GPIOA外设时钟*/ 
	
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1 | RCC_APB2Periph_GPIOA, ENABLE);	

	/*复位串口1*/
 	USART_DeInit(USART1);  
	
	/*USART1_GPIO初始化设置*/ 
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;			//USART1_TXD(PA.9)     
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;		//复用推挽输出
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;	//设置引脚输出最大速率为50MHz
    GPIO_Init(GPIOA, &GPIO_InitStructure);				//调用库函数中的GPIO初始化函数,初始化USART1_TXD(PA.9)  
   
    
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;				//USART1_RXD(PA.10)
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;	//浮空输入
    GPIO_Init(GPIOA, &GPIO_InitStructure);					//调用库函数中的GPIO初始化函数,初始化USART1_RXD(PA.10)


   /*USART1 初始化设置*/
	USART_InitStructure.USART_BaudRate = bound;										//设置波特率
	USART_InitStructure.USART_WordLength = USART_WordLength_8b;						//8位数据格式
	USART_InitStructure.USART_StopBits = USART_StopBits_1;							//1个停止位
	USART_InitStructure.USART_Parity = USART_Parity_No;								//无奇偶校验位
	USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;	//无硬件数据流控制
	USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;					//工作模式设置为收发模式
    USART_Init(USART1, &USART_InitStructure);										//初始化串口1

   /*Usart1 NVIC配置*/
    NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;
	NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=1;	//抢占优先级3
	NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;		//从优先级3
	NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;			//IRQ通道使能
	NVIC_Init(&NVIC_InitStructure);							//根据指定的参数初始化VIC寄存器 
	  
    USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);			//使能串口1接收中断

    USART_Cmd(USART1, ENABLE);                    			//使能串口 
	USART_ClearFlag(USART1, USART_FLAG_TC);					//清除发送完成标志
}
开发者ID:Huweijian,项目名称:STM32_ZCH,代码行数:54,代码来源:usart.c

示例12: UART_Send

int UART_Send(u8 *sendBuf, u32 bufLen)
{
  DMA_InitTypeDef  DMA_InitStructure;
  
  mico_mcu_powersave_config(mxDisable);
  
  DMA_DeInit(UART_TX_DMA_Stream);
  DMA_InitStructure.DMA_PeripheralBaseAddr = USARTx_DR_Base;
  DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
  DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
  DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;
  DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;
  DMA_InitStructure.DMA_Mode = DMA_Mode_Normal;
  DMA_InitStructure.DMA_Priority = DMA_Priority_VeryHigh;
  DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Enable;
  DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_Full;
  DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;
  DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;
  DMA_InitStructure.DMA_Channel = DMA_Channel_4;
  DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral;  
  
  /****************** USART will Transmit Specific Command ******************/ 
  /* Prepare the DMA to transfer the transaction command (2bytes) from the
  memory to the USART */  
  DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)sendBuf;
  DMA_InitStructure.DMA_BufferSize = (uint16_t)bufLen;
  DMA_Init(UART_TX_DMA_Stream, &DMA_InitStructure); 
  
  DMA_ITConfig(UART_TX_DMA_Stream, DMA_IT_TC, ENABLE );
  /* Enable the USART DMA requests */
  
  
  /* Clear the TC bit in the SR register by writing 0 to it */
  USART_ClearFlag(USARTx, USART_FLAG_TC);
  
  /* Enable the DMA TX Stream, USART will start sending the command code (2bytes) */
  DMA_Cmd(UART_TX_DMA_Stream, ENABLE);
  
  if(sem_init)
    mico_rtos_get_semaphore(&tx_complete, 10);
  while( ( USARTx->SR & USART_SR_TC )== 0 );
  
  mico_mcu_powersave_config(mxEnable);

  return 0;
}
开发者ID:agb861,项目名称:STM32F,代码行数:46,代码来源:uart.c

示例13: USART1_IRQHandler

void USART1_IRQHandler (void)
{
    if(USART_GetFlagStatus(USART1,USART_FLAG_RXNE)!=RESET)
    {
        if (USART_ReceiveData(USART1)=='c') {
            queue=0;
        }
        ReceiveBuff[queue]=USART_ReceiveData(USART1);
        ++queue;
        if (USART_ReceiveData(USART1)=='d') {
            USART_ITConfig(USART1,USART_IT_RXNE,DISABLE);
            USART_FLAG=1;
        }
    }
    USART_ClearFlag(USART1,USART_IT_RXNE);
    USART_ClearITPendingBit(USART1,USART_IT_RXNE);
}
开发者ID:guzhaoyuan,项目名称:ARM_ST_SmartCan,代码行数:17,代码来源:usart1.c

示例14: USART1_IRQHandler

/*******************************************************************************
* Function Name  : USART1_IRQHandler
* Description    : This function handles USART1 global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void USART1_IRQHandler(void)
{
if(USART_GetFlagStatus(USART1, USART_FLAG_RXNE) != RESET)	   //判断读寄存器是否非空
  
 { 
   
  // unsigned int i;
    
     USART_SendData(USART1,USART_ReceiveData(USART1));
 }
  //溢出-如果发生溢出需要先读 SR,再读 DR 寄存器则可清除不断入中断的问题[牛人说要这样]  
  if(USART_GetFlagStatus(USART1,USART_FLAG_ORE)==SET) 
  {   
    USART_ClearFlag(USART1,USART_FLAG_ORE); //读 SR 其实就是清除标志 
    USART_ReceiveData(USART1); //读 DR  
  }
}
开发者ID:qiubailiang,项目名称:src_docs,代码行数:24,代码来源:stm32f10x_it.c

示例15: uartResumeDma

static void uartResumeDma()
{
  if (dmaIsPaused)
  {
    // Update DMA counter
    DMA_SetCurrDataCounter(UART_DMA_STREAM, remainingDMACount);
    // Update memory read address
    UART_DMA_STREAM->M0AR = (uint32_t)&dmaBuffer[initialDMACount - remainingDMACount];
    // Enable the Transfer Complete interrupt
    DMA_ITConfig(UART_DMA_STREAM, DMA_IT_TC, ENABLE);
    /* Clear transfer complete */
    USART_ClearFlag(UART_TYPE, USART_FLAG_TC);
    /* Enable DMA USART TX Stream */
    DMA_Cmd(UART_DMA_STREAM, ENABLE);
    dmaIsPaused = false;
  }
}
开发者ID:guygrigsby,项目名称:crazyflie-firmware,代码行数:17,代码来源:uart_syslink.c


注:本文中的USART_ClearFlag函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。