Пример #1
0
Файл: Uart.c Проект: sdajani/sdp
/****************************************************************************
 Function
    IntUart1Handler

 Parameters
    None.

 Returns
    None.

 Description
    Interrupt Handle for the uart. with the PIC32 architecture both send and receive are handled within the same interrupt

 Notes


 Author
 Max Dunne, 2011.11.10
 ****************************************************************************/
void __ISR(_UART2_VECTOR, ipl4) IntUart2Handler(void)
{
    if (mU2RXGetIntFlag()) {
        mU2RXClearIntFlag();
        writeBack(receiveBufferUart2, (unsigned char) U2RXREG);
    }
    if (mU2TXGetIntFlag()) {
        mU2TXClearIntFlag();
        if (!(getLength(transmitBufferUart2) == 0)) {
            U2TXREG = readFront(transmitBufferUart2);
        }
    }
}
Пример #2
0
Файл: gps.c Проект: mdunne/ANIMA
/****************************************************************************
 Function
    IntUart1Handler

 Parameters
    None.

 Returns
    None.

 Description
    Interrupt Handle for the uart. with the PIC32 architecture both send and receive are handled within the same interrupt

 Notes


 Author
 Max Dunne, 2011.11.10
 ****************************************************************************/
void __ISR(_UART2_VECTOR, ipl4) IntUart2Handler(void) {
    if (mU2RXGetIntFlag()) {
        mU2RXClearIntFlag();
        GPSwriteBack(GreceiveBuffer, (unsigned char) U2RXREG);
        gpsControlData.newDatatoParse = 1;
        //PutChar(U2RXREG);

    }
    if (mU2TXGetIntFlag()) {
        mU2TXClearIntFlag();
        if (!(GPSgetLength(GtransmitBuffer) == 0)) {
            U2TXREG = GPSreadFront(GtransmitBuffer);
        }
    }

}
Пример #3
0
void __ISR(_UART1_VECTOR, ipl2) IntUart1Handler(void)
{
    // Is this an RX interrupt?
    if (mU2RXGetIntFlag())
    {
        // Clear the RX interrupt Flag
        mU2RXClearIntFlag();

        char change = (char) ReadUART1();

        if (change == ']')
        {
            width++;
            if (width > 32)
            {
                width = width - 32;
            }
        }

        if (change == '[')
        {
            width--;
            if (width < 1)
            {
                width = width + 32;
            }
        }

        // Echo what we just received.
        sprintf(RS232_Out_Buffer, "Width: %d \r\n", width);
        putsUART1(RS232_Out_Buffer);

        //reset chip to new width
        nrf24l01_initialize_debug(true, width, false);
    }

    // We don't care about TX interrupt
    if (mU2TXGetIntFlag())
    {
        mU2TXClearIntFlag();
    }
}
Пример #4
0
//*******************************************************************************************
// UART 2 interrupt handler
// it is set at priority level 2
//*******************************************************************************************
void __ISR(_UART2_VECTOR, ipl2) IntUart2Handler(void)
{
unsigned char theChar;


	// Is this an RX interrupt?
	if (mU2RXGetIntFlag())
	{
	//	theChar	=	ReadUART2();
		theChar	=	U2RXREG;
		store_char(theChar, &rx_buffer2);

		// Clear the RX interrupt Flag (must be AFTER the read)
	    mU2RXClearIntFlag();
	}

	// We don't care about TX interrupt
	if ( mU2TXGetIntFlag() )
	{
		mU2TXClearIntFlag();
	}
}