RUI3 (RAK Unified Interface 3) - RAK4631
rak1901.h
Go to the documentation of this file.
1 #ifndef __RAK_1901_H__
2 #define __RAK_1901_H__
3 
4 #include "Wire.h"
5 #include "wiring_time.h"
6 
7 #define SHTC3_ADDR_7BIT 0x70
8 
9 typedef enum {
10  SHTC3_CMD_WAKE = 0x3517,
11  SHTC3_CMD_SLEEP = 0xB098,
15 
16 typedef enum {
17  SHTC3_CMD_CSE_RHF_NPM = 0x5C24, // Clock stretching, RH first,
18  // Normal power mode
19  SHTC3_CMD_CSE_RHF_LPM = 0x44DE, // Clock stretching, RH first, Low
20  // power mode
21  SHTC3_CMD_CSE_TF_NPM = 0x7CA2, // Clock stretching, T first,
22  // Normal power mode
23  SHTC3_CMD_CSE_TF_LPM = 0x6458, // Clock stretching, T first, Low
24  // power mode
25 
26  SHTC3_CMD_CSD_RHF_NPM = 0x58E0, // Polling, RH first, Normal power
27  // mode
28  SHTC3_CMD_CSD_RHF_LPM = 0x401A, // Polling, RH first, Low power
29  // mode
30  SHTC3_CMD_CSD_TF_NPM = 0x7866, // Polling, T first, Normal power
31  // mode
32  SHTC3_CMD_CSD_TF_LPM = 0x609C // Polling, T first, Low power
33  // mode
35 
36 class rak1901 {
37  private:
38  bool isInit;
39  uint16_t RH; // Current raw RH data from the sensor
40  uint16_t T; // Current raw T data from the sensor
41  uint16_t ID; // Current raw ID data from the sensor
42 
43  void resetValue();
44 
45  public:
46  rak1901();
49 
50 #ifdef RAK5010_EVB
51 
55 #endif
56 
63  bool init(void);
64 
72  bool wakeup(void);
73 
81  void sleep(void);
82 
91  bool update(void);
92 
102  float temperature(void);
103 
113  float humidity(void);
114 
117 };
118 
119 float SHTC3_raw2DegC(uint16_t T); // Converts SHTC3 T data
120  // to deg C
121 float SHTC3_raw2DegF(uint16_t T); // Converts SHTC3 T data
122  // to deg F
123 float SHTC3_raw2Percent(uint16_t RH); // Converts SHTC3 RH data
124  // to % RH
125 
126 #endif
bool init(void)
Definition: rak1901.h:19
Definition: rak1901.h:32
SHTC3_Commands_TypeDef
Definition: rak1901.h:9
Definition: rak1901.h:10
bool sendCommand(SHTC3_Commands_TypeDef cmd)
Definition: rak1901.h:21
Definition: rak1901.h:11
float temperature(void)
Definition: rak1901.h:23
float SHTC3_raw2DegC(uint16_t T)
Definition: rak1901.h:17
Definition: rak1901.h:30
void sleep(void)
SHTC3_MeasurementModes_TypeDef
Definition: rak1901.h:16
bool update(void)
Definition: rak1901.h:26
float SHTC3_raw2Percent(uint16_t RH)
float humidity(void)
Definition: rak1901.h:13
Definition: rak1901.h:36
float SHTC3_raw2DegF(uint16_t T)
bool wakeup(void)
Definition: rak1901.h:12
Definition: rak1901.h:28