Fix Serial ISR priority for LPC1768

Co-Authored-By: p3p <p3p@p3psoft.co.uk>
This commit is contained in:
Scott Lahteine 2018-06-25 12:14:59 -04:00
parent fb4e0b105b
commit d86f25ab63

View file

@ -109,10 +109,23 @@ void HardwareSerial::begin(uint32_t baudrate) {
UART_IntConfig(UARTx, UART_INTCFG_RBR, ENABLE); UART_IntConfig(UARTx, UART_INTCFG_RBR, ENABLE);
UART_IntConfig(UARTx, UART_INTCFG_RLS, ENABLE); UART_IntConfig(UARTx, UART_INTCFG_RLS, ENABLE);
if (UARTx == LPC_UART0) NVIC_EnableIRQ(UART0_IRQn); // Set proper priority and enable interrupts
else if ((LPC_UART1_TypeDef *) UARTx == LPC_UART1) NVIC_EnableIRQ(UART1_IRQn); if (UARTx == LPC_UART0) {
else if (UARTx == LPC_UART2) NVIC_EnableIRQ(UART2_IRQn); NVIC_SetPriority(UART0_IRQn, NVIC_EncodePriority(0, 3, 0));
else if (UARTx == LPC_UART3) NVIC_EnableIRQ(UART3_IRQn); NVIC_EnableIRQ(UART0_IRQn);
}
else if ((LPC_UART1_TypeDef *) UARTx == LPC_UART1) {
NVIC_SetPriority(UART1_IRQn, NVIC_EncodePriority(0, 3, 0));
NVIC_EnableIRQ(UART1_IRQn);
}
else if (UARTx == LPC_UART2) {
NVIC_SetPriority(UART2_IRQn, NVIC_EncodePriority(0, 3, 0));
NVIC_EnableIRQ(UART2_IRQn);
}
else if (UARTx == LPC_UART3) {
NVIC_SetPriority(UART3_IRQn, NVIC_EncodePriority(0, 3, 0));
NVIC_EnableIRQ(UART3_IRQn);
}
RxQueueWritePos = RxQueueReadPos = 0; RxQueueWritePos = RxQueueReadPos = 0;
#if TX_BUFFER_SIZE > 0 #if TX_BUFFER_SIZE > 0