dth11.c
#include "dth11.h"
/*
DTH11 ---->PG9
*/
void DHT11_Init(void)
{
GPIO_InitTypeDef GFIO_InitStruct;
//开始GPIOG时钟
RCC_AHB1PeriphClockCmd(RCC_AHBPeriph_GPIOG, ENABLE);
//配置以及初始化GPIO模式
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_out; //输出
GPIO_InitStruct.GPIO_OType =GPIO_OType_PP; //推挽
GPIO_InitStruct. GPIO_Pin =GPIO_Pin_9; //引脚
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_UP; //上拉
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_25MHz;
GPIO_Init(GPIOG,&GPIO_InitStruct);
}
void DHT11_Modeout(void)
{
GPIO_InitTypeDef GFIO_InitStruct;
//开始GPIOG时钟
RCC_AHB1PeriphClockCmd(RCC_AHBPeriph_GPIOG, ENABLE);
//配置以及初始化GPIO模式
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_out; //输出