refactor(uart): make uart driver as component, and fix astyle

pull/12852/head
Song Ruo Jing 2023-11-22 17:27:43 +08:00
rodzic 62a0b52a91
commit 6ad80f0332
44 zmienionych plików z 98 dodań i 107 usunięć

Wyświetl plik

@ -63,8 +63,7 @@ endif()
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "${include_dirs}"
PRIV_INCLUDE_DIRS "${priv_include_dirs}"
PRIV_REQUIRES soc esp_driver_gptimer esp_driver_gpio
driver # TODO: replace with esp_driver_uart (IDF-8384)
PRIV_REQUIRES esp_driver_gptimer esp_driver_gpio esp_driver_uart
REQUIRES esp_timer
LDFRAGMENTS linker.lf)

Wyświetl plik

@ -785,7 +785,7 @@ idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "${include_dirs}"
PRIV_INCLUDE_DIRS "${priv_include_dirs}"
REQUIRES esp_timer esp_wifi
PRIV_REQUIRES nvs_flash soc esp_pm esp_phy esp_coex mbedtls driver vfs
PRIV_REQUIRES nvs_flash soc esp_pm esp_phy esp_coex mbedtls esp_driver_uart vfs esp_ringbuf
LDFRAGMENTS "${ldfragments}")
if(CONFIG_BT_ENABLED)

Wyświetl plik

@ -28,4 +28,6 @@ idf_component_register(SRCS "commands.c"
${argtable_srcs}
INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}
REQUIRES vfs
PRIV_REQUIRES driver)
PRIV_REQUIRES esp_driver_uart
driver # to be replaced by esp_driver_usj
)

Wyświetl plik

@ -14,7 +14,6 @@ set(includes "deprecated"
"parlio/include"
"touch_sensor/include"
"twai/include"
"uart/include"
"usb_serial_jtag/include")
# Always included linker fragments
@ -101,13 +100,6 @@ if(CONFIG_SOC_TWAI_SUPPORTED)
list(APPEND ldfragments "twai/linker.lf")
endif()
# UART related source files
if(CONFIG_SOC_UART_SUPPORTED)
list(APPEND srcs "uart/uart.c")
list(APPEND ldfragments "uart/linker.lf")
endif()
# USB Serial JTAG related source files
if(CONFIG_SOC_USB_SERIAL_JTAG_SUPPORTED)
list(APPEND srcs "usb_serial_jtag/usb_serial_jtag.c"
@ -135,6 +127,7 @@ else()
esp_driver_gpio esp_driver_pcnt esp_driver_gptimer esp_driver_spi esp_driver_mcpwm
esp_driver_ana_cmpr esp_driver_i2s esp_driver_sdmmc esp_driver_sdspi esp_driver_sdio
esp_driver_dac esp_driver_rmt esp_driver_tsens esp_driver_sdm esp_driver_i2c
esp_driver_uart
LDFRAGMENTS ${ldfragments}
)
endif()

Wyświetl plik

@ -64,8 +64,6 @@ menu "Driver Configurations"
orsource "./twai/Kconfig.twai"
orsource "./uart/Kconfig.uart"
menu "USB Serial/JTAG Configuration"
depends on SOC_USB_SERIAL_JTAG_SUPPORTED
config USJ_NO_AUTO_LS_ON_CONNECTION

Wyświetl plik

@ -78,14 +78,6 @@ components/driver/test_apps/parlio:
temporary: true
reason: lack of runner
components/driver/test_apps/rs485:
disable:
- if: SOC_UART_SUPPORTED != 1
disable_test:
- if: IDF_TARGET != "esp32"
temporary: true
reason: lack of runners
components/driver/test_apps/touch_sensor_v1:
disable:
- if: SOC_TOUCH_SENSOR_VERSION != 1
@ -98,10 +90,6 @@ components/driver/test_apps/twai:
disable:
- if: SOC_TWAI_SUPPORTED != 1
components/driver/test_apps/uart:
disable:
- if: SOC_UART_SUPPORTED != 1
components/driver/test_apps/usb_serial_jtag:
disable:
- if: SOC_USB_SERIAL_JTAG_SUPPORTED != 1

Wyświetl plik

@ -8,3 +8,5 @@ components/esp_driver_gpio/test_apps/gpio_extensions:
enable:
- if: SOC_DEDICATED_GPIO_SUPPORTED == 1
- if: SOC_GPIO_SUPPORT_PIN_GLITCH_FILTER == 1 or SOC_GPIO_FLEX_GLITCH_FILTER_NUM > 0
depends_components:
- esp_driver_gpio

Wyświetl plik

@ -11,6 +11,6 @@ endif()
idf_component_register(SRCS ${srcs}
INCLUDE_DIRS ${public_include}
PRIV_REQUIRES "esp_pm"
REQUIRES "esp_pm"
LDFRAGMENTS "linker.lf"
)

Wyświetl plik

@ -0,0 +1,11 @@
set(srcs)
set(public_include "include")
if(CONFIG_SOC_UART_SUPPORTED)
list(APPEND srcs "src/uart.c")
endif()
idf_component_register(SRCS ${srcs}
INCLUDE_DIRS ${public_include}
PRIV_REQUIRES esp_pm esp_driver_gpio esp_ringbuf
LDFRAGMENTS "linker.lf"
)

Wyświetl plik

@ -1,4 +1,4 @@
menu "UART Configuration"
menu "ESP-Driver:UART Configurations"
config UART_ISR_IN_IRAM
bool "Place UART ISR function into IRAM"
@ -9,4 +9,4 @@ menu "UART Configuration"
If this option is not selected, UART interrupt will be disabled for a long time and
may cause data lost when doing spi flash operation.
endmenu # UART Configuration
endmenu

Wyświetl plik

@ -14,10 +14,7 @@ extern "C" {
#include "esp_intr_alloc.h"
#include "soc/soc_caps.h"
#include "freertos/FreeRTOS.h"
#include "freertos/semphr.h"
#include "freertos/task.h"
#include "freertos/queue.h"
#include "freertos/ringbuf.h"
#include "hal/uart_types.h"
/* @brief When calling `uart_set_pin`, instead of GPIO number, `UART_PIN_NO_CHANGE`
@ -86,7 +83,7 @@ typedef struct {
uart_event_type_t type; /*!< UART event type */
size_t size; /*!< UART data size for UART_DATA event*/
bool timeout_flag; /*!< UART data read timeout flag for UART_DATA event (no new data received during configured RX TOUT)*/
/*!< If the event is caused by FIFO-full interrupt, then there will be no event with the timeout flag before the next byte coming.*/
/*!< If the event is caused by FIFO-full interrupt, then there will be no event with the timeout flag before the next byte coming.*/
} uart_event_t;
typedef intr_handle_t uart_isr_handle_t;
@ -285,7 +282,7 @@ esp_err_t uart_set_hw_flow_ctrl(uart_port_t uart_num, uart_hw_flowcontrol_t flow
* - ESP_OK Success
* - ESP_FAIL Parameter error
*/
esp_err_t uart_set_sw_flow_ctrl(uart_port_t uart_num, bool enable, uint8_t rx_thresh_xon, uint8_t rx_thresh_xoff);
esp_err_t uart_set_sw_flow_ctrl(uart_port_t uart_num, bool enable, uint8_t rx_thresh_xon, uint8_t rx_thresh_xoff);
/**
* @brief Get the UART hardware flow control configuration.

Wyświetl plik

@ -20,7 +20,6 @@
#include "esp_private/critical_section.h"
#include "hal/uart_hal.h"
#include "hal/gpio_hal.h"
#include "hal/clk_tree_ll.h"
#include "soc/uart_periph.h"
#include "driver/uart.h"
#include "driver/gpio.h"
@ -28,7 +27,6 @@
#include "driver/uart_select.h"
#include "driver/lp_io.h"
#include "esp_private/uart_share_hw_ctrl.h"
#include "esp_private/periph_ctrl.h"
#include "esp_clk_tree.h"
#include "sdkconfig.h"
#include "esp_rom_gpio.h"
@ -620,7 +618,7 @@ static bool uart_try_set_iomux_pin(uart_port_t uart_num, int io_num, uint32_t id
}
/* Assign the correct funct to the GPIO. */
assert (upin->iomux_func != -1);
assert(upin->iomux_func != -1);
if (uart_num < SOC_UART_HP_NUM) {
gpio_iomux_out(io_num, upin->iomux_func, false);
@ -1073,7 +1071,7 @@ static void UART_ISR_ATTR uart_rx_intr_handler_default(void *param)
p_uart->rx_buffered_len + pat_idx);
}
UART_EXIT_CRITICAL_ISR(&(uart_context[uart_num].spinlock));
sent = xQueueSendFromISR(p_uart->event_queue, (void * )&uart_event, &HPTaskAwoken);
sent = xQueueSendFromISR(p_uart->event_queue, (void *)&uart_event, &HPTaskAwoken);
need_yield |= (HPTaskAwoken == pdTRUE);
if ((p_uart->event_queue != NULL) && (sent == pdFALSE)) {
#ifndef CONFIG_UART_ISR_IN_IRAM //Only log if ISR is not in IRAM
@ -1198,19 +1196,19 @@ static void UART_ISR_ATTR uart_rx_intr_handler_default(void *param)
need_yield |= (HPTaskAwoken == pdTRUE);
}
}
#if SOC_UART_SUPPORT_WAKEUP_INT
#if SOC_UART_SUPPORT_WAKEUP_INT
else if (uart_intr_status & UART_INTR_WAKEUP) {
uart_hal_clr_intsts_mask(&(uart_context[uart_num].hal), UART_INTR_WAKEUP);
uart_event.type = UART_WAKEUP;
}
#endif
#endif
else {
uart_hal_clr_intsts_mask(&(uart_context[uart_num].hal), uart_intr_status); /*simply clear all other intr status*/
uart_event.type = UART_EVENT_MAX;
}
if (uart_event.type != UART_EVENT_MAX && p_uart->event_queue) {
sent = xQueueSendFromISR(p_uart->event_queue, (void * )&uart_event, &HPTaskAwoken);
sent = xQueueSendFromISR(p_uart->event_queue, (void *)&uart_event, &HPTaskAwoken);
need_yield |= (HPTaskAwoken == pdTRUE);
if (sent == pdFALSE) {
#ifndef CONFIG_UART_ISR_IN_IRAM //Only log if ISR is not in IRAM
@ -1323,7 +1321,7 @@ static int uart_tx_all(uart_port_t uart_num, const char *src, size_t size, bool
xRingbufferSend(p_uart_obj[uart_num]->tx_ring_buf, (void *) &evt, sizeof(uart_tx_data_t), portMAX_DELAY);
while (size > 0) {
size_t send_size = size > max_size / 2 ? max_size / 2 : size;
xRingbufferSend(p_uart_obj[uart_num]->tx_ring_buf, (void *) (src + offset), send_size, portMAX_DELAY);
xRingbufferSend(p_uart_obj[uart_num]->tx_ring_buf, (void *)(src + offset), send_size, portMAX_DELAY);
size -= send_size;
offset += send_size;
uart_enable_tx_intr(uart_num, 1, UART_THRESHOLD_NUM(uart_num, UART_EMPTY_THRESH_DEFAULT));
@ -1644,8 +1642,8 @@ esp_err_t uart_driver_install(uart_port_t uart_num, int rx_buffer_size, int tx_b
uart_hal_clr_intsts_mask(&(uart_context[uart_num].hal), UART_LL_INTR_MASK);
ret = esp_intr_alloc(uart_periph_signal[uart_num].irq, intr_alloc_flags,
uart_rx_intr_handler_default, p_uart_obj[uart_num],
&p_uart_obj[uart_num]->intr_handle);
uart_rx_intr_handler_default, p_uart_obj[uart_num],
&p_uart_obj[uart_num]->intr_handle);
ESP_GOTO_ON_ERROR(ret, err, UART_TAG, "Could not allocate an interrupt for UART");
ret = uart_intr_config(uart_num, &uart_intr);

Wyświetl plik

@ -0,0 +1,19 @@
# Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps
components/esp_driver_uart/test_apps/rs485:
disable:
- if: SOC_UART_SUPPORTED != 1
disable_test:
- if: IDF_TARGET != "esp32"
temporary: true
reason: lack of runners
depends_components:
- esp_driver_uart
- esp_driver_gpio
components/esp_driver_uart/test_apps/uart:
disable:
- if: SOC_UART_SUPPORTED != 1
depends_components:
- esp_driver_uart
- esp_driver_gpio

Wyświetl plik

@ -2,6 +2,6 @@
# the component can be registered as WHOLE_ARCHIVE
idf_component_register(
SRCS "test_app_main.c" "test_rs485.c"
REQUIRES driver unity test_utils
REQUIRES esp_driver_uart unity test_utils
WHOLE_ARCHIVE
)

Wyświetl plik

@ -5,30 +5,21 @@
*/
#include "unity.h"
#include "unity_test_runner.h"
#include "unity_test_utils.h"
#include "esp_heap_caps.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#define TEST_MEMORY_LEAK_THRESHOLD (200)
static size_t before_free_8bit;
static size_t before_free_32bit;
void setUp(void)
{
before_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT);
before_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT);
unity_utils_record_free_mem();
}
void tearDown(void)
{
size_t after_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT);
size_t after_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT);
printf("\n");
unity_utils_check_leak(before_free_8bit, after_free_8bit, "8BIT", TEST_MEMORY_LEAK_THRESHOLD);
unity_utils_check_leak(before_free_32bit, after_free_32bit, "32BIT", TEST_MEMORY_LEAK_THRESHOLD);
esp_reent_cleanup(); //clean up some of the newlib's lazy allocations
unity_utils_evaluate_leaks_direct(TEST_MEMORY_LEAK_THRESHOLD);
}
void app_main(void)

Wyświetl plik

@ -111,20 +111,18 @@ static const uint8_t crc_low[] = {
0x40
};
// Calculate buffer checksum using tables
// The checksum CRC16 algorithm is specific
// for Modbus standard and uses polynomial value = 0xA001
static uint16_t get_buffer_crc16( uint8_t * frame_ptr, uint16_t length )
static uint16_t get_buffer_crc16(uint8_t * frame_ptr, uint16_t length)
{
TEST_ASSERT( frame_ptr != NULL);
TEST_ASSERT(frame_ptr != NULL);
uint8_t crc_hi_byte = 0xFF;
uint8_t crc_low_byte = 0xFF;
int index;
while ( length-- )
{
while (length--) {
index = crc_low_byte ^ *(frame_ptr++);
crc_low_byte = crc_hi_byte ^ crc_hi[index];
crc_hi_byte = crc_low[index];
@ -135,7 +133,7 @@ static uint16_t get_buffer_crc16( uint8_t * frame_ptr, uint16_t length )
// Fill the buffer with random numbers and apply CRC16 at the end
static uint16_t buffer_fill_random(uint8_t *buffer, size_t length)
{
TEST_ASSERT( buffer != NULL);
TEST_ASSERT(buffer != NULL);
// Packet is too short
if (length < 4) {
return 0;
@ -177,8 +175,8 @@ static void rs485_init(void)
static esp_err_t print_packet_data(const char *str, uint8_t *buffer, uint16_t buffer_size)
{
TEST_ASSERT( buffer != NULL);
TEST_ASSERT( str != NULL);
TEST_ASSERT(buffer != NULL);
TEST_ASSERT(str != NULL);
// Calculate the checksum of the buffer
uint16_t crc16_calc = get_buffer_crc16(buffer, (buffer_size - 2));
@ -187,7 +185,7 @@ static esp_err_t print_packet_data(const char *str, uint8_t *buffer, uint16_t bu
// Print an array of data
printf("%s%s RS485 packet = [ ", str, state_str);
for (int i = 0; i < buffer_size; i++) {
printf("0x%.2X ", (uint8_t)buffer[i]);
printf("0x%.2X ", (uint8_t)buffer[i]);
}
printf(" ]\r\n");
printf("crc_in = 0x%.4X\r\n", (uint16_t)crc16_in);
@ -205,7 +203,7 @@ static void rs485_slave(void)
unity_send_signal("Slave_ready");
unity_wait_for_signal("Master_started");
ESP_LOGI(TAG, "Start recieve loop.");
for(int pack_count = 0; pack_count < PACKETS_NUMBER; pack_count++) {
for (int pack_count = 0; pack_count < PACKETS_NUMBER; pack_count++) {
//Read slave_data from UART
int len = uart_read_bytes(UART_NUM1, slave_data, BUF_SIZE, PACKET_READ_TICS);
//Write slave_data back to UART
@ -247,7 +245,7 @@ static void rs485_master(void)
unity_wait_for_signal("Slave_ready");
unity_send_signal("Master_started");
ESP_LOGI(TAG, "Start recieve loop.");
for(int i = 0; i < PACKETS_NUMBER; i++) {
for (int i = 0; i < PACKETS_NUMBER; i++) {
// Form random buffer with CRC16
buffer_fill_random(master_buffer, BUF_SIZE);
// Print created packet for debugging
@ -268,8 +266,7 @@ static void rs485_master(void)
err_count++;
printf("Errors: %d\r\n", err_count);
}
}
else {
} else {
printf("Incorrect answer from slave, length = %d.\r\n", len);
err_count++;
}

Wyświetl plik

@ -12,7 +12,7 @@ project(uart_test)
if(CONFIG_COMPILER_DUMP_RTL_FILES)
add_custom_target(check_test_app_sections ALL
COMMAND ${PYTHON} $ENV{IDF_PATH}/tools/ci/check_callgraph.py
--rtl-dirs ${CMAKE_BINARY_DIR}/esp-idf/driver/,${CMAKE_BINARY_DIR}/esp-idf/hal/
--rtl-dirs ${CMAKE_BINARY_DIR}/esp-idf/esp_driver_uart/,${CMAKE_BINARY_DIR}/esp-idf/hal/
--elf-file ${CMAKE_BINARY_DIR}/uart_test.elf
find-refs
--from-sections=.iram0.text

Wyświetl plik

@ -2,6 +2,6 @@
# the component can be registered as WHOLE_ARCHIVE
idf_component_register(
SRCS "test_app_main.c" "test_uart.c"
REQUIRES driver unity
REQUIRES esp_driver_uart unity
WHOLE_ARCHIVE
)

Wyświetl plik

@ -5,29 +5,21 @@
*/
#include "unity.h"
#include "unity_test_runner.h"
#include "unity_test_utils.h"
#include "esp_heap_caps.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#define TEST_MEMORY_LEAK_THRESHOLD (200)
static size_t before_free_8bit;
static size_t before_free_32bit;
void setUp(void)
{
before_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT);
before_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT);
unity_utils_record_free_mem();
}
void tearDown(void)
{
size_t after_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT);
size_t after_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT);
printf("\n");
unity_utils_check_leak(before_free_8bit, after_free_8bit, "8BIT", TEST_MEMORY_LEAK_THRESHOLD);
unity_utils_check_leak(before_free_32bit, after_free_32bit, "32BIT", TEST_MEMORY_LEAK_THRESHOLD);
esp_reent_cleanup(); //clean up some of the newlib's lazy allocations
unity_utils_evaluate_leaks_direct(TEST_MEMORY_LEAK_THRESHOLD);
}
void app_main(void)

Wyświetl plik

@ -98,7 +98,7 @@ static void test_task3(void *pvParameters)
TEST_CASE("test uart_wait_tx_done is not blocked when ticks_to_wait=0", "[uart]")
{
xTaskCreate(test_task3, "tsk3", 4096, NULL, 5, NULL);
while(!case_end);
while (!case_end);
vTaskDelay(2); // wait for test_task3 to exit
}
@ -231,13 +231,13 @@ static void uart_write_task(void *param)
{
int uart_num = (int)param;
uint8_t *tx_buf = (uint8_t *)malloc(1024);
if(tx_buf == NULL) {
if (tx_buf == NULL) {
TEST_FAIL_MESSAGE("tx buffer malloc fail");
}
for(int i = 1; i < 1023; i++) {
for (int i = 1; i < 1023; i++) {
tx_buf[i] = (i & 0xff);
}
for(int i = 0; i < 1024; i++) {
for (int i = 0; i < 1024; i++) {
//d[0] and d[1023] are header
tx_buf[0] = (i & 0xff);
tx_buf[1023] = ((~i) & 0xff);
@ -261,7 +261,7 @@ TEST_CASE("uart read write test", "[uart]")
{
const int uart_num = UART_NUM1;
uint8_t *rd_data = (uint8_t *)malloc(1024);
if(rd_data == NULL) {
if (rd_data == NULL) {
TEST_FAIL_MESSAGE("rx buffer malloc fail");
}
uart_config_t uart_config = {
@ -330,7 +330,7 @@ TEST_CASE("uart tx with ringbuffer test", "[uart]")
const int uart_num = UART_NUM1;
uint8_t *rd_data = (uint8_t *)malloc(1024);
uint8_t *wr_data = (uint8_t *)malloc(1024);
if(rd_data == NULL || wr_data == NULL) {
if (rd_data == NULL || wr_data == NULL) {
TEST_FAIL_MESSAGE("buffer malloc fail");
}
uart_config_t uart_config = {
@ -344,7 +344,7 @@ TEST_CASE("uart tx with ringbuffer test", "[uart]")
};
uart_wait_tx_idle_polling(uart_num);
TEST_ESP_OK(uart_param_config(uart_num, &uart_config));
TEST_ESP_OK(uart_driver_install(uart_num, 1024 * 2, 1024 *2, 20, NULL, 0));
TEST_ESP_OK(uart_driver_install(uart_num, 1024 * 2, 1024 * 2, 20, NULL, 0));
TEST_ESP_OK(uart_set_loop_back(uart_num, true));
TEST_ESP_OK(uart_set_pin(uart_num, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART1_CTS_PIN));
//Connect the RTS out_signal to the CTS pin (which is mapped to CTS in_signal)

Wyświetl plik

@ -19,5 +19,5 @@ endif()
# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
# the component can be registered as WHOLE_ARCHIVE
idf_component_register(SRCS ${srcs}
REQUIRES unity driver test_utils efuse
REQUIRES unity esp_driver_gpio esp_driver_gptimer esp_driver_uart test_utils efuse
WHOLE_ARCHIVE)

Wyświetl plik

@ -4,5 +4,5 @@ set(srcs "test_app_main.c"
# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
# the component can be registered as WHOLE_ARCHIVE
idf_component_register(SRCS ${srcs}
PRIV_REQUIRES unity driver
PRIV_REQUIRES unity esp_driver_uart
WHOLE_ARCHIVE)

Wyświetl plik

@ -4,5 +4,5 @@ set(srcs "test_app_main.c"
# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
# the component can be registered as WHOLE_ARCHIVE
idf_component_register(SRCS ${srcs}
REQUIRES unity driver test_utils
REQUIRES unity esp_driver_gpio test_utils
WHOLE_ARCHIVE)

Wyświetl plik

@ -4,5 +4,5 @@ set(srcs "test_app_main.c"
# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
# the component can be registered as WHOLE_ARCHIVE
idf_component_register(SRCS ${srcs}
PRIV_REQUIRES unity driver
PRIV_REQUIRES unity esp_driver_uart driver
WHOLE_ARCHIVE)

Wyświetl plik

@ -1,6 +1,7 @@
set(requires "unity"
"test_utils"
"driver"
"esp_driver_uart"
"esp_driver_gpio"
"esp_timer"
"nvs_flash"
"esp_psram")

Wyświetl plik

@ -196,7 +196,7 @@ idf_component_register(SRC_DIRS "${src_dirs}"
EXCLUDE_SRCS "${exclude_srcs}"
INCLUDE_DIRS "${public_include_dirs}"
PRIV_INCLUDE_DIRS "${private_include_dirs}"
REQUIRES esp_netif lwip driver
REQUIRES esp_netif lwip esp_driver_uart driver
LDFRAGMENTS linker.lf
PRIV_REQUIRES console esp_event esp_partition esp_timer
ieee802154 mbedtls nvs_flash)

Wyświetl plik

@ -11,6 +11,7 @@ list(APPEND sources "vfs.c"
"vfs_console.c")
list(APPEND pr driver
esp_driver_uart
esp_timer)
idf_component_register(SRCS ${sources}

Wyświetl plik

@ -78,7 +78,6 @@ INPUT = \
$(PROJECT_PATH)/components/driver/parlio/include/driver/parlio_types.h \
$(PROJECT_PATH)/components/driver/touch_sensor/include/driver/touch_sensor_common.h \
$(PROJECT_PATH)/components/driver/twai/include/driver/twai.h \
$(PROJECT_PATH)/components/driver/uart/include/driver/uart.h \
$(PROJECT_PATH)/components/driver/test_apps/components/esp_serial_slave_link/include/esp_serial_slave_link/essl_sdio.h \
$(PROJECT_PATH)/components/driver/test_apps/components/esp_serial_slave_link/include/esp_serial_slave_link/essl_spi.h \
$(PROJECT_PATH)/components/driver/test_apps/components/esp_serial_slave_link/include/esp_serial_slave_link/essl.h \
@ -143,6 +142,7 @@ INPUT = \
$(PROJECT_PATH)/components/esp_driver_spi/include/driver/spi_slave_hd.h \
$(PROJECT_PATH)/components/esp_driver_spi/include/driver/spi_slave.h \
$(PROJECT_PATH)/components/esp_driver_tsens/include/driver/temperature_sensor.h \
$(PROJECT_PATH)/components/esp_driver_uart/include/driver/uart.h \
$(PROJECT_PATH)/components/esp_eth/include/esp_eth_com.h \
$(PROJECT_PATH)/components/esp_eth/include/esp_eth_driver.h \
$(PROJECT_PATH)/components/esp_eth/include/esp_eth_mac.h \

Wyświetl plik

@ -20,6 +20,7 @@ In order to control the dependence of other components on drivers at a smaller g
- `esp_driver_tsens` - Driver for Temperature Sensor
- `esp_driver_sdm` - Driver for Sigma-Delta Modulator
- `esp_driver_i2c` - Driver for I2C
- `esp_driver_uart` - Driver for UART
For compatibility, the original `driver`` component is still treated as an all-in-one component by registering these `esp_driver_xyz`` components as its public dependencies. In other words, you do not need to modify the CMake file of an existing project, but you now have a way to specify the specific peripheral driver that your project depends on.

Wyświetl plik

@ -20,6 +20,7 @@
- `esp_driver_tsens` - 温度传感器驱动
- `esp_driver_sdm` - Sigma-Delta 调制器驱动
- `esp_driver_i2c` - I2C 驱动
- `esp_driver_uart` - UART 驱动
为了兼容性,原来的 `driver` 组件仍然存在,并作为一个 “all-in-one" 的组件,将以上这些 `esp_driver_xyz` 组件注册成自己的公共依赖。换句话说,你无需修改既有项目的 CMake 文件,但是你现在多了一个途径去指定你项目依赖的具体的外设驱动。

Wyświetl plik

@ -43,9 +43,9 @@ examples/bluetooth/bluedroid/classic_bt:
- vfs
- esp_driver_gpio
- esp_driver_i2s
- esp_driver_uart
depends_filepatterns:
- components/driver/dac/**/*
- components/driver/uart/**/*
examples/bluetooth/bluedroid/coex/a2dp_gatts_coex:
<<: *bt_default_depends
@ -134,15 +134,15 @@ examples/bluetooth/hci/controller_hci_uart_esp32:
<<: *bt_default_depends
enable:
- if: IDF_TARGET == "esp32"
depends_filepatterns:
- components/driver/uart/**/*
depends_components:
- esp_driver_uart
examples/bluetooth/hci/controller_hci_uart_esp32c3_and_esp32s3:
<<: *bt_default_depends
enable:
- if: IDF_TARGET in ["esp32c3", "esp32s3"]
depends_filepatterns:
- components/driver/uart/**/*
depends_components:
- esp_driver_uart
# config BT_NIMBLE_ENABLED does not depends on any soc cap
@ -256,7 +256,7 @@ examples/bluetooth/nimble/throughput_app:
- if: SOC_BLE_SUPPORTED != 1
depends_components:
- esp_driver_gpio
- esp_driver_uart
depends_filepatterns:
- examples/bluetooth/nimble/common/**/*
- examples/bluetooth/nimble/throughput_app/blecent_throughput/components/**/*
- components/driver/uart/**/*

Wyświetl plik

@ -65,8 +65,8 @@ examples/wifi/power_save:
<<: *wifi_depends_default
disable:
- if: SOC_WIFI_SUPPORTED != 1
depends_filepatterns:
- components/driver/uart/**/*
depends_components:
- esp_driver_uart
examples/wifi/wifi_aware:
disable: