mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 18:50:34 +03:00
fix(ulp): make LP peripheral default config macros C++ compatible
Use dual-path macros: C keeps fragment-style designated initializers; C++ uses GNU statement expressions (ESP_LOG_CONFIG_INIT pattern). Add compile-only C++ regression tests for LP UART/I2C and ULP RISC-V I2C. Closes https://github.com/espressif/esp-idf/issues/18369 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
set(app_sources "test_app_main.c" "test_ulp_riscv.c" "test_ulp_riscv_i2c.c")
|
||||
set(app_sources "test_app_main.c" "test_ulp_riscv.c" "test_ulp_riscv_i2c.c" "test_ulp_riscv_i2c_config_cpp.cpp")
|
||||
set(ulp_sources "ulp/test_main.c")
|
||||
set(ulp_sources2 "ulp/test_main_second_cocpu_firmware.c")
|
||||
set(ulp_sources3 "ulp/test_main_cocpu_crash.c")
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
|
||||
// Compile ULP RISC-V I2C default-config macros as C++ to catch incompatibilities.
|
||||
#include "ulp_riscv_i2c.h"
|
||||
|
||||
static void test_ulp_riscv_i2c_default_config_cpp(void) __attribute__((unused));
|
||||
static void test_ulp_riscv_i2c_default_config_cpp(void)
|
||||
{
|
||||
ulp_riscv_i2c_cfg_t cfg = ULP_RISCV_I2C_DEFAULT_CONFIG();
|
||||
ulp_riscv_i2c_pin_cfg_t pin_cfg = ULP_RISCV_I2C_DEFAULT_GPIO_CONFIG();
|
||||
ulp_riscv_i2c_timing_cfg_t fast_cfg = ULP_RISCV_I2C_FAST_MODE_CONFIG();
|
||||
ulp_riscv_i2c_timing_cfg_t std_cfg = ULP_RISCV_I2C_STANDARD_MODE_CONFIG();
|
||||
(void)cfg;
|
||||
(void)pin_cfg;
|
||||
(void)fast_cfg;
|
||||
(void)std_cfg;
|
||||
}
|
||||
Reference in New Issue
Block a user