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 addConstant( byte * bytes, const byte * constant, byte count )
00068 {
00069
00070 byte * tempBlock = bytes;
00071 const byte * tempSource = constant;
00072 byte tempCount = count;
00073 byte tempValue;
00074
00075 do {
00076
00077 tempValue = *tempBlock ^ *tempSource++;
00078 *tempBlock++ = tempValue;
00079 } while( --tempCount );
00080 }
00081
00082
00083
00084 void addConstantFromEEPROM( byte * bytes,
00085 const byte __eeprom * constant, byte count )
00086 {
00087
00088 byte * tempDestination = bytes;
00089 byte tempCount = count;
00090 byte tempValue;
00091 EEAR = (uint16_t) constant;
00092
00093 do {
00094 EECR |= (1<<EERE);
00095 ++EEAR;
00096 tempValue = *tempDestination ^ EEDR;
00097 *tempDestination++ = tempValue;
00098 } while( --tempCount );
00099 }
00100
00101
00102
00103 void copyBytesToEEPROM( byte __eeprom * destination,
00104 const byte * source, byte count )
00105 {
00106
00107 const byte * tempSrc = source;
00108 byte tempCount = count;
00109 do {} while( EECR & (1<<EEPE) );
00110 EEAR = (uint16_t) destination;
00111
00112 do {
00113 EEDR = *tempSrc++;
00114 EECR |= (1<<EEMPE);
00115 EECR |= (1<<EEPE);
00116 do {} while( EECR & (1<<EEPE) );
00117 ++EEAR;
00118 } while( --tempCount );
00119 }
00120
00121
00122
00123 void copyBytesFromEEPROM( byte * destination,
00124 const byte __eeprom * source, byte count )
00125 {
00126
00127 byte * tempDest = destination;
00128 byte tempCount = count;
00129 EEAR = (uint16_t) source;
00130
00131 do {
00132 EECR |= (1<<EERE);
00133 ++EEAR;
00134 *tempDest++ = EEDR;
00135 } while( --tempCount );
00136 }
00137