Subversion Repositories HomeAutomation

Rev

Rev 1446 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1446 Rev 1557
Line 7... Line 7...
7
{
7
{
8
    {
8
    {
9
        ///TODO: Define initialization values on the EEPROM variables here, this will generate a *.eep file that can be used to store this values to the node, can in future be done with a EEPROM module and the make-scrips. Write the values in the exact same order as the struct is defined in the *.h file.
9
        ///TODO: Define initialization values on the EEPROM variables here, this will generate a *.eep file that can be used to store this values to the node, can in future be done with a EEPROM module and the make-scrips. Write the values in the exact same order as the struct is defined in the *.h file.
10
        0xAB,   // x
10
        0xAB,       // x
11
        0x1234  // y
11
        0x1234      // y
-
 
12
        0x12345678  // z
12
    },
13
    },
13
    0   // crc, must be a correct value, but this will also be handled by the EEPROM module or make scripts
14
    0   // crc, must be a correct value, but this will also be handled by the EEPROM module or make scripts
14
};
15
};
15
#endif
16
#endif
16
 
17
 
Line 20... Line 21...
20
    if (EEDATA_OK)
21
    if (EEDATA_OK)
21
    {
22
    {
22
      ///TODO: Use stored data to set initial values for the module
23
      ///TODO: Use stored data to set initial values for the module
23
      blablaX = eeprom_read_byte(EEDATA.x);
24
      blablaX = eeprom_read_byte(EEDATA.x);
24
      blablaY = eeprom_read_word(EEDATA16.y);
25
      blablaY = eeprom_read_word(EEDATA16.y);
-
 
26
      blablaZ = eeprom_read_dword(EEDATA32.y);
25
    } else
27
    } else
26
    {   //The CRC of the EEPROM is not correct, store default values and update CRC
28
    {   //The CRC of the EEPROM is not correct, store default values and update CRC
27
      eeprom_write_byte_crc(EEDATA.x, 0xAB, WITHOUT_CRC);
29
      eeprom_write_byte_crc(EEDATA.x, 0xAB, WITHOUT_CRC);
28
      eeprom_write_word_crc(EEDATA16.y, 0x1234, WITHOUT_CRC);
30
      eeprom_write_word_crc(EEDATA16.y, 0x1234, WITHOUT_CRC);
-
 
31
      eeprom_write_dword_crc(EEDATA32.y, 0x12345678, WITHOUT_CRC);
29
      EEDATA_UPDATE_CRC;
32
      EEDATA_UPDATE_CRC;
30
    }
33
    }
31
#endif
34
#endif
32
    ///TODO: Initialize hardware etc here
35
    ///TODO: Initialize hardware etc here
33
 
36