Skip to content

Commit a3fd435

Browse files
committed
esp32/uart: Use high-level function to install UART0 RX ISR handler.
Using xt_set_interrupt_handler is too low-level for the ESP IDF, since it may have multiple handlers registered at the same IRQ level (eg both BT and UART are on number 5).
1 parent 0063976 commit a3fd435

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

esp32/uart.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@
2828

2929
#include <stdio.h>
3030

31-
#include "esp_intr.h"
32-
#include "soc/uart_struct.h"
31+
#include "driver/uart.h"
3332

3433
#include "py/mpstate.h"
3534
#include "py/mphal.h"
3635

3736
STATIC void uart_irq_handler(void *arg);
3837

3938
void uart_init(void) {
40-
xt_set_interrupt_handler(ETS_UART0_INUM, uart_irq_handler, NULL);
41-
ESP_INTR_ENABLE(ETS_UART0_INUM);
39+
uart_isr_handle_t handle;
40+
uart_isr_register(UART_NUM_0, uart_irq_handler, NULL, ESP_INTR_FLAG_LOWMED | ESP_INTR_FLAG_IRAM, &handle);
41+
uart_enable_rx_intr(UART_NUM_0);
4242
}
4343

4444
// all code executed in ISR must be in IRAM, and any const data must be in DRAM

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy