ESP8266 Centre + NB
函数 | 变量
hal_temp_hum.c 文件参考
#include "driver/hal_temp_hum.h"
#include "osapi.h"
hal_temp_hum.c 的引用(Include)关系图:

函数

uint8_t ICACHE_FLASH_ATTR dh11Read (uint8_t *temperature, uint8_t *humidity)
 
uint8_t ICACHE_FLASH_ATTR dh11Init (void)
 
void ICACHE_FLASH_ATTR dh11SensorTest (void)
 

变量

th_typedef_t temphum_typedef
 

函数说明

uint8_t ICACHE_FLASH_ATTR dh11Read ( uint8_t temperature,
uint8_t humidity 
)
123 {
124  uint8_t ret = 0;
125  uint8_t cur_i = 0;
126  uint8_t curTem = 0;
127  uint8_t curHum = 0;
128  uint16_t temMeans = 0;
129  uint16_t hum_means = 0;
130 
131  ret = dht11ReadData(&curTem, &curHum);
132 
133  if(0 == ret)
134  {
135  //Cycle store ten times stronghold
137  {
140 
142  }
143  else
144  {
146 
149 
151  }
152  }
153  else
154  {
155  return 1;
156  }
157 
159  {
161  }
162 
163  if(0 == temphum_typedef.th_amount)
164  {
165  //Calculate Before ten the mean
166  for(cur_i = 0; cur_i < temphum_typedef.th_num; cur_i++)
167  {
168  temMeans += temphum_typedef.th_bufs[cur_i][0];
169  hum_means += temphum_typedef.th_bufs[cur_i][1];
170  }
171 
172  temMeans = temMeans / temphum_typedef.th_num;
173  hum_means = hum_means / temphum_typedef.th_num;
174 
175  *temperature = temMeans;
176  *humidity = hum_means;
177  }
178  else if(MEAN_NUM == temphum_typedef.th_amount)
179  {
180  //Calculate After ten times the mean
181  for(cur_i = 0; cur_i < temphum_typedef.th_amount; cur_i++)
182  {
183  temMeans += temphum_typedef.th_bufs[cur_i][0];
184  hum_means += temphum_typedef.th_bufs[cur_i][1];
185  }
186 
187  temMeans = temMeans / temphum_typedef.th_amount;
188  hum_means = hum_means / temphum_typedef.th_amount;
189 
190  *temperature = (uint8_t)temMeans;
191  *humidity = (uint8_t)hum_means;
192  }
193 
194  return 0;
195 }
th_typedef_t temphum_typedef
Definition: hal_temp_hum.c:11
#define MEAN_NUM
Definition: hal_temp_hum.h:23
unsigned char uint8_t
Definition: c_types.h:28
uint8_t th_num
Definition: hal_temp_hum.h:27
uint8_t th_amount
Definition: hal_temp_hum.h:28
uint8_t th_bufs[10][2]
Definition: hal_temp_hum.h:29
unsigned short uint16_t
Definition: c_types.h:31

这是这个函数的调用关系图:

uint8_t ICACHE_FLASH_ATTR dh11Init ( void  )
198 {
199  /* Migrate your driver code */
201 
202  dht11Rst();
203 
204  os_memset((uint8_t *)&temphum_typedef, 0, sizeof(th_typedef_t));
205 
206  os_printf("dh11Init \r\n");
207 
208  return dht11Check();
209 }
#define PIN_FUNC_SELECT(PIN_NAME, FUNC)
Definition: eagle_soc.h:270
th_typedef_t temphum_typedef
Definition: hal_temp_hum.c:11
#define os_printf
Definition: osapi.h:62
#define FUNC_GPIO5
Definition: eagle_soc.h:265
#define os_memset
Definition: osapi.h:38
unsigned char uint8_t
Definition: c_types.h:28
#define PERIPHS_IO_MUX_GPIO5_U
Definition: eagle_soc.h:264
Definition: hal_temp_hum.h:25
void ICACHE_FLASH_ATTR dh11SensorTest ( void  )
212 {
213  /* Test LOG model */
214 
215  uint8_t curTem = 0;
216  uint8_t curHum = 0;
217 
218  dht11ReadData(&curTem, &curHum);
219 
220  os_printf("Temperature : %d , Humidity : %d", curTem, curHum);
221 }
#define os_printf
Definition: osapi.h:62
unsigned char uint8_t
Definition: c_types.h:28

变量说明

th_typedef_t temphum_typedef