OneWire Library lets you access 1-wire devices made by Maxim/Dallas, such as temperature sensors

Dependents:   OneWireTest mbed_blinky Affich_Lum_Moist Projetv0 ... more

#include "mbed.h"
#include "OneWire.h"

OneWire owBus(p21);

int main()
{
    char _id[16];
    DeviceAddresses* devAddresses = owBus.getFoundDevAddresses();
    uint8_t foundNum = owBus.getFoundDevNum();
    printf("OneWire: found %d devices\r\n", foundNum);

    while(1) {
        OneWireDeviceTemperature::startConversationForAll(&owBus, OWTEMP_11_BIT);
        for (uint8_t i = 0; i < foundNum; i++) {
            OneWireDevice* owDevice = OneWireDeviceFactory::init(&owBus, (*devAddresses)[i]);
            
            if (owDevice->getFamily() != ONEWIRE_DS18B20_FAMILY)    // currently only DS18B20 supports
                continue;

            owDevice->generateId(_id);
            printf("OneWire: device #%s = %.4f*C\r\n", _id, (float) owDevice->sendGetCommand(GET_TEMPERATURE));
            delete owDevice;            
        }
        
        wait(5);
    }
 }

Files at this revision

API Documentation at this revision

Comitter:
ivank
Date:
Tue Dec 18 12:12:21 2012 +0000
Parent:
2:07da4deb7135
Commit message:
- moved .h files to '_headers' folders; - added MIT License to all files

Changed in this revision

OneWire.h Show diff for this revision Revisions of this file
OneWireDevice.cpp Show annotated file Show diff for this revision Revisions of this file
OneWireDevice.h Show diff for this revision Revisions of this file
OneWireDeviceFactory.cpp Show annotated file Show diff for this revision Revisions of this file
OneWireDeviceFactory.h Show diff for this revision Revisions of this file
OneWireDeviceTemperature.cpp Show annotated file Show diff for this revision Revisions of this file
OneWireDeviceTemperature.h Show diff for this revision Revisions of this file
_headers/OneWire.h Show annotated file Show diff for this revision Revisions of this file
_headers/OneWireDevice.h Show annotated file Show diff for this revision Revisions of this file
_headers/OneWireDeviceFactory.h Show annotated file Show diff for this revision Revisions of this file
_headers/OneWireDeviceTemperature.h Show annotated file Show diff for this revision Revisions of this file
devices/ds18b20.cpp Show annotated file Show diff for this revision Revisions of this file
devices/ds18b20.h Show annotated file Show diff for this revision Revisions of this file
diff -r 07da4deb7135 -r 7bd102cb73e0 OneWire.h
--- a/OneWire.h	Tue Dec 18 11:40:28 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-#ifndef ONEWIRE_H
-#define ONEWIRE_H
-
-#include "mbed.h"
-
-#define FALSE 0
-#define TRUE 1
-
-#define ONEWIRE_DS18B20_FAMILY 0x28
-
-enum OneWireDeviceCmd {
-    SET_TEMPERATURE_RESOLUTION = 0,
-    GET_TEMPERATURE
-};
-
-typedef uint8_t DeviceAddress[8];
-typedef DeviceAddress*  DeviceAddresses;
-
-class OneWire {
-public:
-    OneWire(PinName pin);
-
-    uint8_t reset(void);
-    uint8_t readByte(void);
-    void writeByte(uint8_t val);
-    void select(uint8_t* devAddr);
-    void resetSearch(void);
-
-    uint8_t search(uint8_t* devAddr);
-    void sendGlobalCommand(uint8_t);
-    DeviceAddresses* getFoundDevAddresses();
-    uint8_t getFoundDevNum();
-
-private:
-    DigitalInOut DIO;
-    static const uint8_t dscrc_table[];
-
-    DeviceAddresses* foundDevAdresses;
-    uint8_t foundDevNum;
-
-    uint8_t lastDiscrep;
-    uint8_t doneFlag;
-    uint8_t dowcrc;
-
-    uint8_t readBit(void);
-    void writeBit(uint8_t bitval);
-
-    void skip();
-    uint8_t calcCRC(uint8_t x);
-    void findDevAddresses(void);
-};
-
-#include "OneWireDevice.h"
-
-#endif
\ No newline at end of file
diff -r 07da4deb7135 -r 7bd102cb73e0 OneWireDevice.cpp
--- a/OneWireDevice.cpp	Tue Dec 18 11:40:28 2012 +0000
+++ b/OneWireDevice.cpp	Tue Dec 18 12:12:21 2012 +0000
@@ -1,3 +1,21 @@
+/* Copyright (c) 2012, Ivan Kravets <me@ikravets.com>, www.ikravets.com. MIT License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute,
+ * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or
+ * substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
+ * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #include "OneWireDevice.h"
 
 OneWireDevice::OneWireDevice(OneWire* ow, DeviceAddress devAddr)
diff -r 07da4deb7135 -r 7bd102cb73e0 OneWireDevice.h
--- a/OneWireDevice.h	Tue Dec 18 11:40:28 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-#ifndef ONEWIREDEVICE_H
-#define ONEWIREDEVICE_H
-
-#include "OneWire.h"
-
-class OneWireDevice {
-public:
-    OneWireDevice(OneWire* ow, DeviceAddress devAddr);
-    //~OneWireDevice();
-    void generateId(char* id);
-    uint8_t getFamily();
-
-    virtual void sendSetCommand(OneWireDeviceCmd cmd, uint8_t data) {};
-    virtual float sendGetCommand(OneWireDeviceCmd cmd) {
-        return 0;
-    };
-
-protected:
-    OneWire* owBus;
-    DeviceAddress address;
-};
-
-#include "OneWireDeviceFactory.h"
-#include "OneWireDeviceTemperature.h"
-
-#endif 
\ No newline at end of file
diff -r 07da4deb7135 -r 7bd102cb73e0 OneWireDeviceFactory.cpp
--- a/OneWireDeviceFactory.cpp	Tue Dec 18 11:40:28 2012 +0000
+++ b/OneWireDeviceFactory.cpp	Tue Dec 18 12:12:21 2012 +0000
@@ -1,3 +1,21 @@
+/* Copyright (c) 2012, Ivan Kravets <me@ikravets.com>, www.ikravets.com. MIT License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute,
+ * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or
+ * substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
+ * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #include "OneWireDeviceFactory.h"
 
 OneWireDevice* OneWireDeviceFactory::init(OneWire* ow, DeviceAddress address)
diff -r 07da4deb7135 -r 7bd102cb73e0 OneWireDeviceFactory.h
--- a/OneWireDeviceFactory.h	Tue Dec 18 11:40:28 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-#ifndef ONEWIREDEVICEFACTORY_H
-#define ONEWIREDEVICEFACTORY_H
-
-#include "OneWireDevice.h"
-
-class OneWireDeviceFactory {
-public:
-    static OneWireDevice* init(OneWire* owBus, DeviceAddress address);
-};
-
-#endif
\ No newline at end of file
diff -r 07da4deb7135 -r 7bd102cb73e0 OneWireDeviceTemperature.cpp
--- a/OneWireDeviceTemperature.cpp	Tue Dec 18 11:40:28 2012 +0000
+++ b/OneWireDeviceTemperature.cpp	Tue Dec 18 12:12:21 2012 +0000
@@ -1,3 +1,21 @@
+/* Copyright (c) 2012, Ivan Kravets <me@ikravets.com>, www.ikravets.com. MIT License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute,
+ * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or
+ * substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
+ * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #include "OneWireDeviceTemperature.h"
 
 void OneWireDeviceTemperature::startConversationForAll(OneWire* owBus, uint8_t resolution)
diff -r 07da4deb7135 -r 7bd102cb73e0 OneWireDeviceTemperature.h
--- a/OneWireDeviceTemperature.h	Tue Dec 18 11:40:28 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-#ifndef ONEWIREDEVTEMP_H
-#define ONEWIREDEVTEMP_H
-
-#include "OneWireDevice.h"
-
-class OneWireDeviceTemperature : public OneWireDevice {
-public:
-    OneWireDeviceTemperature(OneWire* ow, DeviceAddress address) : OneWireDevice(ow, address) {};
-    //static setResolutionForAll
-    static void startConversationForAll(OneWire* owBus, uint8_t resolution);
-};
-
-#include "devices/ds18b20.h"
-
-#endif
\ No newline at end of file
diff -r 07da4deb7135 -r 7bd102cb73e0 _headers/OneWire.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/_headers/OneWire.h	Tue Dec 18 12:12:21 2012 +0000
@@ -0,0 +1,73 @@
+/* Copyright (c) 2012, Ivan Kravets <me@ikravets.com>, www.ikravets.com. MIT License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute,
+ * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or
+ * substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
+ * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+ 
+#ifndef ONEWIRE_H
+#define ONEWIRE_H
+
+#include "mbed.h"
+
+#define FALSE 0
+#define TRUE 1
+
+#define ONEWIRE_DS18B20_FAMILY 0x28
+
+enum OneWireDeviceCmd {
+    SET_TEMPERATURE_RESOLUTION = 0,
+    GET_TEMPERATURE
+};
+
+typedef uint8_t DeviceAddress[8];
+typedef DeviceAddress*  DeviceAddresses;
+
+class OneWire {
+public:
+    OneWire(PinName pin);
+
+    uint8_t reset(void);
+    uint8_t readByte(void);
+    void writeByte(uint8_t val);
+    void select(uint8_t* devAddr);
+    void resetSearch(void);
+
+    uint8_t search(uint8_t* devAddr);
+    void sendGlobalCommand(uint8_t);
+    DeviceAddresses* getFoundDevAddresses();
+    uint8_t getFoundDevNum();
+
+private:
+    DigitalInOut DIO;
+    static const uint8_t dscrc_table[];
+
+    DeviceAddresses* foundDevAdresses;
+    uint8_t foundDevNum;
+
+    uint8_t lastDiscrep;
+    uint8_t doneFlag;
+    uint8_t dowcrc;
+
+    uint8_t readBit(void);
+    void writeBit(uint8_t bitval);
+
+    void skip();
+    uint8_t calcCRC(uint8_t x);
+    void findDevAddresses(void);
+};
+
+#include "OneWireDevice.h"
+
+#endif
\ No newline at end of file
diff -r 07da4deb7135 -r 7bd102cb73e0 _headers/OneWireDevice.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/_headers/OneWireDevice.h	Tue Dec 18 12:12:21 2012 +0000
@@ -0,0 +1,44 @@
+/* Copyright (c) 2012, Ivan Kravets <me@ikravets.com>, www.ikravets.com. MIT License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute,
+ * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or
+ * substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
+ * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+ 
+#ifndef ONEWIREDEVICE_H
+#define ONEWIREDEVICE_H
+
+#include "OneWire.h"
+
+class OneWireDevice {
+public:
+    OneWireDevice(OneWire* ow, DeviceAddress devAddr);
+    //~OneWireDevice();
+    void generateId(char* id);
+    uint8_t getFamily();
+
+    virtual void sendSetCommand(OneWireDeviceCmd cmd, uint8_t data) {};
+    virtual float sendGetCommand(OneWireDeviceCmd cmd) {
+        return 0;
+    };
+
+protected:
+    OneWire* owBus;
+    DeviceAddress address;
+};
+
+#include "OneWireDeviceFactory.h"
+#include "OneWireDeviceTemperature.h"
+
+#endif 
\ No newline at end of file
diff -r 07da4deb7135 -r 7bd102cb73e0 _headers/OneWireDeviceFactory.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/_headers/OneWireDeviceFactory.h	Tue Dec 18 12:12:21 2012 +0000
@@ -0,0 +1,29 @@
+/* Copyright (c) 2012, Ivan Kravets <me@ikravets.com>, www.ikravets.com. MIT License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute,
+ * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or
+ * substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
+ * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef ONEWIREDEVICEFACTORY_H
+#define ONEWIREDEVICEFACTORY_H
+
+#include "OneWireDevice.h"
+
+class OneWireDeviceFactory {
+public:
+    static OneWireDevice* init(OneWire* owBus, DeviceAddress address);
+};
+
+#endif
\ No newline at end of file
diff -r 07da4deb7135 -r 7bd102cb73e0 _headers/OneWireDeviceTemperature.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/_headers/OneWireDeviceTemperature.h	Tue Dec 18 12:12:21 2012 +0000
@@ -0,0 +1,33 @@
+/* Copyright (c) 2012, Ivan Kravets <me@ikravets.com>, www.ikravets.com. MIT License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute,
+ * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or
+ * substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
+ * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef ONEWIREDEVTEMP_H
+#define ONEWIREDEVTEMP_H
+
+#include "OneWireDevice.h"
+
+class OneWireDeviceTemperature : public OneWireDevice {
+public:
+    OneWireDeviceTemperature(OneWire* ow, DeviceAddress address) : OneWireDevice(ow, address) {};
+    //static setResolutionForAll
+    static void startConversationForAll(OneWire* owBus, uint8_t resolution);
+};
+
+#include "devices/ds18b20.h"
+
+#endif
\ No newline at end of file
diff -r 07da4deb7135 -r 7bd102cb73e0 devices/ds18b20.cpp
--- a/devices/ds18b20.cpp	Tue Dec 18 11:40:28 2012 +0000
+++ b/devices/ds18b20.cpp	Tue Dec 18 12:12:21 2012 +0000
@@ -1,3 +1,21 @@
+/* Copyright (c) 2012, Ivan Kravets <me@ikravets.com>, www.ikravets.com. MIT License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute,
+ * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or
+ * substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
+ * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #include "ds18b20.h"
 
 void OneWireDeviceDS18B20::sendSetCommand(OneWireDeviceCmd cmd, uint8_t data) {
diff -r 07da4deb7135 -r 7bd102cb73e0 devices/ds18b20.h
--- a/devices/ds18b20.h	Tue Dec 18 11:40:28 2012 +0000
+++ b/devices/ds18b20.h	Tue Dec 18 12:12:21 2012 +0000
@@ -1,3 +1,21 @@
+/* Copyright (c) 2012, Ivan Kravets <me@ikravets.com>, www.ikravets.com. MIT License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute,
+ * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or
+ * substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
+ * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
 #ifndef DS18B20_H
 #define DS18B20_H