DHT22(AM2302)的驱动代码,其中头文件如下:#ifndef __DHT22_H
#define __DHT22_H
#include "sys.h"
#define TIMES 10 //温湿度采集求平均的次数
#define DHT22_IO_IN() {GPIOB->CRL&=0XF0FFFFFF;GPIOB->CRL|=8CRL|=3<<24;}
#define DHT22_DQ_OUT PBout(6)
#define DHT22_DQ_IN PBin(6)
u8 DHT22_Init(void);
u8 DHT22_Read_Data(u16 *temp,u16 *humi);
u8 DHT22_Read_Byte(void);
u8 DHT22_Read_Bit(void);
u8 DHT22_Check(void);
u8 DHT22_Read_Data_Average(u8 *TempIntegerLocal,u8 *TempDecimalLocal,u8 *HumiLocal);
void DHT22_Rst(void);
1