Digital Thermometer and Memory
Revision 4:61eb7429c086, committed 2018-02-06
- Comitter:
- mcm
- Date:
- Tue Feb 06 11:12:40 2018 +0000
- Parent:
- 3:3a26cd3cd594
- Commit message:
- The driver was completed and tested, it works as expected ( NUCLEO-L152RE platform was used for test )
Changed in this revision
DS1624.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/DS1624.h Tue Feb 06 11:04:44 2018 +0000 +++ b/DS1624.h Tue Feb 06 11:12:40 2018 +0000 @@ -4,13 +4,13 @@ * Header file. * * - * @return NA + * @return N/A * * @author Manuel Caballero * @date 31/January/2018 * @version 31/January/2018 The ORIGIN - * @pre NaN. - * @warning NaN + * @pre N/A. + * @warning N/A * @pre This code belongs to AqueronteBlog ( http://unbarquero.blogspot.com ). */ #ifndef DS1624_H @@ -45,12 +45,29 @@ int main() { - uint32_t myTimeoOut = 0; + char myDataInEEPROM[] = { 0x23, 0x23, 0x23 }; + uint32_t myTimeoOut = 0; pc.baud ( 115200 ); // Configure 1SHOT mode aux = myDS1624.DS1624_SetConversionMode ( DS1624::ACCESS_CONFIG_1SHOT_ONE_TEMPERATURE_CONVERSION ); + wait_ms ( 50 ); + + // Write myDataInEEPROM into EEPROM memory ( address: 0x33 ) + aux = myDS1624.DS1624_WriteBytesEEPROM ( 0x33, myDataInEEPROM, sizeof( myDataInEEPROM )/sizeof( myDataInEEPROM[0] ) ); + wait_ms ( 50 ); + + // Read EEPROM memory ( address: 0x33 ), just to check if the data was stored correctly + myDataInEEPROM[0] = 0; + myDataInEEPROM[1] = 0; + myDataInEEPROM[2] = 0; + + aux = myDS1624.DS1624_ReadBytesEEPROM ( 0x33, &myDataInEEPROM[0], sizeof( myDataInEEPROM )/sizeof( myDataInEEPROM[0] ) ); + + pc.printf( "DataEEPROM[0]: %x\nDataEEPROM[1]: %x\nDataEEPROM[2]: %x\n\r\n", myDataInEEPROM[0], myDataInEEPROM[1], myDataInEEPROM[2] ); + + newReading.attach( &changeDATA, 1 ); // the address of the function to be attached ( changeDATA ) and the interval ( 1s )