Working version for L-tek FF1705
Revision 14:b02fa18b294a, committed 2019-01-20
- Comitter:
- hudakz
- Date:
- Sun Jan 20 10:11:31 2019 +0000
- Parent:
- 13:b593a82ce790
- Child:
- 15:ad7c914296fb
- Commit message:
- Improved One-Wire.
Changed in this revision
--- a/DS1820.cpp Wed Oct 28 18:05:51 2015 +0000
+++ b/DS1820.cpp Sun Jan 20 10:11:31 2019 +0000
@@ -320,7 +320,7 @@
*p_word = *p_word &~1; // 11bit resolution, max conversion time = 375ms
// Convert the raw bytes to a 16bit signed fixed point value :
- // 1 sign bit, 7 integer bits, 8 fractional bits (two's compliment
+ // 1 sign bit, 7 integer bits, 8 fractional bits (two's complement
// and the LSB of the 16bit binary number represents 1/256th of a unit).
*p_word = *p_word << 4;
// Convert to floating point value
@@ -336,7 +336,7 @@
* @brief Converts a 16-bit signed fixed point value to floating point value
* @note The 16-bit unsigned integer represnts actually
* a 16-bit signed fixed point value:
- * 1 sign bit, 7 integer bits, 8 fractional bits (two’s compliment
+ * 1 sign bit, 7 integer bits, 8 fractional bits (two’s complement
* and the LSB of the 16-bit binary number represents 1/256th of a unit).
* @param 16-bit unsigned integer
* @retval Floating point value
--- a/DS1820.h Wed Oct 28 18:05:51 2015 +0000
+++ b/DS1820.h Sun Jan 20 10:11:31 2019 +0000
@@ -3,6 +3,39 @@
#include <OneWire.h>
+/**
+ * Dallas' DS1820 family temperature sensor.
+ * This library depends on the OneWire library (Dallas' 1-Wire bus protocol implementation)
+ * available at <http://developer.mbed.org/users/hudakz/code/OneWire/>
+ *
+ * Example of use:
+ *
+ * @code
+ * #include "DS1820.h"
+ *
+ * Serial serial(USBTX, USBRX);
+ *
+ * int main() {
+ * DS1820 ds1820(PA_9); // substitute PA_9 with actual mbed pin name connected to the DS1820 data pin
+ *
+ * if(ds1820.begin()) {
+ * ds1820.startConversion();
+ * wait(1.0);
+ * while(1) {
+ * serial.printf("temp = %3.1f\r\n", ds1820.read()); // read temperature
+ * ds1820.startConversion(); // start temperature conversion
+ * wait(1.0); // let DS1820 complete the temperature conversion
+ * }
+ * } else
+ * serial.printf("No DS1820 sensor found!\r\n");
+ * }
+ *
+ * @endcode
+ *
+ * Note: Don't forget to connect a 4.7k Ohm resistor
+ * between the DS1820's data pin and the +3.3V pin
+ *
+ */
class DS1820
{
OneWire oneWire;
--- a/OneWire.lib Wed Oct 28 18:05:51 2015 +0000 +++ b/OneWire.lib Sun Jan 20 10:11:31 2019 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/users/hudakz/code/OneWire/#ca126d554161 +http://developer.mbed.org/users/hudakz/code/OneWire/#d6e084297fb9