mirror of
https://github.com/niesteszeck/idDHT11.git
synced 2025-03-15 04:27:29 +03:00
v 0.1.1 Optimization by pylon
added a changelog
This commit is contained in:
parent
56cfe7e0bd
commit
b958c6e1f6
21
README.md
21
README.md
@ -3,11 +3,22 @@ idDHT11
|
||||
|
||||
Interrupt driven DHT11 library
|
||||
|
||||
VERSION: 0.1
|
||||
PURPOSE: Interrupt driven Lib for DHT11 with Arduino.
|
||||
VERSION: 0.1.1
|
||||
|
||||
LICENCE: GPL v3 (http://www.gnu.org/licenses/gpl.html)
|
||||
PURPOSE: Interrupt driven Lib for DHT11 with Arduino.
|
||||
|
||||
DATASHEET: http://www.micro4you.com/files/sensor/DHT11.pdf
|
||||
LICENCE: GPL v3 (http://www.gnu.org/licenses/gpl.html)
|
||||
|
||||
Based on DHT11 library: http://playground.arduino.cc/Main/DHT11Lib
|
||||
DATASHEET: http://www.micro4you.com/files/sensor/DHT11.pdf
|
||||
|
||||
Based on DHT11 library: http://playground.arduino.cc/Main/DHT11Lib
|
||||
|
||||
Changelog:
|
||||
|
||||
v 0.1
|
||||
|
||||
First version, added Functionality to DHT11 sensor
|
||||
|
||||
v 0.1.1
|
||||
|
||||
Optimizacion on shift var (pylon from Arduino Forum)
|
||||
|
11
idDHT11.cpp
11
idDHT11.cpp
@ -1,11 +1,17 @@
|
||||
/*
|
||||
FILE: idDHT11.cpp
|
||||
VERSION: 0.1
|
||||
VERSION: 0.1.1
|
||||
PURPOSE: Interrupt driven Lib for DHT11 with Arduino.
|
||||
LICENCE: GPL v3 (http://www.gnu.org/licenses/gpl.html)
|
||||
DATASHEET: http://www.micro4you.com/files/sensor/DHT11.pdf
|
||||
|
||||
Based on DHT11 library: http://playground.arduino.cc/Main/DHT11Lib
|
||||
|
||||
Changelog:
|
||||
v 0.1
|
||||
First version, added Functionality to DHT11 sensor
|
||||
v 0.1.1
|
||||
Optimizacion on shift var (pylon from Arduino Forum)
|
||||
*/
|
||||
|
||||
#include "idDHT11.h"
|
||||
@ -91,8 +97,9 @@ void idDHT11::isrCallback() {
|
||||
status = IDDHTLIB_ERROR_DELTA;
|
||||
state = STOPPED;
|
||||
} else if(60<delta && delta<135) { //valid in timing
|
||||
bits[idx] <<= 1;
|
||||
if(delta>90) //is a one
|
||||
bits[idx] |= (1 << cnt);
|
||||
bits[idx] |= 1;
|
||||
if (cnt == 0) { // whe have fullfilled the byte, go to next
|
||||
cnt = 7; // restart at MSB
|
||||
if(idx++ == 4) { // go to next byte, if whe have got 5 bytes stop.
|
||||
|
16
idDHT11.h
16
idDHT11.h
@ -1,11 +1,17 @@
|
||||
/*
|
||||
FILE: idDHT11.h
|
||||
VERSION: 0.1
|
||||
VERSION: 0.1.1
|
||||
PURPOSE: Interrupt driven Lib for DHT11 with Arduino.
|
||||
LICENCE: GPL v3 (http://www.gnu.org/licenses/gpl.html)
|
||||
DATASHEET: http://www.micro4you.com/files/sensor/DHT11.pdf
|
||||
|
||||
Based on DHT11 library: http://playground.arduino.cc/Main/DHT11Lib
|
||||
|
||||
Changelog:
|
||||
v 0.1
|
||||
First version, added Functionality to DHT11 sensor
|
||||
v 0.1.1
|
||||
Optimizacion on shift var (pylon from Arduino Forum)
|
||||
*/
|
||||
|
||||
|
||||
@ -18,7 +24,7 @@
|
||||
#include <WProgram.h>
|
||||
#endif
|
||||
|
||||
#define IDDHT11LIB_VERSION "0.1"
|
||||
#define IDDHT11LIB_VERSION "0.1.1"
|
||||
|
||||
// state codes
|
||||
#define IDDHTLIB_OK 0
|
||||
@ -33,9 +39,9 @@
|
||||
#define IDDHTLIB_ERROR_DELTA -4
|
||||
#define IDDHTLIB_ERROR_NOTSTARTED -5
|
||||
|
||||
#define IDDHT11_CHECK_STATE if(state == STOPPED) \
|
||||
return status; \
|
||||
else if(state != ACQUIRED) \
|
||||
#define IDDHT11_CHECK_STATE if(state == STOPPED) \
|
||||
return status; \
|
||||
else if(state != ACQUIRED) \
|
||||
return IDDHTLIB_ERROR_ACQUIRING;
|
||||
|
||||
class idDHT11
|
||||
|
Loading…
x
Reference in New Issue
Block a user