CUER version of the DS1820 library
Fork of DS1820 by
Diff: DS1820.h
- Revision:
- 1:91aa74f0cb0e
- Parent:
- 0:245af9360f0d
--- a/DS1820.h Tue Feb 28 07:42:07 2012 +0000 +++ b/DS1820.h Sun Jul 02 15:10:13 2017 +0000 @@ -99,13 +99,17 @@ DS1820(PinName data_pin); /** ROM is a copy of the internal DS1820's ROM - * It's created during the search_ROM() or search_alarm() commands + * It is created during the search_ROM() or search_alarm() commands * * ROM[0] is the Dallas Family Code * ROM[1] thru ROM[6] is the 48-bit unique serial number * ROM[7] is the device CRC */ char ROM[8]; + #define FAMILY_CODE ROM[0] + #define FAMILY_CODE_DS1820 0x10 + #define FAMILY_CODE_DS18S20 0x10 + #define FAMILY_CODE_DS18B20 0x28 /** RAM is a copy of the internal DS1820's RAM * It's updated during the read_RAM() command @@ -189,11 +193,19 @@ */ bool RAM_checksum_error(); - /** This funtion returns the values stored in the temperature + /** This function returns the values stored in the temperature * alarm registers. * * @returns a 16 bit integer of TH (upper byte) and TL (lower byte). */ + bool set_configuration_bits(unsigned int resolution); + + /** This function sets the temperature resolution for the DS18B20 + * in the configuration register. + * + * @param a number between 9 and 12 to specify the resolution + * @returns true if successful + */ int read_scratchpad(); /** This function will store the passed data into the DS1820's RAM. @@ -201,7 +213,7 @@ * during cycling the power off and on. * * @param a 16 bit integer of TH (upper byte) and TL (lower byte). - */ + */ void write_scratchpad(int data); /** This function will transfer the TH and TL registers from the @@ -211,13 +223,13 @@ * * @param allows the fnction to apply to a specific device or * to all devices on the 1-Wire bus. - */ + */ void store_scratchpad(devices device=this_device); /** This function will copy the stored values from the EEPROM * into the DS1820's RAM locations for TH and TL. * - * @param allows the fnction to apply to a specific device or + * @param allows the function to apply to a specific device or * to all devices on the 1-Wire bus. */ int recall_scratchpad(devices device=this_device); @@ -249,4 +261,4 @@ }; -#endif +#endif \ No newline at end of file