diff --git a/docs/en/migration-guides/release-5.x/5.0/peripherals.rst b/docs/en/migration-guides/release-5.x/5.0/peripherals.rst index 9cad8b120f..c56238cdf5 100644 --- a/docs/en/migration-guides/release-5.x/5.0/peripherals.rst +++ b/docs/en/migration-guides/release-5.x/5.0/peripherals.rst @@ -537,7 +537,7 @@ Register Access Macros Previously, all register access macros could be used as expressions, so the following was allowed:: - uint32_t val = REG_SET_BITS(reg, mask); + uint32_t val = REG_SET_BITS(reg, bits, mask); In ESP-IDF v5.0, register access macros which write or read-modify-write the register can no longer be used as expressions, and can only be used as statements. This applies to the following macros: ``REG_WRITE``, ``REG_SET_BIT``, ``REG_CLR_BIT``, ``REG_SET_BITS``, ``REG_SET_FIELD``, ``WRITE_PERI_REG``, ``CLEAR_PERI_REG_MASK``, ``SET_PERI_REG_MASK``, ``SET_PERI_REG_BITS``. @@ -548,5 +548,5 @@ To store the value which would have been written into the register, split the op To get the value of the register after modification (which may be different from the value written), add an explicit read:: - REG_SET_BITS(reg, mask); + REG_SET_BITS(reg, bits, mask); uint32_t new_val = REG_READ(reg); diff --git a/docs/zh_CN/migration-guides/release-5.x/5.0/peripherals.rst b/docs/zh_CN/migration-guides/release-5.x/5.0/peripherals.rst index 93861e866e..adb3f3d433 100644 --- a/docs/zh_CN/migration-guides/release-5.x/5.0/peripherals.rst +++ b/docs/zh_CN/migration-guides/release-5.x/5.0/peripherals.rst @@ -537,7 +537,7 @@ LCD 更新前,所有用于访问寄存器的宏都可以作为表达式来使用,所以以下命令是允许的:: - uint32_t val = REG_SET_BITS(reg, mask); + uint32_t val = REG_SET_BITS(reg, bits, mask); 在 ESP-IDF v5.0 中,用于写入或读取-修改-写入寄存器的宏不能再作为表达式使用,而只能作为语句使用,这适用于以下宏: ``REG_WRITE``, ``REG_SET_BIT``, ``REG_CLR_BIT``, ``REG_SET_BITS``, ``REG_SET_FIELD``, ``WRITE_PERI_REG``, ``CLEAR_PERI_REG_MASK``, ``SET_PERI_REG_MASK``, ``SET_PERI_REG_BITS``。 @@ -548,5 +548,5 @@ LCD 要获得修改后的寄存器的值(该值可能与写入的值不同),要增加一个显示的读取命令:: - REG_SET_BITS(reg, mask); + REG_SET_BITS(reg, bits, mask); uint32_t new_val = REG_READ(reg);