Version 1.0.1

Updated some components.
Changed main code to support the new major version of zh_config.
Reducing the amount of memory used.
This commit is contained in:
2024-06-09 14:30:15 +03:00
parent db2a33d47f
commit 6ecd5a59bd
30 changed files with 723 additions and 651 deletions

View File

@ -24,9 +24,9 @@ extern "C"
*/
typedef enum
{
ZH_DHT11, ///< Sensor type DHT11
ZH_DHT22 ///< Sensor type DHT22 or AM2302
} __attribute__((packed)) zh_dht_sensor_type_t;
ZH_DHT11, ///< Sensor type DHT11.
ZH_DHT22 ///< Sensor type DHT22 or AM2302.
} zh_dht_sensor_type_t;
/**
* @brief Unique handle of the sensor.
@ -34,34 +34,33 @@ extern "C"
*/
typedef struct
{
uint8_t sensor_pin; ///< Sensor GPIO connection
zh_dht_sensor_type_t sensor_type; ///< Sensor type
} __attribute__((packed)) zh_dht_handle_t;
uint8_t sensor_pin; ///< Sensor GPIO connection. @note
zh_dht_sensor_type_t sensor_type; ///< Sensor type. @note
} zh_dht_handle_t;
/**
* @brief Initialize DHT sensor.
* @brief Initialize DHT sensor.
*
* @param[in] sensor_type Sensor type (ZH_DHT11 or ZH_DHT22).
* @param[in] sensor_pin Sensor connection gpio.
* @param[in] sensor_type Sensor type.
* @param[in] sensor_pin Sensor connection gpio.
*
* @return
* - Handle of the sensor.
* @return Handle of the sensor
*/
zh_dht_handle_t zh_dht_init(const zh_dht_sensor_type_t sensor_type, const uint8_t sensor_pin);
/**
* @brief Read DHT sensor.
* @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.
* @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_INVALID_RESPONSE if the bus is busy
* - ESP_ERR_TIMEOUT if operation timeout
* - ESP_ERR_INVALID_CRC if check CRC is fail
* - ESP_OK if read was success
* - ESP_ERR_INVALID_ARG if parameter error
* - ESP_ERR_INVALID_RESPONSE if the bus is busy
* - ESP_ERR_TIMEOUT if operation timeout
* - ESP_ERR_INVALID_CRC if check CRC is fail
*/
esp_err_t zh_dht_read(const zh_dht_handle_t *dht_handle, float *humidity, float *temperature);