From f599abdb1fe89d52ef78e9b0fa08d5ae1866182d Mon Sep 17 00:00:00 2001 From: Chen Chen Date: Tue, 14 Jul 2026 15:03:31 +0800 Subject: [PATCH] docs(i2c): clarify 7-bit address usage Closes https://github.com/espressif/esp-idf/pull/18831 --- docs/en/api-reference/peripherals/i2c.rst | 2 +- docs/zh_CN/api-reference/peripherals/i2c.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/en/api-reference/peripherals/i2c.rst b/docs/en/api-reference/peripherals/i2c.rst index 52d8c6b5ed6..cc88e94e274 100644 --- a/docs/en/api-reference/peripherals/i2c.rst +++ b/docs/en/api-reference/peripherals/i2c.rst @@ -101,7 +101,7 @@ If the configurations in :cpp:type:`i2c_master_bus_config_t` is specified, then I2C master device requires the configuration that specified by :cpp:type:`i2c_device_config_t`: - :cpp:member:`i2c_device_config_t::dev_addr_length` configure the address bit length of the slave device. It can be chosen from enumerator :cpp:enumerator:`I2C_ADDR_BIT_LEN_7` or :cpp:enumerator:`I2C_ADDR_BIT_LEN_10` (if supported). -- :cpp:member:`i2c_device_config_t::device_address` sets the I2C device raw address. Please parse the device address to this member directly. For example, the device address is 0x28, then parse 0x28 to :cpp:member:`i2c_device_config_t::device_address`, don't carry a write or read bit. +- :cpp:member:`i2c_device_config_t::device_address` sets the raw I2C device address. Pass the device address directly to this member. For devices with a 7-bit address, use the **7-bit** address instead of an 8-bit address that includes the read/write bit. - :cpp:member:`i2c_device_config_t::scl_speed_hz` sets the SCL line frequency of this device. - :cpp:member:`i2c_device_config_t::scl_wait_us` sets the SCL await time (in μs). Usually this value should not be very small because slave stretch will happen in pretty long time (It's possible even stretch for 12 ms). Set ``0`` means use default register value. diff --git a/docs/zh_CN/api-reference/peripherals/i2c.rst b/docs/zh_CN/api-reference/peripherals/i2c.rst index 0ff32f9f522..ca1d19badae 100644 --- a/docs/zh_CN/api-reference/peripherals/i2c.rst +++ b/docs/zh_CN/api-reference/peripherals/i2c.rst @@ -101,7 +101,7 @@ I2C 主机总线需要 :cpp:type:`i2c_master_bus_config_t` 指定的配置: I2C 主机设备需要 :cpp:type:`i2c_device_config_t` 指定的配置: - :cpp:member:`i2c_device_config_t::dev_addr_length` 配置从机设备的地址位长度,可从枚举 :cpp:enumerator:`I2C_ADDR_BIT_LEN_7` 或 :cpp:enumerator:`I2C_ADDR_BIT_LEN_10` (如果支持)中进行选择。 -- :cpp:member:`i2c_device_config_t::device_address` 设置 I2C 设备原始地址,请直接将设备地址解析到此成员。例如,若设备地址为 0x28,则将 0x28 解析到 :cpp:member:`i2c_device_config_t::device_address`,不要带写入或读取位。 +- :cpp:member:`i2c_device_config_t::device_address` 设置 I2C 设备原始地址,请直接将设备地址解析到此成员。对于使用 7 位地址的设备,请使用 **7 位** 地址,不要使用带读/写位的 8 位地址。 - :cpp:member:`i2c_device_config_t::scl_speed_hz` 设置此设备的 SCL 线频率。 - :cpp:member:`i2c_device_config_t::scl_wait_us` 设置 SCL 等待时间(以微秒为单位)。通常此值较大,因为从机延伸时间会很长(甚至可能延伸到 12 ms)。设置为 ``0`` 表示使用默认的寄存器值。