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:
- 4:29264b0a2c9f
- Parent:
- 3:8f2b7f4940b5
- Child:
- 5:2cd4928e8147
--- a/DS1820.cpp Thu Aug 01 10:18:17 2013 +0000 +++ b/DS1820.cpp Wed Aug 07 11:02:10 2013 +0000 @@ -151,7 +151,10 @@ if (ROM_bit_index != 0xFF) { for(byte_counter=0;byte_counter<8;byte_counter++) ROM[byte_counter] = DS1820_search_ROM[byte_counter]; - return_value = true; + if (ROM_checksum_error()) // Check the CRC + DS1820_last_descrepancy = 0; // Abort any more search + else + return_value = true; } } if (DS1820_last_descrepancy == 0)