I have an ATMega328
and I'm using the <avr/eeprom.h>
functions to use the inbuilt EEPROM
.
I can use the EEPROM
correctly but I don't understand the function arguments I pass to the EEPROM
functions.
For example, to write different types of data I can use
void eeprom_update_byte (uint8_t *addr, uint8_t value);
void eeprom_update_word (uint16_t *addr, uint16_t value);
void eeprom_update_dword (uint32_t *addr, uint32_t value);
void eeprom_update_float (float *addr, float value);
But why does the pointer type for the address (the
addr
parameter) change depending on the function used? Ifaddr
just points to a validEEPROM
address why is the type different in each function?Also, the use of the
void *
in theEEPROM
function below is confusing me. I understand that avoid *
can point to any address, so I'm assuming the function simply writes byte by byte the data insrc
but I'm unsure if this is correct?
void eeprom_update_block (const void *src, void *dst, size_t n);