本文整理汇总了C++中USART_ClearITPendingBit函数的典型用法代码示例。如果您正苦于以下问题:C++ USART_ClearITPendingBit函数的具体用法?C++ USART_ClearITPendingBit怎么用?C++ USART_ClearITPendingBit使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了USART_ClearITPendingBit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: USART2_IRQHandler
void USART2_IRQHandler(void)
{
u8 SendData;
if(SET == USART_GetITStatus(USART2, USART_IT_TXE))
{
USART_ClearITPendingBit(USART2, USART_IT_TXE);
#if 1
if(FIFO_GET_ONE(McuUart2_TxFifo,&SendData))
{
USART_SendData(USART2,SendData);
}
else
{
USART_ITConfig(USART2, USART_IT_TXE, DISABLE);
USART_ITConfig(USART2, USART_IT_TC, ENABLE);
}
#else
if (m_SendBuff.len > 0 )
{
USART_SendData(USART2, m_SendBuff.buf[m_SendBuff.ind++]);
m_SendBuff.len--;
}
else
{
USART_ITConfig(USART2, USART_IT_TXE, DISABLE);
USART_ITConfig(USART2, USART_IT_TC, ENABLE);
}
#endif
}
if (USART_GetITStatus(USART2, USART_IT_TC) != RESET)//去掉else
{
USART_ClearITPendingBit(USART2, USART_IT_TC);
USART_ITConfig(USART2, USART_IT_TC, DISABLE);
m_SendBuff.len = 0;
eTXIdle = TRUE;
}
if (USART_GetITStatus(USART2, USART_IT_RXNE) != RESET)//去掉else
{
u8 ch;
USART_ClearITPendingBit(USART2, USART_IT_RXNE);
ch = USART_ReceiveData(USART2);
if(UpgradeReady == 1)
{
ReceOneChar(ch); //IAP
}
else
{
#ifdef ANDROID_UPGRADE
FIFO_PUT_ONE(McuUart2_RxFifo,ch);
//ReceOneCharByandroid(ch);
#else
ReceOneCharVerify(ch);
#endif
}
// if (receChar != NULL)
// (*receChar)(ch);
}
}
示例2: OSView_RxTxISRHandler
/*
*********************************************************************************************************
* Rx/Tx Communication handler for uC/OS-View
*
* Description: This function is called in stm32f10x_it.c
*********************************************************************************************************
*/
void OSView_RxTxISRHandler (void)
{
CPU_SR cpu_sr;
CPU_CRITICAL_ENTER(); /* Tell uC/OS-II that we are starting an ISR */
OSIntNesting++;
CPU_CRITICAL_EXIT();
if (USART_GetITStatus(OS_VIEW_USART, USART_IT_RXNE) != RESET) {
/* Read one byte from the receive data register */
OSView_RxHandler( USART_ReceiveData(OS_VIEW_USART) & 0xFF );
USART_ClearITPendingBit(OS_VIEW_USART, USART_IT_RXNE); /* Clear the USART Receive interrupt */
}
if (USART_GetITStatus(OS_VIEW_USART, USART_IT_TXE) != RESET) {
OSView_TxHandler();
USART_ClearITPendingBit(OS_VIEW_USART, USART_IT_TXE); /* Clear the USART transmit interrupt */
}
OSIntExit(); /* Tell uC/OS-II that we are leaving the ISR */
}
示例3: USART3_IRQHandler
void USART3_IRQHandler(void)
{
//用户程序..
UartType *P2data = &UartAppData3;
/* enter interrupt */
rt_interrupt_enter();
if ( USART_GetITStatus(USART3, USART_IT_RXNE) != RESET )
{
UCHAR ucChar;
USART_ClearITPendingBit(USART3, USART_IT_RXNE);
ucChar = USART_ReceiveData(USART3);
if ( !P2data->Flags.Solo.RecFlame )
{
P2data->RxTimeout = __25ms__;
if ( P2data->RecCnt < (UART_BUFF_SIZE-1) )
{
P2data->TxRxBuf[P2data->RecCnt] = ucChar;
P2data->RecCnt++;
if ( P2data->RecCnt == 8 )
{
P2data->Flags.Solo.ShortFrame =1;
}
if ( P2data->RecCnt == UART_BUFF_SIZE-1 )
{
P2data->Flags.Solo.RecFlame =1;
}
//if (P2data->RecCnt == UART_SHORT_LEN)
//{
// P2data->Flags->Solo->ShortFrame =1;
//}
}
}
}
else if ( USART_GetITStatus(USART3,USART_IT_TXE) )
{
USART_ClearITPendingBit(USART3,USART_IT_TXE);
USART_ClearFlag(USART3,USART_FLAG_TC);
if ( P2data->SentCnt < P2data->ToSend )
{
USART_SendData(USART3,P2data->TxRxBuf[P2data->SentCnt++]);
}
else
{
USART_ITConfig(USART3, USART_IT_TXE, DISABLE);
USART_ITConfig(USART3, USART_IT_TC, ENABLE);
}
}
else if ( USART_GetITStatus(USART3,USART_IT_TC) )
{
P2data->Flags.Solo.TxStart = 0;
Run_void(P2data->DisTxPin);
USART_ITConfig(USART3, USART_IT_TC, DISABLE);
}
/* leave interrupt */
rt_interrupt_leave();
}
示例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)
{
int i;
if(USART_GetITStatus(USART1,USART_IT_RXNE) != RESET)
{
cRxBuffer[nRxCounter] = (USART_ReceiveData(USART1)&0x7F);
USART_ClearITPendingBit(USART1,USART_IT_RXNE);
if(cRxBuffer[nRxCounter] == ')')
{
for(i=0;i<nRxCounter;i++)
cTxBuffer[i] = cRxBuffer[i];
nRxCounter=0;
nGotData =1;
}
else
nRxCounter++;
}
if(USART_GetITStatus(USART1, USART_IT_TXE) != RESET)
{
USART_SendData(USART1, cTxBuffer[nTxCounter]);
USART_ClearITPendingBit(USART1, USART_IT_TXE);
if(cTxBuffer[nTxCounter] == ')')
{
nTxCounter = 0;
while(USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET);
GPIO_ResetBits(GPIOA, GPIO_Pin_8);
USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);
USART_ITConfig(USART1, USART_IT_TXE, DISABLE);
GPIO_ResetBits(GPIOA, GPIO_Pin_8);
}
else
nTxCounter++;
}
}
示例5: USART1_IRQHandler
void USART1_IRQHandler(void)
{
uint32_t data;
static BaseType_t xHigherPriorityTaskWoken;
xHigherPriorityTaskWoken = pdFALSE;
if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET)
{
USART_ClearITPendingBit(USART1, USART_IT_RXNE);
data = USART_ReceiveData(USART1);
CircularBuffer_Write(ptxcbuf, &data, 1);
USART_ITConfig(USART1, USART_IT_IDLE, ENABLE);
}
else if(USART_GetITStatus(USART1, USART_IT_IDLE) != RESET)
{
USART_ClearITPendingBit(USART1, USART_IT_IDLE);
USART_ITConfig(USART1, USART_IT_IDLE, DISABLE);
data = (CircularBuffer_Length(ptxcbuf) -
(lastHead- CircularBuffer_HeadPosition(ptxcbuf)))%CircularBuffer_Length(ptxcbuf);
lastHead = CircularBuffer_HeadPosition(ptxcbuf);
xQueueSendFromISR(frameLengthQueue, &data, &xHigherPriorityTaskWoken);
}
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
}
示例6: usart1_hard_init
static u8 usart1_hard_init(USART_InitTypeDef* desc)
{
#if (USART1_RX_MODE == RX_PACKET_MODE)
usart_timer_init(); //启用定时器计算包接收超时
#endif
baudRate = desc->USART_BaudRate;
usart1_update_timeout(baudRate,N_char_timeout);
USART_Cmd(USART1, DISABLE); //使能失能串口外设
usart1_commu_param_init(desc); //串口初始化
usart1_gpio_init(); //串口引脚初始化
usart1_event_init();
usart1_fifo_init();
usart1_nvic_init();
USART_ClearITPendingBit(USART1,USART_IT_RXNE);//清接收标志
USART_ClearITPendingBit(USART1,USART_IT_TXE);
USART_ClearITPendingBit(USART1,USART_IT_TC);
#if(USART1_TX_MODE==TX_IRQ)
#elif(USART1_TX_MODE==TX_DMA)
usart1_dmatxd_init();
#endif
USART_ITConfig(USART1,USART_IT_RXNE, ENABLE); //开启接收中断
USART_Cmd(USART1, ENABLE); //使能失能串口外设
return 0;
}
示例7: USART_ClearITPendingBit
void STM32_M0_UART::hal_uartIRQ_Handler(void)
{
// RX IRQ HANDLER
if (USART_GetITStatus(USART_PORT, USART_IT_RXNE) != RESET)
{
USART_ClearITPendingBit(USART_PORT, USART_IT_RXNE);
if (rx_buf.write(USART_ReceiveData(USART_PORT)) == -1)
{
USART_ITConfig(USART_PORT, USART_IT_RXNE, DISABLE);
}
}
// TX IRQ HANDLER
if (USART_GetITStatus(USART_PORT, USART_IT_TC) != RESET)
{
uint8_t tx_byte;
USART_ClearITPendingBit(USART_PORT, USART_IT_TC);
if (tx_buf.read(&tx_byte) == -1)
{
USART_ITConfig(USART_PORT, USART_IT_TC, DISABLE);
tx_state = UART_TX_STATE_COMPLETE;
}
else
{
USART_SendData(USART_PORT, tx_byte);
tx_state = UART_TX_STATE_SENDING;
}
}
}
示例8: USART1_IRQHandler
/*----------------------------------------------------------------------------*/
void USART1_IRQHandler(void)
{
if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET)
{
USART_ClearITPendingBit(USART1, USART_IT_RXNE); //?????????
/* Read one byte from the receive data register */
lb_push(&uart_buffer.rx, USART_ReceiveData(USART1));
}
if(USART_GetITStatus(USART1, USART_IT_TXE) != RESET)
{
uint8_t c;
USART_ClearITPendingBit(USART1, USART_IT_TXE); //??????????
/* Write one byte to the transmit data register */
/* Write one byte to the transmit data register */
if(lb_pop(&uart_buffer.tx, &c))
USART_SendData(USART1, c);
else
{
/* Disable the USART1 Transmit interrupt */
USART_ITConfig(USART1, USART_IT_TXE, DISABLE);
}
}
}
示例9: serial_int1_send
void serial_int1_send(void) //send data to USAR1
{
if (counter_send <= cmd_send_lenth)
// UDR1=txd1_buffer[counter_send++];
{
USART_SendData(USART2, wifi_send_packet_buf_pub[counter_send]);
USART_ClearITPendingBit(USART2, USART_IT_TXE);
counter_send++;
}
else
{
USART_SendData(USART2, wifi_send_packet_buf_pub[counter_send]);
USART_ClearITPendingBit(USART2, USART_IT_TXE);
counter_send = 0;
txd1_buff_cFlag = 1;
USART_ITConfig(USART2, USART_IT_TXE, DISABLE);
time_tick_cnt2 = 0;
RS485_RX_ENABLE;
}
if (counter_send>40)
counter_send=0;
}
示例10: USART2_IRQHandler
void USART2_IRQHandler()
{
//RX Interrupt Mode
if(USART_GetITStatus(USART2, USART_IT_RXNE) != RESET)
{
if(USART_GetFlagStatus(USART2,USART_FLAG_PE|USART_FLAG_FE|USART_FLAG_ORE)==0)
{
RX_Buffer[RX_IN_Index]=USART_ReceiveData(USART2);
if (++RX_IN_Index == sizeof(RX_Buffer)) RX_IN_Index = 0;
if (++RX_Count == sizeof(RX_Buffer)) RX_Count = 0;
}
USART_ClearITPendingBit(USART2,USART_IT_RXNE);
}
//TX_Buffer Interrupt Mode
if(USART_GetITStatus(USART2, USART_IT_TC) != RESET)
{
if(TX_Count)
{
--TX_Count;
USART_SendData(USART2, TX_Buffer[TX_OUT_Index]);
if(++TX_OUT_Index == sizeof(TX_Buffer))
TX_OUT_Index=0;
}
USART_ClearITPendingBit(USART2,USART_IT_TC);
}
}
示例11: USART3_IRQHandler
void USART3_IRQHandler(void)
{
struct stm32_uart* uart;
uart = &uart3;
/* enter interrupt */
rt_interrupt_enter();
if(USART_GetITStatus(uart->uart_device, USART_IT_RXNE) != RESET)
{
rt_hw_serial_isr(&serial3, RT_SERIAL_EVENT_RX_IND);
/* clear interrupt */
USART_ClearITPendingBit(uart->uart_device, USART_IT_RXNE);
}
if (USART_GetITStatus(uart->uart_device, uart->tx_irq_type) != RESET)
{
/* clear interrupt */
if (uart->tx_irq_type == USART_IT_TC)
{
USART_ClearITPendingBit(uart->uart_device, uart->tx_irq_type);
}
}
if (USART_GetFlagStatus(uart->uart_device, USART_FLAG_ORE) == SET)
{
stm32_getc(&serial3);
}
/* leave interrupt */
rt_interrupt_leave();
}
示例12: USART1_IRQHandler
/**
* @brief This function handles USART1 global interrupt request.
* @param None
* @retval None
*/
void USART1_IRQHandler(void)
{
uint16_t l_tmp; //Received char from USART1
if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET)
{
USART_ClearITPendingBit(USART1, USART_IT_RXNE);
//Read one byte from the receive data register
l_tmp = USART_ReceiveData(USART1);
if(rcv_buff_full){
//rcv buffer is full ==> trash rcv char
rcv_buff_overload++;
} else {
*pt_rcv_write++ = (char)l_tmp; //put rcv char in buffer
nb_rcv_buff_char++; //One char more to be read in buffer
if(pt_rcv_write > &rcv_buff[BUFFER_RCV_SIZE]) {
//pointer rollover rcv_buffer
pt_rcv_write = rcv_buff;
}
if(pt_rcv_write == pt_rcv_read) {
//Test if rcv buffer is full
rcv_buff_full = 1;
}
}
}
USART_ClearITPendingBit(USART1, USART_IT_ORE);
}
示例13: USART1_IRQHandler
void USART1_IRQHandler(void)
{
//Rx
if (USART_GetITStatus(HAL_COM, USART_IT_RXNE) != RESET)
{
/* Send the received data to the PC Host*/
_Reg.status=(HAL_COM->SR);
HAL_COM->SR=0;
_Reg.data=USART_ReceiveData(HAL_COM);
if( _USART1_RX_Event) _USART1_RX_Event();
USART_ClearITPendingBit(HAL_COM, USART_IT_RXNE);
}
/* If overrun condition occurs, clear the ORE flag and recover communication */
if (USART_GetFlagStatus(HAL_COM, USART_FLAG_ORE) != RESET)
{
(void)USART_ReceiveData(HAL_COM);
USART_ClearITPendingBit(HAL_COM, USART_IT_RXNE);
}
//buffer hardware TX vuoto
if(USART_GetITStatus(HAL_COM, USART_IT_TXE) != RESET)
{
if( _USART1_TX_Event) _USART1_TX_Event();
USART_ClearITPendingBit(HAL_COM, USART_IT_TXE);
}
}
示例14: uart_irq_handler
/*******************************************************************************
* Function Name : uart_irq_handler
* Description : Interrupt handle function
* Input : - Uart: Select the USART or the UART peripheral.
* Output : None
* Return : None
*******************************************************************************/
void uart_irq_handler(const _Uart_Descriptor *Uart)
{
//
__hw_enter_interrupt();
//
if (*Uart->Ctrl && (*Uart->Ctrl)->DmaBufSize)
{
if (USART_GetITStatus(Uart->UARTx, USART_IT_IDLE) != RESET) // Idle line
{
NVIC_SetPendingIRQ(Uart->DMAx_IRQn);
USART_ReceiveData(Uart->UARTx);
}
}
else if (USART_GetITStatus(Uart->UARTx, USART_IT_RXNE) != RESET) // Received Data Ready to be Read
{
if (*Uart->Ctrl && ((*Uart->Ctrl)->RxCnt < (*Uart->Ctrl)->RxBufSize))
{
(*Uart->Ctrl)->RxBufPtr[(*Uart->Ctrl)->RxiPut++] = (char)USART_ReceiveData(Uart->UARTx);
//lepton
if(!(*Uart->Ctrl)->RxCnt){
if(Uart->board_uart_info && Uart->board_uart_info->desc_r!=-1)
__fire_io_int(ofile_lst[Uart->board_uart_info->desc_r].owner_pthread_ptr_read);
}
//lepton
(*Uart->Ctrl)->RxCnt++;
if ((*Uart->Ctrl)->RxiPut >= (*Uart->Ctrl)->RxBufSize) (*Uart->Ctrl)->RxiPut = 0;
if (((*Uart->Ctrl)->HwCtrl & UART_HW_FLOW_CTRL_RX) && ((*Uart->Ctrl)->RxCnt > ((*Uart->Ctrl)->RxBufSize - (*Uart->Ctrl)->DmaBufSize))) uart_set_rx_hw_fc(Uart);
}
else USART_ClearITPendingBit(Uart->UARTx, USART_IT_RXNE);
#ifdef _UART_OS_SUPPORT
isr_evt_set((*Uart->Ctrl)->Event, (*Uart->Ctrl)->Task);
#endif
}
if (USART_GetITStatus(Uart->UARTx, USART_IT_TXE) != RESET) // Transmit Data Register Empty
{
if (*Uart->Ctrl && (*Uart->Ctrl)->TxCnt)
{
USART_SendData(Uart->UARTx, (*Uart->Ctrl)->TxBufPtr[(*Uart->Ctrl)->TxiGet++]);
(*Uart->Ctrl)->TxCnt--;
if ((*Uart->Ctrl)->TxiGet >= (*Uart->Ctrl)->TxBufSize) (*Uart->Ctrl)->TxiGet = 0;
}
else{
USART_ITConfig(Uart->UARTx, USART_IT_TXE, DISABLE);
//lepton
if(Uart->board_uart_info && Uart->board_uart_info->desc_w!=-1)
__fire_io_int(ofile_lst[Uart->board_uart_info->desc_w].owner_pthread_ptr_write);
//lepton
}
}
if (USART_GetITStatus(Uart->UARTx, USART_IT_TC) != RESET) // Transmission complete
{
if (*Uart->Ctrl && ((*Uart->Ctrl)->HwCtrl & UART_HALF_DUPLEX))
uart_tx_disable(Uart);
USART_ClearITPendingBit(Uart->UARTx, USART_IT_TC);
}
//
__hw_leave_interrupt();
}
示例15: rt_hw_serial_isr
/* ISR for serial interrupt */
void rt_hw_serial_isr(rt_device_t device)
{
struct stm32_serial_device* uart = (struct stm32_serial_device*) device->user_data;
if(USART_GetITStatus(uart->uart_device, USART_IT_RXNE) != RESET)
{
/* interrupt mode receive */
RT_ASSERT(device->flag & RT_DEVICE_FLAG_INT_RX);
/* save on rx buffer */
while (uart->uart_device->SR & USART_FLAG_RXNE)
{
rt_base_t level;
/* disable interrupt */
level = rt_hw_interrupt_disable();
/* save character */
uart->int_rx->rx_buffer[uart->int_rx->save_index] = uart->uart_device->DR & 0xff;
uart->int_rx->save_index ++;
if (uart->int_rx->save_index >= UART_RX_BUFFER_SIZE)
uart->int_rx->save_index = 0;
/* if the next position is read index, discard this 'read char' */
if (uart->int_rx->save_index == uart->int_rx->read_index)
{
uart->int_rx->read_index ++;
if (uart->int_rx->read_index >= UART_RX_BUFFER_SIZE)
uart->int_rx->read_index = 0;
}
/* enable interrupt */
rt_hw_interrupt_enable(level);
}
/* clear interrupt */
USART_ClearITPendingBit(uart->uart_device, USART_IT_RXNE);
/* invoke callback */
if (device->rx_indicate != RT_NULL)
{
rt_size_t rx_length;
/* get rx length */
rx_length = uart->int_rx->read_index > uart->int_rx->save_index ?
UART_RX_BUFFER_SIZE - uart->int_rx->read_index + uart->int_rx->save_index :
uart->int_rx->save_index - uart->int_rx->read_index;
device->rx_indicate(device, rx_length);
}
}
if (USART_GetITStatus(uart->uart_device, USART_IT_TC) != RESET)
{
/* clear interrupt */
USART_ClearITPendingBit(uart->uart_device, USART_IT_TC);
}
}