项目作者: nimaltd

项目描述 :
DHT Sensor Library for stm32 HAL
高级语言: C
项目地址: git://github.com/nimaltd/DHT.git
创建时间: 2017-10-09T06:42:12Z
项目社区:https://github.com/nimaltd/DHT

开源协议:GNU General Public License v3.0

下载


DHT Library for STM32 HAL

ko-fi

This is the DHT (Humidity-Temperature) sensors STM32 HAL Library

How to use this Library:

  • Select “General peripheral Initalizion as a pair of ‘.c/.h’ file per peripheral” on project settings.
  • Enable a gpio pin as external interrupt on both Rising and Falling edge.
  • Enable a timer as normal mode.
  • Include Header and source into your project.
  • Config “dhtConf.h”.
  • Create your DHT_t struct.
  • Put DHT_pinChangeCallBack(your struct) in external callback function.
  • Call DHT_init( .. .. .. ).
  • Read data by DHT_readData(&temp,&humid)
  1. #include "DHT.h"
  2. DHT_t am2301;
  3. bool am2301_ok;
  4. void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
  5. {
  6. if(GPIO_Pin == am2301.pin)
  7. {
  8. DHT_pinChangeCallBack(&am2301);
  9. }
  10. }
  11. int main()
  12. {
  13. DHT_init(&am2301,DHT_Type_AM2301,&htim7,72,AM2301_GPIO_Port,AM2301_Pin);
  14. while(1)
  15. {
  16. HAL_Delay(5000);
  17. float t,h;
  18. am2301_ok = DHT_readData(&am2301,&t,&h);
  19. }
  20. }


Reversion History:
(2.0.0)
rewrite completly and Add external interrupt to reading pulses.

(1.0.0)
First Release.