00001
00049 #include "common.h"
00050
00051
00052
00053 void copyBytes( byte * destination, const byte * source, byte count)
00054 {
00055
00056 byte * tempDest = destination;
00057 const byte * tempSrc = source;
00058 byte tempCount = count;
00059
00060 do {
00061 *tempDest++ = *tempSrc++;
00062 } while( --tempCount );
00063 }
00064
00065
00066
00067 void addConstantFromEEPROM( byte * bytes,
00068 const byte __eeprom * constant, byte count )
00069 {
00070
00071 byte * tempDestination = bytes;
00072 byte tempCount = count;
00073 byte tempValue;
00074 EEAR = (unsigned short int) constant;
00075
00076 do {
00077 EECR |= (1<<EERE);
00078 ++EEAR;
00079 tempValue = *tempDestination ^ EEDR;
00080 *tempDestination++ = tempValue;
00081 } while( --tempCount );
00082 }
00083
00084
00085
00086 void copyBytesToEEPROM( byte __eeprom * destination,
00087 const byte * source, byte count )
00088 {
00089
00090 const byte * tempSrc = source;
00091 byte tempCount = count;
00092 do {} while( EECR & (1<<EEWE) );
00093 EEAR = (uint16_t) destination;
00094
00095 do {
00096 EEDR = *tempSrc++;
00097 EECR |= (1<<EEMWE);
00098 EECR |= (1<<EEWE);
00099 do {} while( EECR & (1<<EEWE) );
00100 ++EEAR;
00101 } while( --tempCount );
00102 }
00103
00104
00105
00106 void copyBytesFromEEPROM( byte * destination,
00107 const byte __eeprom * source, byte count )
00108 {
00109
00110 byte * tempDest = destination;
00111 byte tempCount = count;
00112 EEAR = (unsigned short int) source;
00113
00114 do {
00115 EECR |= (1<<EERE);
00116 ++EEAR;
00117 *tempDest++ = EEDR;
00118 } while( --tempCount );
00119 }
00120
00121
00122