Skip to content

Commit 96b6cd3

Browse files
author
Filip Jagodzinski
committed
KW41Z: Fix serial IRQ handling
Check that the RX or TX interrupt is enabled before calling a registered handler with RxIrq or TxIrq arg.
1 parent 01e130b commit 96b6cd3

File tree

1 file changed

+2
-2
lines changed
  • targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KW41Z

1 file changed

+2
-2
lines changed

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KW41Z/serial_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ static inline void uart_irq(uint32_t transmit_empty, uint32_t receive_full, uint
131131
}
132132

133133
if (serial_irq_ids[index] != 0) {
134-
if (transmit_empty)
134+
if (transmit_empty && (LPUART_GetEnabledInterrupts(uart_addrs[index]) & kLPUART_TxDataRegEmptyInterruptEnable))
135135
irq_handler(serial_irq_ids[index], TxIrq);
136136

137-
if (receive_full)
137+
if (receive_full && (LPUART_GetEnabledInterrupts(uart_addrs[index]) & kLPUART_RxDataRegFullInterruptEnable))
138138
irq_handler(serial_irq_ids[index], RxIrq);
139139
}
140140
}

0 commit comments

Comments
 (0)