Yet another DS1820 lib, but this one is make in sweat of struggling with other ones. It's a fork really of <insert original as mbed doesn't track idk why> with *added capability* of not blocking.
Diff: DS1820.h
- Revision:
- 1:1020ba9ab5d2
- Parent:
- 0:3968e3a2e047
--- a/DS1820.h Wed Aug 30 21:15:06 2017 +0000 +++ b/DS1820.h Sat Sep 02 20:13:38 2017 +0000 @@ -168,7 +168,7 @@ * @param allows the fnction to apply to a specific device or * to all devices on the 1-Wire bus. */ - void convert_temperature(devices device=this_device); + void convert_temperature(bool blocking = false, devices device=this_device); /** This function will return the probe temperature. This function * uses the count remainding values to interpolate the temperature @@ -247,8 +247,9 @@ void enable_auto_convert(float interval); private: + Timeout auto_get_new_temperature; + Ticker _autoConvert; bool _parasite_power; - Ticker _autoConvert; bool _autoConvertEnabled; char CRC_byte (char xCRC, char byte ); bool onewire_reset(); @@ -259,10 +260,10 @@ void onewire_byte_out(char data); bool onewire_bit_in(); char onewire_byte_in(); - void _temperature(); + void _temperature_raw(); void _auto_convert_temperature(); float _last_temperature; - + protected: DigitalInOut _datapin; DigitalOut _parasitepin;