You haven't given us the implementation of this prototype function
void eeprom_update_byte (uint8_t *__p, uint8_t __value);
Implicit declaration error usually means you provided a prototype but no body code ... hence I am worried you haven't given me that functions code. I am assuming the EEPROM is flash and that code will do what we call the toggling test until it writes the byte to the flash. Warning if it is FLASH you usually also have to release protection registers by writing special commands to special addresses before you can write to the flash, did the original code also provide a function to release the protection on a sector per chance? However onto your code as it stands, you are passing in the address to write as a byte which gives you a range of 0-255 in memory see here
bool Update_EEPROM_Memory_byte(byte val1, byte val2) { // Val1 is a byte
uint8_t eepromAddr = val1; // <== Really a byte as the address you can only write to memory address 0--0xff
uint8_t eepromVal = val2;
The original function they provided had a pointer to an byte (uint_8) which will be most likely be 32 bit ... see
void eeprom_update_byte (uint8_t *__p, uint8_t __value); // First parameter is a pointer see the "*"
I suspect you need your address to be a long ..... try
bool Update_EEPROM_Memory_byte(unsigned long val1, byte val2){
unsigned long eepromAddr = val1; // <== Now you can write to memory address 0-0xffffffff
uint8_t eepromVal = val2;
Adjusted last function to take the long
bool eeprom_memory_update_byte(unsigned long eeprom_addr, uint8_t eepromValue)
{
eeprom_update_byte((uint8_t*) eeprom_addr, eepromValue);
uint8\_t eepromVal = eeprom\_read\_byte(( uint8\_t \*) eeprom\_addr);
if (eepromValue == eepromVal)
return 1;
else
return 0;
}
The alternative to an unsigned long for the address is to keep it as a pointer (uint8_t*). That all means nothing if you have no code for the function eeprom_update_byte which isn't shown. Other housekeeping Update_EEPROM_Memory_byte should return the result of eeprom_memory_update_byte rather than a static 1 (TRUE) result.
In vino veritas