[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] Macro to read /write long to eeprom
From: |
Dave Hansen |
Subject: |
RE: [avr-gcc-list] Macro to read /write long to eeprom |
Date: |
Tue, 09 Aug 2005 15:11:20 -0400 |
From: "Royce Pereira" <address@hidden>
Hi,
Is there a macro to read or write a long word (32 bits) to eeprom?
For the last hour I've been trying to write one unsuccessfully.
Not directly, but you can do something like
#include <avr/eeprom.h>
inline void eeprom_write_long(long *dest, long val)
{
eeprom_write_block(&val, dest, sizeof(val));
}
inline long eeprom_read_long(long *src)
{
long retval;
eeprom_read_block(&retval, src, sizeof(retval));
return retval;
}
WARNING: untested code, but it should be close. Note that (IMHO)
eeprom_write_block's parameters are backwards, but that's what's been
provided.
HTH,
-=Dave