Skip to content

Commit c93a346

Browse files
committed
cpu/esp32/esp-idf-api: migration to ESP-IDF v5.4
1 parent 0c028c1 commit c93a346

File tree

4 files changed

+19
-23
lines changed

4 files changed

+19
-23
lines changed

cpu/esp32/esp-idf-api/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ MODULE = esp_idf_api
22

33
# ESP-IDF header files must be found first in this module. Therefore,
44
# the ESP-IDF include paths must come before the RIOT include paths.
5-
PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/driver/include
65
PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/esp_common/include
6+
PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/esp_driver_gpio/include
7+
PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/esp_driver_uart/include
78
PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/esp_hw_support/include
89
PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/esp_rom/include
910
PRE_INCLUDES += -I$(ESP32_SDK_DIR)/components/hal/include

cpu/esp32/esp-idf-api/uart.c

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,23 @@
2020
#include <stdbool.h>
2121
#include <stdint.h>
2222

23-
#include "driver/uart.h"
24-
#include "hal/uart_hal.h"
23+
#include "esp_private/uart_share_hw_ctrl.h"
24+
#include "esp_rom_uart.h"
25+
#include "hal/uart_ll.h"
2526

2627
#include "esp_idf_api/uart.h"
2728

28-
static uart_hal_context_t _uart_hal_ctx[] = {
29-
#if UART_NUM_MAX >= 1
30-
{
31-
.dev = UART_LL_GET_HW(0),
32-
},
33-
#endif
34-
#if UART_NUM_MAX >= 2
35-
{
36-
.dev = UART_LL_GET_HW(1),
37-
},
38-
#endif
39-
#if UART_NUM_MAX >= 3
40-
{
41-
.dev = UART_LL_GET_HW(2),
42-
},
43-
#endif
44-
};
45-
4629
void esp_idf_uart_set_wakeup_threshold(unsigned uart_num, uint32_t threshold)
4730
{
48-
assert(uart_num < ARRAY_SIZE(_uart_hal_ctx));
49-
uart_hal_set_wakeup_thrd(&_uart_hal_ctx[uart_num], threshold);
31+
assert(uart_num < SOC_UART_NUM);
32+
33+
HP_UART_PAD_CLK_ATOMIC() {
34+
uart_ll_set_wakeup_thrd(UART_LL_GET_HW(uart_num), threshold);
35+
uart_ll_enable_pad_sleep_clock(UART_LL_GET_HW(uart_num), true);
36+
}
37+
}
38+
39+
void esp_idf_esp_rom_output_tx_wait_idle(unsigned uart_num)
40+
{
41+
esp_rom_output_tx_wait_idle(uart_num);
5042
}

cpu/esp32/include/esp_idf_api/gpio.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#include "esp_err.h"
2323
#include "hal/gpio_types.h"
24+
#include "driver/gpio.h"
2425

2526
#ifndef DOXYGEN /* Hide implementation details from doxygen */
2627

cpu/esp32/include/esp_idf_api/uart.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ extern "C" {
2727

2828
void esp_idf_uart_set_wakeup_threshold(unsigned uart_num, uint32_t threshold);
2929

30+
void esp_idf_esp_rom_output_tx_wait_idle(unsigned uart_num);
31+
3032
#ifdef __cplusplus
3133
}
3234
#endif

0 commit comments

Comments
 (0)