feat: added deinit
This commit is contained in:
1 parent
a96eea73db
commit
8c8f5ffb82
3 files changed
+21
-1
No files matched your search
@@ -65,6 +65,15 @@ extern "C"
|
|||||||
*/
|
*/
|
||||||
esp_err_t zh_aht_init(const zh_aht_init_config_t *config, zh_aht_handle_t *handle);
|
esp_err_t zh_aht_init(const zh_aht_init_config_t *config, zh_aht_handle_t *handle);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Deinitialize AHT sensor.
|
||||||
|
*
|
||||||
|
* @param[in] handle Pointer to unique AHT handle.
|
||||||
|
*
|
||||||
|
* @return ESP_OK if success or an error code otherwise.
|
||||||
|
*/
|
||||||
|
esp_err_t zh_aht_deinit(zh_aht_handle_t *handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read AHT sensor.
|
* @brief Read AHT sensor.
|
||||||
*
|
*
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
3.3.0
|
3.4.0
|
||||||
@@ -33,6 +33,17 @@ esp_err_t zh_aht_init(const zh_aht_init_config_t *config, zh_aht_handle_t *handl
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
esp_err_t zh_aht_deinit(zh_aht_handle_t *handle)
|
||||||
|
{
|
||||||
|
ZH_LOGI("AHT deinitialization started.");
|
||||||
|
ZH_ERROR_CHECK(handle != NULL, ESP_ERR_INVALID_ARG, NULL, "AHT deinitialization failed. Invalid argument.");
|
||||||
|
ZH_ERROR_CHECK(handle->is_initialized == true, ESP_ERR_INVALID_STATE, NULL, "AHT deinitialization failed. AHT not initialized.");
|
||||||
|
ZH_ERROR_CHECK(i2c_master_bus_rm_device(handle->dev_handle) == ESP_OK, ESP_FAIL, NULL, "AHT deinitialization failed. I2C remove device failed.");
|
||||||
|
handle->is_initialized = false;
|
||||||
|
ZH_LOGI("AHT deinitialization completed successfully.");
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
esp_err_t zh_aht_read(zh_aht_handle_t *handle, float *humidity, float *temperature) // -V2008
|
esp_err_t zh_aht_read(zh_aht_handle_t *handle, float *humidity, float *temperature) // -V2008
|
||||||
{
|
{
|
||||||
ZH_LOGI("AHT read begin.");
|
ZH_LOGI("AHT read begin.");
|
||||||
|
|||||||
Reference in new issue
Block a user