This commit is contained in:
2024-06-22 17:07:14 +03:00
parent 8c3d60d8fd
commit daf75ec9d6
3 changed files with 56 additions and 27 deletions

View File

@ -36,24 +36,33 @@ extern "C"
/**
* @brief Initialize DHT sensor.
*
* @param[in] sensor_type Sensor type.
* @param[in] sensor_pin Sensor connection gpio.
* @param[in] config Pointer to DHT initialized configuration structure. Can point to a temporary variable.
*
* @return Handle of the sensor
* @attention I2C driver must be initialized first (for I2C connection only).
*
* @note Before initialize the sensor recommend initialize zh_dht_init_config_t structure with default values.
*
* @code zh_dht_init_config_t config = ZH_DHT_INIT_CONFIG_DEFAULT() @endcode
*
* @return
* - ESP_OK if initialization was success
* - ESP_ERR_INVALID_ARG if parameter error
* - ESP_ERR_NOT_FOUND if sensor not connected or not responded (for I2C connection only)
*/
esp_err_t zh_dht_init(const zh_dht_init_config_t *config);
/**
* @brief Read DHT sensor.
*
* @param[in] dht_handle Pointer for handle of the sensor.
* @param[out] humidity Pointer for DHT sensor reading data of humidity.
* @param[out] temperature Pointer for DHT sensor reading data of temperature.
*
* @return
* - ESP_OK if read was success
* - ESP_ERR_INVALID_ARG if parameter error
* - ESP_ERR_NOT_FOUND if DHT is not initialized
* - ESP_ERR_INVALID_RESPONSE if the bus is busy
* - ESP_ERR_INVALID_STATE if I2C driver not installed or not in master mode
* - ESP_ERR_TIMEOUT if operation timeout
* - ESP_ERR_INVALID_CRC if check CRC is fail
*/