56 Serial.println( F(
"Saving bytes:" ) );
59 dataPtr = (uint8_t*)
configTree[ i ].dataPointer;
63 Serial.print( F(
"\tElement: " ) );
65 Serial.print( F(
"\t" ) );
66 Serial.print( index );
67 Serial.print( F(
"\t: " ) );
68 Serial.print( *dataPtr );
69 Serial.print( F(
"\tHEX: " ) );
70 Serial.println( *dataPtr, HEX );
72 EEPROM.update( index, *dataPtr );
83 EEPROM.update( index,
crc );
85 Serial.print( F(
"\tCalculated CRC: " ) );
86 Serial.println(
crc );
109 Serial.println( F(
"Loading bytes:" ) );
112 dataPtr = (uint8_t*)
configTree[ i ].dataPointer;
116 *dataPtr = EEPROM.read( index );
118 Serial.print( F(
"\tElement: " ) );
120 Serial.print( F(
"\t" ) );
121 Serial.print( index );
122 Serial.print( F(
"\t: " ) );
123 Serial.print( *dataPtr );
124 Serial.print( F(
"\tHEX: " ) );
125 Serial.println( *dataPtr, HEX );
137 crcRead = EEPROM.read( index );
140 if( crcRead !=
crc ){
142 Serial.print( F(
"\tCRC error! Calculated: " ) );
144 Serial.print( F(
", read: " ) );
145 Serial.println( crcRead );
150 Serial.print( F(
"\tCRC OK! Calculated: " ) );
152 Serial.print( F(
", read: " ) );
153 Serial.println( crcRead );
165 for( j = 0; j < 8; j++ ){
167 if( (
crc & 0x80 ) != 0 ){
169 crc = (uint8_t)( (
crc << 1 ) ^ 0x31 );
configurationData_t * configTree
Pointer to configTree.
uint8_t crc
Calculated CRC.
void crcFeed(uint8_t data)
Maxim like crc-8.
bool loadConfig()
Load configuration from EEPROM.
configurationManager(configurationData_t *configTree_p, uint8_t configTreeSize_p)
Constructor.
void saveConfig()
Save configuration to EEPROM.
uint8_t configTreeSize
configTree size.
Type for configTree element.
uint8_t dataSize
The size of the data, that has to be stored or loaded. Specified in bytes.