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
25
README.md
25
README.md
@ -3,11 +3,22 @@ idDHT11
|
|||||||
|
|
||||||
Interrupt driven DHT11 library
|
Interrupt driven DHT11 library
|
||||||
|
|
||||||
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
|
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)
|
||||||
|
11
idDHT11.cpp
11
idDHT11.cpp
@ -1,11 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
FILE: idDHT11.cpp
|
FILE: idDHT11.cpp
|
||||||
VERSION: 0.1
|
VERSION: 0.1.1
|
||||||
PURPOSE: Interrupt driven Lib for DHT11 with Arduino.
|
PURPOSE: Interrupt driven Lib for DHT11 with Arduino.
|
||||||
LICENCE: GPL v3 (http://www.gnu.org/licenses/gpl.html)
|
LICENCE: GPL v3 (http://www.gnu.org/licenses/gpl.html)
|
||||||
DATASHEET: http://www.micro4you.com/files/sensor/DHT11.pdf
|
DATASHEET: http://www.micro4you.com/files/sensor/DHT11.pdf
|
||||||
|
|
||||||
Based on DHT11 library: http://playground.arduino.cc/Main/DHT11Lib
|
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"
|
#include "idDHT11.h"
|
||||||
@ -91,8 +97,9 @@ void idDHT11::isrCallback() {
|
|||||||
status = IDDHTLIB_ERROR_DELTA;
|
status = IDDHTLIB_ERROR_DELTA;
|
||||||
state = STOPPED;
|
state = STOPPED;
|
||||||
} else if(60<delta && delta<135) { //valid in timing
|
} else if(60<delta && delta<135) { //valid in timing
|
||||||
|
bits[idx] <<= 1;
|
||||||
if(delta>90) //is a one
|
if(delta>90) //is a one
|
||||||
bits[idx] |= (1 << cnt);
|
bits[idx] |= 1;
|
||||||
if (cnt == 0) { // whe have fullfilled the byte, go to next
|
if (cnt == 0) { // whe have fullfilled the byte, go to next
|
||||||
cnt = 7; // restart at MSB
|
cnt = 7; // restart at MSB
|
||||||
if(idx++ == 4) { // go to next byte, if whe have got 5 bytes stop.
|
if(idx++ == 4) { // go to next byte, if whe have got 5 bytes stop.
|
||||||
|
18
idDHT11.h
18
idDHT11.h
@ -1,11 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
FILE: idDHT11.h
|
FILE: idDHT11.h
|
||||||
VERSION: 0.1
|
VERSION: 0.1.1
|
||||||
PURPOSE: Interrupt driven Lib for DHT11 with Arduino.
|
PURPOSE: Interrupt driven Lib for DHT11 with Arduino.
|
||||||
LICENCE: GPL v3 (http://www.gnu.org/licenses/gpl.html)
|
LICENCE: GPL v3 (http://www.gnu.org/licenses/gpl.html)
|
||||||
DATASHEET: http://www.micro4you.com/files/sensor/DHT11.pdf
|
DATASHEET: http://www.micro4you.com/files/sensor/DHT11.pdf
|
||||||
|
|
||||||
Based on DHT11 library: http://playground.arduino.cc/Main/DHT11Lib
|
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>
|
#include <WProgram.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define IDDHT11LIB_VERSION "0.1"
|
#define IDDHT11LIB_VERSION "0.1.1"
|
||||||
|
|
||||||
// state codes
|
// state codes
|
||||||
#define IDDHTLIB_OK 0
|
#define IDDHTLIB_OK 0
|
||||||
@ -33,9 +39,9 @@
|
|||||||
#define IDDHTLIB_ERROR_DELTA -4
|
#define IDDHTLIB_ERROR_DELTA -4
|
||||||
#define IDDHTLIB_ERROR_NOTSTARTED -5
|
#define IDDHTLIB_ERROR_NOTSTARTED -5
|
||||||
|
|
||||||
#define IDDHT11_CHECK_STATE if(state == STOPPED) \
|
#define IDDHT11_CHECK_STATE if(state == STOPPED) \
|
||||||
return status; \
|
return status; \
|
||||||
else if(state != ACQUIRED) \
|
else if(state != ACQUIRED) \
|
||||||
return IDDHTLIB_ERROR_ACQUIRING;
|
return IDDHTLIB_ERROR_ACQUIRING;
|
||||||
|
|
||||||
class idDHT11
|
class idDHT11
|
||||||
|
Loading…
x
Reference in New Issue
Block a user