6°A PIO IX TP1. Ejercicio 1. ALMADA, Santiago MAVER, Francisco
Dependencies: LinkedList
Diff: DS1820.h
- Revision:
- 1:6a427f54e82c
- Parent:
- 0:61d83318f2d6
- Child:
- 2:ee820a991b95
--- a/DS1820.h Sun Dec 19 05:40:28 2010 +0000 +++ b/DS1820.h Wed Dec 14 20:22:16 2011 +0000 @@ -106,6 +106,10 @@ * 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. @@ -217,7 +229,7 @@ /** 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);