Merge branch 'docs/update_arguments_reg_set_bits' into 'master'

docs: update arguments of REG_SET_BITS

See merge request espressif/esp-idf!26145
This commit is contained in:
Zhang Xiao Yan 2023-09-26 18:06:43 +08:00
commit d33ee17dee
2 changed files with 4 additions and 4 deletions

View File

@ -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);

View File

@ -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);