From 7c0e98602e894be2b62e93d1b29ef1a08a87a57d Mon Sep 17 00:00:00 2001 From: Rob Tillaart Date: Mon, 30 Sep 2013 17:09:58 +0200 Subject: [PATCH] + minor fixes --- .../hmc6532/examples/queryDemo/queryDemo.pde | 2 +- .../examples/set2continuous/set2continuous.pde | 1 - .../hmc6532/examples/set2query/set2query.pde | 1 - .../hmc6532/examples/set2standby/set2standby.pde | 1 - .../hmc6532/examples/standbyDemo/standbyDemo.pde | 15 ++++++++++++--- libraries/hmc6532/hmc6352.h | 2 +- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/libraries/hmc6532/examples/queryDemo/queryDemo.pde b/libraries/hmc6532/examples/queryDemo/queryDemo.pde index 19efa48e..f838efd2 100644 --- a/libraries/hmc6532/examples/queryDemo/queryDemo.pde +++ b/libraries/hmc6532/examples/queryDemo/queryDemo.pde @@ -25,7 +25,7 @@ void setup() Serial.print("current output modus"); Serial.println(Compass.getOutputModus()); - x = Compass.askHeading(); + int x = Compass.askHeading(); //Serial.print("Ask returns: "); //Serial.println(x); } diff --git a/libraries/hmc6532/examples/set2continuous/set2continuous.pde b/libraries/hmc6532/examples/set2continuous/set2continuous.pde index ec6291ca..08197207 100644 --- a/libraries/hmc6532/examples/set2continuous/set2continuous.pde +++ b/libraries/hmc6532/examples/set2continuous/set2continuous.pde @@ -57,7 +57,6 @@ void loop() delay(10); Wire.requestFrom(HMC, 1); - i = 0; while(Wire.available() < 1); value = Wire.receive(); Serial.print("Current Mode: "); diff --git a/libraries/hmc6532/examples/set2query/set2query.pde b/libraries/hmc6532/examples/set2query/set2query.pde index 57f139b8..08cbed74 100644 --- a/libraries/hmc6532/examples/set2query/set2query.pde +++ b/libraries/hmc6532/examples/set2query/set2query.pde @@ -58,7 +58,6 @@ void loop() delay(10); Wire.requestFrom(HMC, 1); - i = 0; while(Wire.available() < 1); value = Wire.receive(); Serial.print("Current Mode: "); diff --git a/libraries/hmc6532/examples/set2standby/set2standby.pde b/libraries/hmc6532/examples/set2standby/set2standby.pde index df17a47d..7ae9f758 100644 --- a/libraries/hmc6532/examples/set2standby/set2standby.pde +++ b/libraries/hmc6532/examples/set2standby/set2standby.pde @@ -58,7 +58,6 @@ void loop() delay(10); Wire.requestFrom(HMC, 1); - i = 0; while(Wire.available() < 1); value = Wire.receive(); Serial.print("Current Mode: "); diff --git a/libraries/hmc6532/examples/standbyDemo/standbyDemo.pde b/libraries/hmc6532/examples/standbyDemo/standbyDemo.pde index a548344b..4f878d15 100644 --- a/libraries/hmc6532/examples/standbyDemo/standbyDemo.pde +++ b/libraries/hmc6532/examples/standbyDemo/standbyDemo.pde @@ -29,22 +29,31 @@ int x; void loop() { - Compass.wakeup(); // decent wake up from sleep mode + Compass.wakeUp(); // decent wake up from sleep mode // Note that reading a heading is requires two steps, ask() & read() // this makes the query and continuous mode more efficient // without impact on the footprint of the lib. - // a wrapper is an option. + // this way one can ask a make a reading and fetch it a bit later. + // TODO is it fast enough for IRQ ? x = Compass.askHeading(); //Serial.print("Ask returns: "); //Serial.println(x); x = Compass.readHeading(); - Serial.print("Degree : "); + Serial.print("ask & read : Degree : "); Serial.println(x); Compass.sleep(); // low energy mode delay(500); + + // this is the simplest mode to use the library + // suitable for 99.9% of all robots :) + Compass.wakeUp(); + Serial.print("getHeading : Degree : "); + Serial.println(Compass.getHeading()); + Compass.sleep(); + delay(500); } // END OF FILE diff --git a/libraries/hmc6532/hmc6352.h b/libraries/hmc6532/hmc6352.h index cd7bc1d8..dd33743e 100644 --- a/libraries/hmc6532/hmc6352.h +++ b/libraries/hmc6532/hmc6352.h @@ -14,7 +14,7 @@ #include "Wprogram.h" -#define HMC_LIB_VERSION "0.1.01" +#define HMC_LIB_VERSION "0.1.03" #define HMC_GET_DATA 0x41 #define HMC_WAKE 0x57