Skip to content

Commit

Permalink
Updated examples for use with current Particle IDE and Local build
Browse files Browse the repository at this point in the history
  • Loading branch information
piettetech committed Sep 25, 2016
1 parent e62f34b commit 5e1507c
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 21 deletions.
5 changes: 3 additions & 2 deletions firmware/PietteTech_DHT.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/*
* FILE: PietteTech_DHT.cpp
* VERSION: 0.3
* VERSION: 0.4
* PURPOSE: Spark Interrupt driven lib for DHT sensors
* LICENSE: GPL v3 (http://www.gnu.org/licenses/gpl.html)
*
* S Piette (Piette Technologies) scott.piette@gmail.com
* January 2014 Original Spark Port
* October 2014 Added support for DHT21/22 sensors
* Improved timing, moved FP math out of ISR
* September 2016 Updated for Particle
*
* Based on adaptation by niesteszeck (github/niesteszeck)
* Based on original DHT11 library (http://playgroudn.adruino.cc/Main/DHT11Lib)
Expand Down Expand Up @@ -133,7 +134,7 @@ int PietteTech_DHT::acquire() {
return DHTLIB_ERROR_ACQUIRING;
}

int PietteTech_DHT::acquireAndWait(uint32_t timeout=0) {
int PietteTech_DHT::acquireAndWait(uint32_t timeout) {
acquire();
uint32_t start = millis();
uint32_t wrapper;
Expand Down
7 changes: 4 additions & 3 deletions firmware/PietteTech_DHT.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/*
* FILE: PietteTech_DHT.h
* VERSION: 0.3
* VERSION: 0.4
* PURPOSE: Spark Interrupt driven lib for DHT sensors
* LICENSE: GPL v3 (http://www.gnu.org/licenses/gpl.html)
*
* S Piette (Piette Technologies) scott.piette@gmail.com
* January 2014 Original Spark Port
* October 2014 Added support for DHT21/22 sensors
* Improved timing, moved FP math out of ISR
* September 2016 Updated for Particle
*
* Based on adaptation by niesteszeck (github/niesteszeck)
* Based on original DHT11 library (http://playgroudn.adruino.cc/Main/DHT11Lib)
Expand All @@ -27,7 +28,7 @@

#include "application.h"

#define DHTLIB_VERSION "0.3"
#define DHTLIB_VERSION "0.4"

// device types
#define DHT11 11
Expand Down Expand Up @@ -65,7 +66,7 @@ class PietteTech_DHT
void begin(uint8_t sigPin, uint8_t dht_type, void (*isrCallback_wrapper)());
void isrCallback();
int acquire();
int acquireAndWait(uint32_t);
int acquireAndWait(uint32_t timeout = 0);
float getCelsius();
float getFahrenheit();
float getKelvin();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* FILE: DHT_2sensor.ino
* VERSION: 0.3
* FILE: DHT_2sensor.cpp
* VERSION: 0.4
* PURPOSE: Example that uses DHT library with two sensors
* LICENSE: GPL v3 (http://www.gnu.org/licenses/gpl.html)
*
Expand All @@ -12,11 +12,13 @@
* January 2014 Original Spark Port
* October 2014 Added support for DHT21/22 sensors
* Improved timing, moved FP math out of ISR
* September 2016 Updated for Particle
*/
// NOTE DHT_REPORT_TIMING requires DHT_DEBUG_TIMING in PietteTech_DHT.h for debugging edge->edge timings
//#define DHT_REPORT_TIMING

#include "PietteTech_DHT/PietteTech_DHT.h"
#include "PietteTech_DHT/PietteTech_DHT.h" // Uncomment if building in IDE
//#include "PietteTech_DHT.h" // Uncomment if building using CLI

#define DHTTYPEA DHT22 // Sensor type DHT11/21/22/AM2301/AM2302
#define DHTPINA 3 // Digital pin for comunications
Expand Down Expand Up @@ -58,6 +60,7 @@ void setup()
Serial.begin(9600);
while (!Serial.available()) {
Serial.println("Press any key to start.");
Particle.process();
delay (1000);
}
Serial.println("DHT Example program using 2 DHT sensors");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* FILE: DHT_example.ino
* VERSION: 0.3
* FILE: DHT_example.cpp
* VERSION: 0.4
* PURPOSE: Example that uses DHT library with two sensors
* LICENSE: GPL v3 (http://www.gnu.org/licenses/gpl.html)
*
Expand All @@ -14,9 +14,11 @@
* January 2014 Original Spark Port
* October 2014 Added support for DHT21/22 sensors
* Improved timing, moved FP math out of ISR
* September 2016 Updated for Particle
*/

#include "PietteTech_DHT/PietteTech_DHT.h"
#include "PietteTech_DHT/PietteTech_DHT.h" // Uncomment if building in IDE
//#include "PietteTech_DHT.h" // Uncomment if building using CLI

// system defines
#define DHTTYPE DHT22 // Sensor type DHT11/21/22/AM2301/AM2302
Expand All @@ -39,6 +41,7 @@ void setup()
Serial.begin(9600);
while (!Serial.available()) {
Serial.println("Press any key to start.");
Particle.process();
delay (1000);
}
Serial.println("DHT Example program using DHT.acquire and DHT.aquiring");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* FILE: DHT_simple.ino
* VERSION: 0.3
* FILE: DHT_simple.cpp
* VERSION: 0.4
* PURPOSE: Example that uses DHT library with two sensors
* LICENSE: GPL v3 (http://www.gnu.org/licenses/gpl.html)
*
Expand All @@ -11,13 +11,14 @@
* January 2014 Original Spark Port
* October 2014 Added support for DHT21/22 sensors
* Improved timing, moved FP math out of ISR
* September 2016 Updated for Particle
*/

#include "PietteTech_DHT/PietteTech_DHT.h" // Uncomment if building in IDE
//#include "PietteTech_DHT.h" // Uncommend if building using CLI
//#include "PietteTech_DHT.h" // Uncomment if building using CLI

#define DHTTYPE DHT22 // Sensor type DHT11/21/22/AM2301/AM2302
#define DHTPIN 2 // Digital pin for communications
#define DHTPIN 3 // Digital pin for communications

//declaration
void dht_wrapper(); // must be declared before the lib initialization
Expand All @@ -31,6 +32,7 @@ void setup()
Serial.begin(9600);
while (!Serial.available()) {
Serial.println("Press any key to start.");
Particle.process();
delay (1000);
}
Serial.println("DHT Example program using DHT.acquireAndWait");
Expand Down
6 changes: 6 additions & 0 deletions particle.include
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
firmware/PietteTech_DHT.cpp
firmware/PietteTech_DHT.h
firmware/examples/DHT_simple.cpp
#firmware/examples/DHT_example.cpp
#firmware/examples/DHT_2sensor.cpp

6 changes: 0 additions & 6 deletions spark.include

This file was deleted.

0 comments on commit 5e1507c

Please sign in to comment.