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
Revision 9:3821ca0b7f14, committed 2015-01-29
- Comitter:
- florian
- Date:
- Thu Jan 29 19:27:32 2015 +0000
- Parent:
- 8:d87e11e8d012
- Child:
- 10:d297ce9ce422
- Commit message:
- suppress a bug uninitialized variable
Changed in this revision
DS1820.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/DS1820.cpp Tue Jul 08 18:55:54 2014 +0000 +++ b/DS1820.cpp Thu Jan 29 19:27:32 2015 +0000 @@ -6,8 +6,8 @@ DS1820::DS1820 (PinName data_pin, PinName power_pin, bool power_polarity) : _datapin(data_pin), _parasitepin(power_pin) { int byte_counter; _power_polarity = power_polarity; - if (power_pin != NC) - _power_mosfet = true; + + _power_mosfet = power_pin != NC; for(byte_counter=0;byte_counter<9;byte_counter++) RAM[byte_counter] = 0x00;