/******************************************************************************* * Function Name: UART_1_SpiUartDisableIntRx ****************************************************************************//** * * Disables the RX interrupt sources. * * \return * Returns the RX interrupt sources enabled before the function call. * *******************************************************************************/ uint32 UART_1_SpiUartDisableIntRx(void) { uint32 intSource; intSource = UART_1_GetRxInterruptMode(); UART_1_SetRxInterruptMode(UART_1_NO_INTR_SOURCES); return (intSource); }
void main(){ UART_1_Start(); /* choose when we receive interrupts from tx and rx */ UART_1_SetTxInterruptMode(UART_1_TX_STS_COMPLETE); UART_1_SetRxInterruptMode(UART_1_RX_STS_FIFO_NOTEMPTY); CyGlobalIntEnable; UART_1_ClearTxBuffer(); UART_1_ClearRxBuffer(); LCD_Char_1_Start(); LCD_Char_1_Position(0,0); /* initialize our source data to index */ int j; for(j = 0; j < DATA_SIZE; ++j){ sourceData[j] = j; } /* enable our interrupt routines */ isr_1_StartEx(tx_int); isr_2_StartEx(rx_int); /* idle loop until we finish our transmission */ while(!rx_done){} int k; int errors = 0; /* data validation */ for(k = 0; k < DATA_SIZE; ++k) if(sourceData[k] != receiveData[k]) ++errors; /* print errors to lcd */ LCD_Char_1_PrintString("errors: "); LCD_Char_1_PrintNumber(errors); LCD_Char_1_Position(1,0); LCD_Char_1_PrintString("tx:"); LCD_Char_1_PrintNumber(tx_cnt); LCD_Char_1_PrintString(" rx:"); LCD_Char_1_PrintNumber(rx_cnt); for(;;){ } }