Updated some comments
This commit is contained in:
parent
7339f1544b
commit
3a794774da
@ -5,8 +5,6 @@
|
||||
1. ESP8266 RTOS_SDK v3.4
|
||||
2. ESP32 ESP-IDF v5.2
|
||||
|
||||
## [Function description](http://zh-dht.zh.com.ru)
|
||||
|
||||
## Using
|
||||
|
||||
In an existing project, run the following command to install the component:
|
||||
@ -33,8 +31,8 @@ void app_main(void)
|
||||
{
|
||||
esp_log_level_set("zh_dht", ESP_LOG_NONE);
|
||||
zh_dht_handle_t dht_handle = zh_dht_init(ZH_DHT22, GPIO_NUM_5);
|
||||
float humidity;
|
||||
float temperature;
|
||||
float humidity = 0.0;
|
||||
float temperature = 0.0;
|
||||
for (;;)
|
||||
{
|
||||
zh_dht_read(&dht_handle, &humidity, &temperature);
|
||||
|
@ -1,9 +1,3 @@
|
||||
/**
|
||||
* @file
|
||||
* Header file for the zh_dht component.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "stdint.h"
|
||||
@ -18,24 +12,17 @@
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
/**
|
||||
* @brief Enumeration of supported sensor types.
|
||||
*
|
||||
*/
|
||||
typedef enum
|
||||
|
||||
typedef enum // Enumeration of supported sensor types.
|
||||
{
|
||||
ZH_DHT11, ///< Sensor type DHT11.
|
||||
ZH_DHT22 ///< Sensor type DHT22 or AM2302.
|
||||
ZH_DHT11, // Sensor type DHT11.
|
||||
ZH_DHT22 // Sensor type DHT22 or AM2302.
|
||||
} zh_dht_sensor_type_t;
|
||||
|
||||
/**
|
||||
* @brief Unique handle of the sensor.
|
||||
*
|
||||
*/
|
||||
typedef struct
|
||||
typedef struct // Unique handle of the sensor.
|
||||
{
|
||||
uint8_t sensor_pin; ///< Sensor GPIO connection. @note
|
||||
zh_dht_sensor_type_t sensor_type; ///< Sensor type. @note
|
||||
uint8_t sensor_pin; // Sensor GPIO connection.
|
||||
zh_dht_sensor_type_t sensor_type; // Sensor type.
|
||||
} zh_dht_handle_t;
|
||||
|
||||
/**
|
||||
|
8
zh_dht.c
8
zh_dht.c
@ -1,12 +1,5 @@
|
||||
/**
|
||||
* @file
|
||||
* The main code of the zh_dht component.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "zh_dht.h"
|
||||
|
||||
/// \cond
|
||||
#define BIT_1_TRANSFER_MAX_DURATION 75 // Signal "1" high time.
|
||||
#define BIT_0_TRANSFER_MAX_DURATION 30 // Signal "0" high time.
|
||||
#define DATA_BIT_START_TRANSFER_MAX_DURATION 55 // Signal "0", "1" low time.
|
||||
@ -19,7 +12,6 @@
|
||||
#else
|
||||
#define esp_delay_us(x) esp_rom_delay_us(x)
|
||||
#endif
|
||||
/// \endcond
|
||||
|
||||
static const char *TAG = "zh_dht";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user