mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
Merge pull request #15518 from aabadie/pr/cpu/cc2538_uart_irq
cpu/cc2538: enable UART IRQ only if cb is not NULL
This commit is contained in:
commit
c337089de5
@ -145,15 +145,13 @@ int uart_init(uart_t uart, uint32_t baudrate, uart_rx_cb_t rx_cb, void *arg)
|
|||||||
/* Configure line control for 8-bit, no parity, 1 stop bit and enable */
|
/* Configure line control for 8-bit, no parity, 1 stop bit and enable */
|
||||||
u->cc2538_uart_lcrh.LCRH = (WLEN_8_BITS << 5) | FEN;
|
u->cc2538_uart_lcrh.LCRH = (WLEN_8_BITS << 5) | FEN;
|
||||||
|
|
||||||
/* register callbacks */
|
/* register callbacks and enable UART irq */
|
||||||
if (rx_cb) {
|
if (rx_cb) {
|
||||||
uart_ctx[uart].rx_cb = rx_cb;
|
uart_ctx[uart].rx_cb = rx_cb;
|
||||||
uart_ctx[uart].arg = arg;
|
uart_ctx[uart].arg = arg;
|
||||||
|
NVIC_EnableIRQ(UART_IRQ(uart_num));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* enable UART interrupt */
|
|
||||||
NVIC_EnableIRQ(UART_IRQ(uart_num));
|
|
||||||
|
|
||||||
/* UART Enable */
|
/* UART Enable */
|
||||||
u->cc2538_uart_ctl.CTLbits.UARTEN = 1;
|
u->cc2538_uart_ctl.CTLbits.UARTEN = 1;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user