diff --git a/html/_d_h_t_8h.html b/html/_d_h_t_8h.html index 755079a..129f10a 100644 --- a/html/_d_h_t_8h.html +++ b/html/_d_h_t_8h.html @@ -115,7 +115,7 @@ Macros
-

Define where debug output will be printed.

+

Define where debug output will be printed. \

diff --git a/html/_d_h_t_8h_source.html b/html/_d_h_t_8h_source.html index 825f5c1..9fe0b62 100644 --- a/html/_d_h_t_8h_source.html +++ b/html/_d_h_t_8h_source.html @@ -62,8 +62,8 @@ $(function() {
DHT.h
-Go to the documentation of this file.
1 
17 #ifndef DHT_H
18 #define DHT_H
19 
20 #include "Arduino.h"
21 
22 /* Uncomment to enable printing out nice debug messages. */
23 //#define DHT_DEBUG
24 
25 
26 #define DEBUG_PRINTER Serial
28 /* Setup debug printing macros. */
29 #ifdef DHT_DEBUG
30  #define DEBUG_PRINT(...) { DEBUG_PRINTER.print(__VA_ARGS__); }
31  #define DEBUG_PRINTLN(...) { DEBUG_PRINTER.println(__VA_ARGS__); }
32 #else
33  #define DEBUG_PRINT(...) {}
34  #define DEBUG_PRINTLN(...) {}
35 #endif
36 
37 /* Define types of sensors. */
38 #define DHT11 11
39 #define DHT12 12
40 #define DHT22 22
41 #define DHT21 21
42 #define AM2301 21
47 class DHT {
48  public:
49  DHT(uint8_t pin, uint8_t type, uint8_t count=6);
50  void begin(uint8_t usec=55);
51  float readTemperature(bool S=false, bool force=false);
52  float convertCtoF(float);
53  float convertFtoC(float);
54  float computeHeatIndex(bool isFahrenheit=true);
55  float computeHeatIndex(float temperature, float percentHumidity, bool isFahrenheit=true);
56  float readHumidity(bool force=false);
57  bool read(bool force=false);
58 
59  private:
60  uint8_t data[5];
61  uint8_t _pin, _type;
62  #ifdef __AVR
63  // Use direct GPIO access on an 8-bit AVR so keep track of the port and bitmask
64  // for the digital pin connected to the DHT. Other platforms will use digitalRead.
65  uint8_t _bit, _port;
66  #endif
67  uint32_t _lastreadtime, _maxcycles;
68  bool _lastresult;
69  uint8_t pullTime; // Time (in usec) to pull up data line before reading
70 
71  uint32_t expectPulse(bool level);
72 
73 };
74 
79  public:
80  InterruptLock() {
81 #if !defined(ARDUINO_ARCH_NRF52)
82  noInterrupts();
83 #endif
84  }
85  ~InterruptLock() {
86 #if !defined(ARDUINO_ARCH_NRF52)
87  interrupts();
88 #endif
89  }
90 };
91 
92 #endif
Class that stores state and functions for DHT.
Definition: DHT.h:47
-
Class that defines Interrupt Lock Avaiability.
Definition: DHT.h:78
+Go to the documentation of this file.
1 
18 #ifndef DHT_H
19 #define DHT_H
20 
21 #include "Arduino.h"
22 
23 /* Uncomment to enable printing out nice debug messages. */
24 //#define DHT_DEBUG
25 
26 #define DEBUG_PRINTER \
27  Serial
30 /* Setup debug printing macros. */
31 #ifdef DHT_DEBUG
32 #define DEBUG_PRINT(...) \
33  { DEBUG_PRINTER.print(__VA_ARGS__); }
34 #define DEBUG_PRINTLN(...) \
35  { DEBUG_PRINTER.println(__VA_ARGS__); }
36 #else
37 #define DEBUG_PRINT(...) \
38  {}
39 #define DEBUG_PRINTLN(...) \
40  {}
41 #endif
42 
43 /* Define types of sensors. */
44 #define DHT11 11
45 #define DHT12 12
46 #define DHT22 22
47 #define DHT21 21
48 #define AM2301 21
53 class DHT {
54 public:
55  DHT(uint8_t pin, uint8_t type, uint8_t count = 6);
56  void begin(uint8_t usec = 55);
57  float readTemperature(bool S = false, bool force = false);
58  float convertCtoF(float);
59  float convertFtoC(float);
60  float computeHeatIndex(bool isFahrenheit = true);
61  float computeHeatIndex(float temperature, float percentHumidity,
62  bool isFahrenheit = true);
63  float readHumidity(bool force = false);
64  bool read(bool force = false);
65 
66 private:
67  uint8_t data[5];
68  uint8_t _pin, _type;
69 #ifdef __AVR
70  // Use direct GPIO access on an 8-bit AVR so keep track of the port and
71  // bitmask for the digital pin connected to the DHT. Other platforms will use
72  // digitalRead.
73  uint8_t _bit, _port;
74 #endif
75  uint32_t _lastreadtime, _maxcycles;
76  bool _lastresult;
77  uint8_t pullTime; // Time (in usec) to pull up data line before reading
78 
79  uint32_t expectPulse(bool level);
80 };
81 
85 class InterruptLock {
86 public:
87  InterruptLock() {
88 #if !defined(ARDUINO_ARCH_NRF52)
89  noInterrupts();
90 #endif
91  }
92  ~InterruptLock() {
93 #if !defined(ARDUINO_ARCH_NRF52)
94  interrupts();
95 #endif
96  }
97 };
98 
99 #endif
Class that stores state and functions for DHT.
Definition: DHT.h:56
+
Class that defines Interrupt Lock Avaiability.
Definition: DHT.h:88
Go to the documentation of this file.
1 
33 #ifndef DHT_U_H
34 #define DHT_U_H
35 
36 #include <Adafruit_Sensor.h>
37 #include <DHT.h>
38 
39 #define DHT_SENSOR_VERSION 1
45 class DHT_Unified {
46 public:
47  DHT_Unified(uint8_t pin, uint8_t type, uint8_t count = 6,
48  int32_t tempSensorId = -1, int32_t humiditySensorId = -1);
49  void begin();
50 
54  class Temperature : public Adafruit_Sensor {
55  public:
56  Temperature(DHT_Unified *parent, int32_t id);
57  bool getEvent(sensors_event_t *event);
58  void getSensor(sensor_t *sensor);
59 
60  private:
61  DHT_Unified *_parent;
62  int32_t _id;
63  };
64 
68  class Humidity : public Adafruit_Sensor {
69  public:
70  Humidity(DHT_Unified *parent, int32_t id);
71  bool getEvent(sensors_event_t *event);
72  void getSensor(sensor_t *sensor);
73 
74  private:
75  DHT_Unified *_parent;
76  int32_t _id;
77  };
78 
83  Temperature temperature() { return _temp; }
84 
89  Humidity humidity() { return _humidity; }
90 
91 private:
92  DHT _dht;
93  uint8_t _type;
94  Temperature _temp;
95  Humidity _humidity;
96 
97  void setName(sensor_t *sensor);
98  void setMinDelay(sensor_t *sensor);
99 };
100 
101 #endif
Humidity humidity()
Returns humidity stored in _humidity.
Definition: DHT_U.h:89
-
Class that stores state and functions for DHT.
Definition: DHT.h:47
+
Class that stores state and functions for DHT.
Definition: DHT.h:56
Class that stores state and functions about Temperature.
Definition: DHT_U.h:54
Class that stores state and functions for interacting with DHT_Unified.
Definition: DHT_U.h:45