Browse Source

Fix Serial ISR priority for LPC1768

Co-Authored-By: p3p <p3p@p3psoft.co.uk>
pull/1/head
Scott Lahteine 6 years ago
parent
commit
d86f25ab63
  1. 21
      Marlin/src/HAL/HAL_LPC1768/HardwareSerial.cpp

21
Marlin/src/HAL/HAL_LPC1768/HardwareSerial.cpp

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

Loading…
Cancel
Save