A cut-down version of https://os.mbed.com/users/Sissors/code/DS1820/ tweaked for use with the STM32F103. It is all generic Mbed operations though, so should be usable anywhere. Non-essential functions have been removed, as this is intended for use within a tutorial.

Dependencies:   LinkedList

Dependents:   STM32F103C8T6_DS18B20 stm32f103c8t6-ds18b20

Fork of DS1820 by Erik -

Revision:
16:d490e11c466d
Parent:
11:1a3c3002b50c
--- a/DS1820.h	Sun Jan 08 17:26:21 2017 +0000
+++ b/DS1820.h	Thu Jan 11 04:37:42 2018 +0000
@@ -60,26 +60,12 @@
     };
 
     /** Create a probe object connected to the specified pins
-    *
-    * The probe might either by regular powered or parasite powered. If it is parasite
-    * powered and power_pin is set, that pin will be used to switch an external mosfet connecting
-    * data to Vdd. If it is parasite powered and the pin is not set, the regular data pin
-    * is used to supply extra power when required. This will be sufficient as long as the 
-    * number of probes is limitted.
      *
      * @param data_pin DigitalInOut pin for the data bus
-     * @param power_pin DigitalOut (optional) pin to control the power MOSFET
-     * @param power_polarity bool (optional) which sets active state (0 for active low (default), 1 for active high)
      */
-    DS1820(PinName data_pin, PinName power_pin = NC, bool power_polarity = 0); // Constructor with parasite power pin
+    DS1820(PinName data_pin);
     ~DS1820();
 
-    /** Function to see if there are DS1820 devices left on a pin which do not have a corresponding DS1820 object
-    *
-    * @return - true if there are one or more unassigned devices, otherwise false
-      */
-    static bool unassignedProbe(PinName pin);
-
     /** This routine will initiate the temperature conversion within
       * one or all DS1820 probes. 
       *
@@ -108,28 +94,23 @@
     bool setResolution(unsigned int resolution);       
 
 private:
-    bool _parasite_power;
-    bool _power_mosfet;
-    bool _power_polarity;
-    
+   
     static char CRC_byte(char _CRC, char byte );
-    static bool onewire_reset(DigitalInOut *pin);
+    bool onewire_reset();
     void match_ROM();
     void skip_ROM();
-    static bool search_ROM_routine(DigitalInOut *pin, char command, char *ROM_address);
-    static void onewire_bit_out (DigitalInOut *pin, bool bit_data);
+    bool search_ROM_routine(char command, char *ROM_address);
+    void onewire_bit_out (bool bit_data);
     void onewire_byte_out(char data);
-    static bool onewire_bit_in(DigitalInOut *pin);
+    bool onewire_bit_in();
     char onewire_byte_in();
     static bool ROM_checksum_error(char *_ROM_address);
     bool RAM_checksum_error();
     void read_RAM();
-    static bool unassignedProbe(DigitalInOut *pin, char *ROM_address);
+    bool unassignedProbe(char *ROM_address);
     void write_scratchpad(int data);
-    bool read_power_supply(devices device=this_device);
 
     DigitalInOut _datapin;
-    DigitalOut _parasitepin;
     
     char _ROM[8];
     char RAM[9];