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 -

Files at this revision

API Documentation at this revision

Comitter:
deece
Date:
Thu Jan 25 07:33:48 2018 +0000
Parent:
17:045f96704cc6
Commit message:
Fix timings

Changed in this revision

DS1820.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 045f96704cc6 -r b9d69bad8185 DS1820.cpp
--- a/DS1820.cpp	Fri Jan 12 00:38:01 2018 +0000
+++ b/DS1820.cpp	Thu Jan 25 07:33:48 2018 +0000
@@ -15,8 +15,6 @@
 DS1820::DS1820 (PinName data_pin) : _datapin(data_pin) {
     int byte_counter;
     
-    tracer = 1;
-
     for(byte_counter=0;byte_counter<9;byte_counter++)
         RAM[byte_counter] = 0x00;
     
@@ -61,7 +59,7 @@
          wait_us(57);            // keep data line low
     }
     onewire_input(_datapin);
-    wait_us(50);
+    wait_us(60);
 }
  
 void DS1820::onewire_byte_out(char data) { // output data character (least sig bit first).