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.
Dependents: STM32F103C8T6_DS18B20 stm32f103c8t6-ds18b20
Fork of DS1820 by
Diff: DS1820.cpp
- Revision:
- 7:58b61681818f
- Parent:
- 5:2cd4928e8147
- Child:
- 8:d87e11e8d012
--- a/DS1820.cpp Wed Apr 02 19:10:34 2014 +0000 +++ b/DS1820.cpp Tue Apr 08 09:59:18 2014 +0000 @@ -353,7 +353,7 @@ read_RAM(); if (RAM_checksum_error()) // Indicate we got a CRC error - answer = -1000.0; + answer = invalid_conversion; else { reading = (RAM[1] << 8) + RAM[0]; if (reading & 0x8000) { // negative degrees C