Prechádzať zdrojové kódy

driver/i2c: add notes to i2c deleteing function

laokaiyao 4 rokov pred
rodič
commit
b807f2a666

+ 3 - 0
components/driver/include/driver/i2c.h

@@ -97,6 +97,9 @@ esp_err_t i2c_driver_install(i2c_port_t i2c_num, i2c_mode_t mode, size_t slv_rx_
 /**
  * @brief I2C driver delete
  *
+ * @note This function does not guarantee thread safety.
+ *       Please make sure that no thread will continuously hold semaphores before calling the delete function.
+ *
  * @param i2c_num I2C port number
  *
  * @return

+ 1 - 0
docs/en/api-reference/peripherals/i2c.rst

@@ -351,6 +351,7 @@ Delete Driver
 
 When the I2C communication is established with the function :cpp:func:`i2c_driver_install` and is not required for some substantial amount of time, the driver may be deinitialized to release allocated resources by calling :cpp:func:`i2c_driver_delete`.
 
+Before calling :cpp:func:`i2c_driver_delete` to remove i2c driver, please make sure that all threads have stopped using the driver in any way, because this function does not guarantee thread safety.
 
 Application Example
 -------------------