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


C++ UARTIntClear函数代码示例

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


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

示例1: UARTIntStatus

void Uart::interruptHandler(void)
{
    uint32_t status;

    // Read interrupt source
    status = UARTIntStatus(uart_.base, true);

    // Clear UART interrupt in the NVIC
    IntPendClear(uart_.interrupt);

    // Process TX interrupt
    if (status & UART_INT_TX)
    {
        UARTIntClear(uart_.base, UART_INT_TX);
        interruptHandlerTx();
    }

    // Process RX interrupt
    if (status & UART_INT_RX ||
        status & UART_INT_RT)
    {
        UARTIntClear(uart_.base, UART_INT_RX | UART_INT_RT);
        interruptHandlerRx();
    }
}
开发者ID:openwarelab,项目名称:firmware,代码行数:25,代码来源:Uart.cpp

示例2: HalUartISR

/*************************************************************************************************
 * @fn      UART Rx/Tx ISR
 *
 * @brief   Called when a serial byte is ready to read and/or write.
 * NOTE:   Assumes that uartRecord.configured is TRUE if this interrupt is enabled.
 *
 * @param   void
 *
 * @return  void
**************************************************************************************************/
void HalUartISR(void)
{
  UARTIntClear(HAL_UART_PORT, (UART_INT_RX |  UART_INT_RT));
  procRx();

  UARTIntClear(HAL_UART_PORT, (UART_INT_TX | UART_INT_CTS));
  procTx();
}
开发者ID:ndksys01,项目名称:FinalProject,代码行数:18,代码来源:hal_uart_isr.c

示例3: sio_isr

/*
 *  SIOの割込みサービスルーチン
 */
void
sio_isr(intptr_t exinf)
{
	SIOPCB          *p_siopcb;

	p_siopcb = get_siopcb(exinf);

	/*
	 *  割込みのクリア
	 */
	UARTIntClear(p_siopcb->p_siopinib->base,
				 UARTIntStatus(p_siopcb->p_siopinib->base, true));

	if (UARTCharsAvail(p_siopcb->p_siopinib->base)) {
		/*
		 *  受信通知コールバックルーチンを呼び出す.
		 */
		sio_irdy_rcv(p_siopcb->exinf);
	}
	if (UARTSpaceAvail(p_siopcb->p_siopinib->base)) {
		/*
		 *  送信可能コールバックルーチンを呼び出す.
		 */
		sio_irdy_snd(p_siopcb->exinf);
	}
}
开发者ID:huchunxu,项目名称:asp,代码行数:29,代码来源:target_serial.c

示例4: UART0_Handler

void UART0_Handler()
{
  c_pos_intEnter();

  uint32_t status;

  status = UARTIntStatus(PORTCFG_CON_USART, true);
  UARTIntClear(PORTCFG_CON_USART, status);

  if (status & UART_INT_TX)
    c_nos_putcharReady();

#if NOSCFG_FEATURE_CONIN == 1
  if (status & (UART_INT_RX | UART_INT_RT)) {

    unsigned char ch;

    while (UARTCharsAvail(PORTCFG_CON_USART)) {

      ch = UARTCharGetNonBlocking(PORTCFG_CON_USART);
      c_nos_keyinput(ch);
    }
  }
#endif


  c_pos_intExitQuick();
}
开发者ID:AriZuu,项目名称:picoos,代码行数:28,代码来源:con_usart.c

示例5: UARTIntHandler

void UARTIntHandler(void) {
	uint32_t ui32Status;
	ui32Status = UARTIntStatus(UART0_BASE, true); //get interrupt status
	UARTIntClear(UART0_BASE, ui32Status); //clear the asserted interrupts
	if(UARTCharGetNonBlocking(UART0_BASE) == 'S'){
		char m[] = "Enter The Temperature : ";
		char h[100] = "Set temperature Updated to ";
		int i;
		int l;
		l=0;
		for(i=0;m[i];i++){
					UARTCharPut(UART0_BASE, m[i]);
				}
		int x=0;
		while(1){
			char c;
			if(UARTCharsAvail(UART0_BASE)){
				c= UARTCharGetNonBlocking(UART0_BASE);
				UARTCharPut(UART0_BASE, c);
				if(c=='\r') break;
				h[27+l]=c;
				x=10*x+c-'0';
				l++;
			}
		}
		settemp = x;
		for(i=0;i<27+l;i++){
							UARTCharPut(UART0_BASE, h[i]);
						}
		UARTCharPut(UART0_BASE, '*');
		UARTCharPut(UART0_BASE, 'C');
		UARTCharPut(UART0_BASE, '\r');
		UARTCharPut(UART0_BASE,'\n');
	}
}
开发者ID:CS308-2016,项目名称:SmartLuggage,代码行数:35,代码来源:main.c

示例6: UART1_Handler

void UART1_Handler(void)
{
    unsigned long ulStatus;

    //
    // Get the interrrupt status.
    //
    ulStatus = UARTIntStatus(UART1_BASE, true);

    if(ulStatus & UART_INT_TX)
    {
        // TX Interrupt fired
        // with fifos disabled this fires when there is nothing in the tx buffer
    }
    else if(ulStatus & UART_INT_RX)
    {
        // RX Interrupt fired
        // with fifos disabled this fires when there is something in the rx buffer
        UARTRX_FLAG = true;
    }
    
    //
    // Clear the asserted interrupts.
    //
    UARTIntClear(UART1_BASE, ulStatus);

    
}
开发者ID:Jesse-Millwood,项目名称:EGR424-Lab5,代码行数:28,代码来源:lab5.c

示例7: uartIntHandler

// UART-interrupt for bluetooth communication
void uartIntHandler(void) {
	// Clear the interrupt
    UARTIntClear(UART5_BASE, UARTIntStatus(UART5_BASE, true));

    // Set the corresponding flag in vector
    int_vec |= UART_INT;
}
开发者ID:klek,项目名称:Lidar_mapping,代码行数:8,代码来源:sec_main.c

示例8: UART2_RxTxHandler

static void UART2_RxTxHandler(void)
{
	uint32_t IntStatus, byteCnt, timeout = 1000000;
	uint8_t c;
	IntStatus = UARTIntStatus(UART2_BASE, true);
	UARTIntClear(UART2_BASE, IntStatus);
	if(IntStatus & UART_INT_TX)
	{
		byteCnt = RINGBUF_GetFill(&long_Uart2_TxRingBuf);
		if (byteCnt)
		{
			RINGBUF_Get(&long_Uart2_TxRingBuf, &c);
			UARTCharPutNonBlocking(UART2_BASE, c);
			if (byteCnt == 1)
			{
				UARTIntDisable(UART2_BASE, UART_INT_TX);
			}
		}
		else
		{
			UARTIntDisable(UART2_BASE, UART_INT_TX);
		}
	}
	else if (IntStatus & (UART_INT_RX | UART_INT_RT))
	{
		while(!UARTCharsAvail(UART2_BASE) && (timeout--));
		c = UARTCharGet(UART2_BASE);
		RINGBUF_Put(&long_Uart0_RxRingBuf,c);
	}
	else
	{
		c = UARTCharGet(UART2_BASE);
	}
}
开发者ID:dragon28122007,项目名称:-UNI-VLC_Firmware_REV1.0,代码行数:34,代码来源:long_uart.c

示例9: charIntHandler

static void charIntHandler(char_device *dev)
{
    portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
    unsigned long ulStatus;
    unsigned char ucData;

    //
    // Get the interrrupt status.
    //
    ulStatus = UARTIntStatus(dev->PortBase, true);

    //
    // Clear the asserted interrupts.
    //
    UARTIntClear(dev->PortBase, ulStatus);

    if(ulStatus & UART_INT_RX){
        ucData =UARTCharGet(dev->PortBase);
        xQueueSendFromISR(dev->RxQueue, &ucData, &xHigherPriorityTaskWoken);
    }

    if(ulStatus & UART_INT_TX){
        if(xQueueReceiveFromISR(dev->TxQueue, &ucData, &xHigherPriorityTaskWoken))
            UARTCharPut(dev->PortBase, ucData);
    }
	portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
}
开发者ID:Duiesel,项目名称:thebirdfree-personal,代码行数:27,代码来源:chardevice.c

示例10: UARTIntHandler

void UARTIntHandler() {
	uint32_t ui32Status;
	uint32_t ui32ADC0Value[4]; 			// ADC FIFO
	volatile uint32_t ui32TempAvg; 		// Store average
	volatile uint32_t ui32TempValueC; 	// Temp in C
	volatile uint32_t ui32TempValueF; 	// Temp in F

	ui32Status = UARTIntStatus(UART0_BASE, true); //get interrupt status

	UARTIntClear(UART0_BASE, ui32Status); //clear the asserted interrupts

	ADCIntClear(ADC0_BASE, 2); 			// Clear ADC0 interrupt flag.
	ADCProcessorTrigger(ADC0_BASE, 2); 	// Trigger ADC conversion.

	while (!ADCIntStatus(ADC0_BASE, 2, false))
		; 	// wait for conversion to complete.

	ADCSequenceDataGet(ADC0_BASE, 2, ui32ADC0Value); 	// get converted data.
	// Average read values, and round.
	// Each Value in the array is the result of the mean of 64 samples.
	ui32TempAvg = (ui32ADC0Value[0] + ui32ADC0Value[1] + ui32ADC0Value[2]
			+ ui32ADC0Value[3] + 2) / 4;
	ui32TempValueC = (1475 - ((2475 * ui32TempAvg)) / 4096) / 10; // calc temp in C
	ui32TempValueF = ((ui32TempValueC * 9) + 160) / 5;

	//while(UARTCharsAvail(UART0_BASE)) //loop while there are chars
	//{
	//  UARTCharPutNonBlocking(UART0_BASE, UARTCharGetNonBlocking(UART0_BASE)); //echo character
	GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2); //blink LED
	SysCtlDelay(SysCtlClockGet() / (1000 * 3)); //delay ~1 msec
	GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0); //turn off LED
	//}
}
开发者ID:martinjaime,项目名称:MartinJaime_CpE403_labs,代码行数:33,代码来源:main.c

示例11: Uart2IntHandler

//UART Int Handler. Will handle the data recieved and put in an array. WILL NOT UNDERSTAND JUST STORE
void Uart2IntHandler(void){
	unsigned long ulStatus;

	ulStatus=UARTIntStatus(UART2_BASE, true);	//This reports if the interrupt was a transmit recieve etc, only reports one's setup to be detected in initalization could possibly remove transmit detection

	UARTIntClear(UART2_BASE, ulStatus);	//Clears the interrupt so it does not detect itself.

	if(ulStatus & UART_INT_TX){
		//Transmit was requested I don't think anything needs to be done here I could probably get rid of this and the interrupt for it but for now im leaving it. UARTSend does this job in a cleaner way
	}else if(ulStatus & UART_INT_RX || ulStatus & UART_INT_RT){	//If recieved data
		GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3,0x08);
		while(UARTCharsAvail(UART2_BASE)){	//While there is still data available to read
			char buffer = UARTCharGetNonBlocking(UART2_BASE);	//Read the data into a buffer for scanning
			if((buffer == 0xFA)&&(commandAddress == -2)){	//Is it the first dummy byte
				commandAddress=-1;	//Set the command Address to -1 this way the dummy byte is the only starting byte for a packet to be accepeted
			}else if((buffer == 0xEB)&&(commandAddress == -1)){	//Is the second dummy byte read
				commandAddress=0;	//Prepare to read data the dummy byte's have been validated
			}else if(commandAddress>=0){						//Read in because it's not a dummy byte, prep for reading
				recievedCommands[commandAddress]=buffer;
				commandAddress++;	//Some efficiency could be done here. Remove this line than change the bottom to have ++commandAddress. But that's nitpicky stuff
				commandAddress = (commandAddress>4) ? -2 : commandAddress;			//If greater than 6 set to -1 else set to self
			}
		}
		//UARTCount = ((UARTCount+1)%65534); //Again not sure of datatype sizes so go with what works right.
	}

}
开发者ID:arduic,项目名称:GitHub,代码行数:28,代码来源:main.c

示例12: halSwitchToBootloader

/**
 * Turn off interrupt sources that may interrupt us (SysTick and Ethernet) and then switch control
 * to the Boot Loader. This will never return!
 */
void halSwitchToBootloader()
{
    while(UARTCharsAvail(UART0_BASE))
    {
        UARTCharGet(UART0_BASE);
    }

    EthernetIntDisable(ETH_BASE, 0xFFFF);
    SysTickIntDisable();
    IntDisable(INT_UART0);
    UARTIntDisable(UART0_BASE, UART_INT_RX | UART_INT_RT);
    UARTIntClear(UART0_BASE, UART_INT_RX | UART_INT_RT);


    delayMs(100);
    // Call the boot loader so that it will listen for an update on the UART.
    (*((void (*)(void))(*(unsigned long *)0x2c)))();

    //
    // The boot loader should take control, so this should never be reached.
    // Just in case, loop forever.
    //
    while(1)
    {
    }

}
开发者ID:vtoanb,项目名称:msp430lioamaintain,代码行数:31,代码来源:hal_gw1.c

示例13: uartb_intHandler

void uartb_intHandler(){
    int tmp=0;

    // detect the event that triggered the interrupt
    unsigned long intStatus=UARTIntStatus(UART_BUFFERIZED_BASE,1);
    // Clear the interrupt (done early because rtfm)
    UARTIntClear(UART_BUFFERIZED_BASE,intStatus);

    // if it is on RX fifo limit or RX timeout, put these bits in circular buffer
    if (intStatus==UART_INT_RT || intStatus==UART_INT_RX){
        UARTIntDisable(UART_BUFFERIZED_BASE,(UART_INT_RT | UART_INT_RX));
        while (UARTCharsAvail(UART_BUFFERIZED_BASE)){
            // RDA interrupt
            tmp = (rxbuf.head+1)%UART_BUFFERIZED_CBUFF_SIZE;

            if(tmp != rxbuf.tail){
                rxbuf.cbuf[rxbuf.head] = UARTCharGetNonBlocking(UART_BUFFERIZED_BASE);
                rxbuf.head = tmp;
            }
        }
        UARTIntEnable(UART_BUFFERIZED_BASE,(UART_INT_RT | UART_INT_RX));
    }
    // xxx if it is on TX fifo limit, what should we do ? loop until fifo is free again ? useless if blocking writes are used.

    // otherwise, discard whitout doing anything (done at the beginning of the function, see doc for "why ?".
}
开发者ID:ENAC-Robotique,项目名称:Robots,代码行数:26,代码来源:UART_bufferized.c

示例14: UART0IntHandler

//*****************************************************************************
//
// The UART interrupt handler.
//
//*****************************************************************************
void UART0IntHandler(void)
{
    unsigned long ulStatus;

    //
    // Get the interrrupt status.
    //
    ulStatus = UARTIntStatus(UART0_BASE, true);

    //
    // Clear the asserted interrupts.
    //
    UARTIntClear(UART0_BASE, ulStatus);

    //
    // Loop while there are characters in the receive FIFO.
    //
    while(UARTCharsAvail(UART0_BASE))
    {
        //
        // Read the next character from the UART and write it back to the UART.
        //
        UARTCharPutNonBlocking(UART0_BASE, UARTCharGetNonBlocking(UART0_BASE));
    }
}
开发者ID:mybays,项目名称:lm3s,代码行数:30,代码来源:main.c

示例15: UARTIntHandler

void UARTIntHandler(void)
{
	//	UARTCharPut(UART0_BASE, 'a');
	uint32_t ui32Status;
	ui32Status = UARTIntStatus(UART3_BASE, true); //get interrupt status
	//	UARTCharPut(UART0_BASE, 'a');
	UARTIntClear(UART3_BASE, ui32Status); //clear the asserted interrupts

	//	UARTCharPut(UART0_BASE, 'a');
	while(UARTCharsAvail(UART3_BASE)) //loop while there are chars
	{
		//		UARTCharPut(UART0_BASE, 'a');
		char x = UARTCharGetNonBlocking(UART3_BASE);
		UARTCharPut(UART0_BASE, x);
		buf[it++] = x;
	}
	buf[it]='\0';
	char *ptr = strstr(buf,"OK\r\n");
	if(ptr != NULL) {
		SIM908_status = true;
	}
	//	UARTCharPutNonBlocking(UART0_BASE, 'a');
	//  buf[it]='\0';
	//
	//  if(strncmp(buf, "OK", 2) == 0) SIM908_status = true;
	//  else if(strncmp(buf,  "ERROR", 5) == 0) {
	//
	//  }
	//  else {
	//
	//  }
}
开发者ID:CS308-2016,项目名称:Accident_Autodialer,代码行数:32,代码来源:micro_c.c


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