Skip to content

static assert on I2C_NUM_1 for ESP32C6 #37

@ozanoner

Description

@ozanoner

Checklist

  • Checked the issue tracker for similar issues to ensure this is not a duplicate
  • Read the documentation to confirm the issue is not addressed there and your configuration is set correctly
  • Tested with the latest version to ensure the issue hasn't been fixed

How often does this bug occurs?

always

Expected behavior

Builds for esp32-c6.

Actual behavior (suspected bug)

Build fails.

Error logs or terminal output

/home/ozan/projects/esp-idf-cxx/i2c_cxx.cpp:22:15: error: 'I2C_NUM_1' was not declared in this scope; did you mean 'I2C_NUM_0'?
   22 | static_assert(I2C_NUM_1 == 1, "I2C_NUM_1 must be equal to 1");
      |               ^~~~~~~~~
      |               I2C_NUM_0
[597/604] Building CXX object esp-idf/esp-idf-cxx/CMakeFiles/__idf_esp-idf-cxx.dir/esp_event_cxx.cpp.obj
ninja: build stopped: subcommand failed.

Steps to reproduce the behavior

  1. Clone this repo
  2. cd examples/simple_i2c_rw_example
  3. idf.py set-target esp32c6
  4. idf.py build

Project release version

latest

System architecture

Intel/AMD 64-bit (modern PC, older Mac)

Operating system

Linux

Operating system version

Ubuntu 24.04.2 LTS

Shell

Bash

Additional context

The following should fix (in i2c_cxx.cpp, SOC_I2C_NUM -> SOC_HP_I2C_NUM)

/**
 * I2C bus are defined in the header files, let's check that the values are correct
 */
#if SOC_HP_I2C_NUM >= 2
static_assert(I2C_NUM_1 == 1, "I2C_NUM_1 must be equal to 1");
#endif // SOC_I2C_NUM >= 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions