Пример #1
0
void ds18x20_select_device(unsigned char *mem_array, unsigned char mem_type) 
{

unsigned char x=0;

if(mem_type == LOCATION_IS_RAM) 
{  
    for(x=0; x<8; x++) { *(ds18x20_rom_code+x)=(*(mem_array+x)); }  
} 
else if(mem_type == LOCATION_IS_FLASH) 
      {  
         for(x=0; x<8; x++) { *(ds18x20_rom_code+x)=PRG_RDB((const unsigned char*)(mem_array+x)); } 
      } 
else if(mem_type == LOCATION_IS_EEPROM) 
      { 
         for(x=0; x<8; x++) { ds18x20_rom_code[x]=eeprom_rb((unsigned int)(mem_array+x)); } 
      }

return; 
} 
Пример #2
0
int avr_read_eeprom(void) {
   unsigned int  addr = 0, finished = 0;
   unsigned char type;

   while (!finished) {
      type = eeprom_rb(addr++);

      switch (type) {
         case AVR_END:
            finished = 1;
            break;

         default:
            DEBUG_STR("EEPROM garbage");
            finished = 1;
            break;
      }
   }

   return 1;
}