Quote:
|
Originally Posted by kc8nod
Hi Kevin,
Thanks for all the effort, it looks great and we'll definately be using it. I'd like to make one suggestion though.
With so many novice progammers using your code, it's likely that someone will use the EEPROM_Write() function too much, even when the data doesn't need to be updated. A small change to EEPROM_Write() might avoid problems for these folks.
Code:
unsigned char EEPROM_Write(unsigned int address, unsigned char data)
{
unsigned char return_value;
// determine if this is really new data
if(data == EEPROM_Read(address))
{
return_value = 1;
}
else if(eeprom_queue_full == FALSE) // return error flag if the queue is full
{
// put the byte and its address on their respective circular queues
eeprom_queue_data[eeprom_queue_write_index] = data;
eeprom_queue_address[eeprom_queue_write_index] = address;
If the new data being written, is the same as the old data that's already there, then we never add it to the queue.
Thanks again for all the hard work.
|
Thanks, it's a good idea and I considered it, but I'd also have to search the queue for writes to the same address as well, which would make the code a bit more complex. If I had to consider all of the wacky things that people do with my code and try to save them from themself, the code would be even more complex and bloated <grin>.
-Kevin