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 8:d87e11e8d012, committed 2014-07-08
- Comitter:
- Sissors
- Date:
- Tue Jul 08 18:55:54 2014 +0000
- Parent:
- 7:58b61681818f
- Child:
- 9:3821ca0b7f14
- Commit message:
- Instead of open drain use CMOS output for writing. Not according to standard, but can help for long busses. And helps with parasite powered via data pin (no external mosfet)
Changed in this revision
DS1820.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/DS1820.cpp Tue Apr 08 09:59:18 2014 +0000 +++ b/DS1820.cpp Tue Jul 08 18:55:54 2014 +0000 @@ -51,11 +51,11 @@ pin->write(0); wait_us(3); // DXP modified from 5 if (bit_data) { - pin->input(); // bring data line high + pin->write(1); // bring data line high wait_us(55); } else { wait_us(55); // keep data line low - pin->input(); + pin->write(1); wait_us(10); // DXP added to allow bus to float high before next bit_out } }