コード例 #1
0
ファイル: DAC.c プロジェクト: wmeler/avt2999
/********************************************//**
 * @brief Funkcja kalibrujaca offset DAC
 * @param speed : wartosc zmiany (-128 - 127)
 * @return uint8_t : aktualna wartosc (0 - 255)
 ***********************************************/
uint8_t DACOffsetCalib(int8_t val)
{
	uint8_t offset = eeprom_read_byte(&e_offset);
	if((uint16_t)offset + val < 256 && offset + val >= 0)
		offset+= val;
	eeprom_write_byte(&e_offset, offset);
	DACB.OFFSETCAL=offset;
	return offset;
}
コード例 #2
0
ファイル: DAC.c プロジェクト: wmeler/avt2999
/********************************************//**
 * @brief Funkcja kalibrujaca wzmocnienie DAC
 * @param speed : wartosc zmiany (-128 - 127)
 * @return uint8_t : aktualna wartosc (0 - 255)
 ***********************************************/
uint8_t DACGainCalib(int8_t val)
{
	uint8_t gain = eeprom_read_byte(&e_gain);
	if((uint16_t)gain + val < 256 && gain + val >= 0)
		gain+= val;
	eeprom_write_byte(&e_gain, gain);
	DACB.GAINCAL=gain;
	return gain;
}
コード例 #3
0
void _EEPROM_writeData(int &pos, uint8_t* value, uint8_t size)
{
    do
    {
        eeprom_write_byte((unsigned char*)pos, *value);
        pos++;
        value++;
    }while(--size);
}
コード例 #4
0
ファイル: EEPROM.cpp プロジェクト: epatel/Cosa
int 
EEPROM::Device::write(void* dest, const void* src, size_t size)
{
  uint8_t* dp = (uint8_t*) dest;
  const uint8_t* sp = (const uint8_t*) src;
  size_t res = size;
  while (size--) eeprom_write_byte(dp++, *sp++);
  return (res);
}
コード例 #5
0
ファイル: rules.c プロジェクト: icke2063/AVRNETIO_MAIN
uint8_t eeprom_del_rule (uint8_t pos)
{
/*  del_rule
*   
*/  
  uint8_t count,i;
  uint16_t target_adress;
  RULES_STRUCTUR hilf;
  
  RULE_DEBUG("Del Rule:%i\r\n",pos);
  
  
  //aktuelle Anzahl auslesen
	count = get_rule_count();
  

  if(pos>=0 && pos<=count)
  {
    //folgende Regeln nachr�ckenen lassen
    for(i=pos;i<count;i++)
    {
      
      if(eeprom_get_rule(i+1,&hilf))
      {
          
        // Zieladresse berechnen
        target_adress=RULES_EEPROM_STORE+1+(i*sizeof(RULES_STRUCTUR));
        RULE_DEBUG("EEPROM write adress:%i\r\n",target_adress);
    
  
        // Regel in den EEPROM schreiben
        eeprom_busy_wait ();
        eeprom_write_block((unsigned char *)&hilf,(unsigned char *)target_adress,sizeof(RULES_STRUCTUR));
      }
      else
      {
        return 0;
      }
      
  
    }
  
    //bisher alles OK -> neuen Wert ins EEPROM schreiben
		eeprom_busy_wait ();
		eeprom_write_byte((unsigned char *)(RULES_EEPROM_STORE),--count);
  
    return 1;
  }
  else
  {
    RULE_DEBUG("Failure: Out of Range\r\n");
    return 0;
  }
  
return 0;
  
}
コード例 #6
0
void writeColor(uint8_t color, uint8_t* base){
  uint8_t i = RING_BUFFER_LEN;
  uint8_t* loc = base;
  while(i-->1){// Not going to bother to check if we can skip writing.
    if(0 != eeprom_read_byte(loc)){
      eeprom_write_byte(loc++,0);
      if(color != 0)
	eeprom_write_byte(loc,color);
      return;
    }
    loc++;
  }
  // Otherwise, nuke the last byte with 0, and write the new value to the beginning
  if(0 != eeprom_read_byte(loc))
    eeprom_write_byte(loc,0);
  if(color != 0)
    eeprom_write_byte(base,color);
}
コード例 #7
0
void initializeDelays()
{
	detectorOnDelay = eeprom_read_byte((uint8_t*)(CHANNEL0_ON_DELAY));
	if (0xFF == detectorOnDelay || 0x00 == detectorOnDelay)
	{
		eeprom_write_byte((uint8_t*)(CHANNEL0_ON_DELAY), 4);
		detectorOnDelay = eeprom_read_byte((uint8_t*)(CHANNEL0_ON_DELAY));
	}	


	detectorOffDelay = eeprom_read_byte((uint8_t*)(CHANNEL0_OFF_DELAY));
	if (0xFF == detectorOffDelay || 0x00 == detectorOffDelay)
	{
		eeprom_write_byte((uint8_t*)(CHANNEL0_OFF_DELAY), 25);
		detectorOffDelay = eeprom_read_byte((uint8_t*)(CHANNEL0_OFF_DELAY));
	}	


}
コード例 #8
0
ファイル: eeprom.c プロジェクト: centrevillage/C_Quencer
void try_reset_eeprom() {
  const char* symbol = "C_Quencer 0.4";
  char id_str[13];
  for (int i=0; i<13; ++i) {
    eeprom_busy_wait();
    id_str[i] = eeprom_read_byte((uint8_t*)(i+1000));
  }
  if (strncmp(id_str, symbol, sizeof(id_str)) != 0) {
    for (int i=0; i<1000; ++i) {
      eeprom_busy_wait();
      eeprom_write_byte((uint8_t*)i, 0);
    }
    eeprom_write_block(symbol, (uint8_t*)1000, sizeof(symbol));
    for (int i=0; i<13; ++i) {
      eeprom_busy_wait();
      eeprom_write_byte((uint8_t*)(i+1000), symbol[i]);
    }
  }
}
コード例 #9
0
void lcd_material_store_material(uint8_t nr)
{
    eeprom_write_word(EEPROM_MATERIAL_TEMPERATURE_OFFSET(nr), material[active_extruder].temperature);
    eeprom_write_word(EEPROM_MATERIAL_BED_TEMPERATURE_OFFSET(nr), material[active_extruder].bed_temperature);
    eeprom_write_word(EEPROM_MATERIAL_FLOW_OFFSET(nr), material[active_extruder].flow);

    eeprom_write_byte(EEPROM_MATERIAL_FAN_SPEED_OFFSET(nr), material[active_extruder].fan_speed);
    eeprom_write_float(EEPROM_MATERIAL_DIAMETER_OFFSET(nr), material[active_extruder].diameter);
    //eeprom_write_block(card.longFilename, EEPROM_MATERIAL_NAME_OFFSET(nr), 8);
}
コード例 #10
0
ファイル: main.c プロジェクト: MarkDing/eeprom-emulation
/**
 * @fn void main(void)
 * @brief eeprom emulation main function entry
 *
 */
void main (void) 
{
	U16 i;
	U8 tmp;
    SFRPAGE_SWITCH()
    ENABLE_VDDMON()
    DISABLE_WDT()
    SFRPAGE_RESTORE()
    eeprom_init();
    for(i = 0;i< EE_SIZE ;i++) {
    	if(eeprom_read_byte(i,&test_buf[i]) == ERROR)
    		goto error;
    }
    for(i = 0;i < 2;i++) {
    	test_buf[i] = i + 0x55;
    	if(eeprom_write_byte(i, test_buf[i]) == ERROR)
    		goto error;
    }
    tmp = 0;
    while(tmp < 50){
        for(i = 2;i< EE_SIZE; i++) {
        	test_buf[i] = i + 1;
        	if(eeprom_write_byte(i, test_buf[i] + tmp) == ERROR)
        		goto error;
        }
        tmp++;
    }
    for(i = 0; i< EE_SIZE; i++) {
    	if(eeprom_read_byte(i,&test_buf[i]) == ERROR)
    		goto error;
    	if((i == 0) || (i == 1)){
    	    if ((test_buf[0] != 0x55) || (test_buf[1] != 0x56))
    	    	goto error;
    	}else{
    		if (test_buf[i] != (i + tmp))
    			goto error;
    	}
    }
    while(1);
error:
	i = 0xDEAD;
	while(1);
}
コード例 #11
0
ファイル: Preset.cpp プロジェクト: analogspecies/BlipBox
void Preset::save(uint8_t index){
  uint8_t buf[MIDI_ZONE_PRESET_SIZE];
  uint8_t* offset = getAddress(index);
  eeprom_write_byte(offset++, size);
  for(uint8_t i=0; i<size; ++i){
    uint8_t bts = writeZone(buf, i);
    eeprom_write_block(buf, offset, bts);
    offset += bts;
  }
}
コード例 #12
0
ファイル: main.c プロジェクト: Theemuts/eLuaBrain
void pgm_set_program_state( u8 slot, u8 state )
{
  u8 newstate = state ? ( pgm_mask | ( 1 << slot ) ) : ( pgm_mask & ( u8 )~( 1 << slot ) );

  if( newstate == pgm_mask )
    return;
  pgm_mask = newstate;
  eeprom_write_byte( PGMADDR, pgm_mask );
  eeprom_busy_wait();
}
コード例 #13
0
ファイル: eeprom.c プロジェクト: dreamshader/Raspberry_PI
int write_to_eeprom(struct eeprom *e, FILE *fp, int addr, char* pBuffer, int size)
{
	int ret = -1;
	int i;

	if ( e != (struct eeprom *) NULL && pBuffer != NULL )
	{
		if( strlen(pBuffer) >= size )
		{
			for( i = 0, ret = 0; ret == 0 && i < size; i++ )
			{
				if( (ret=eeprom_write_byte(e, addr++, pBuffer[i])) )
				{
					fprintf(stderr, "write error at addr %0x\n", addr);
				}
			}
		}
		else
		{
			for( i = 0, ret = 0; ret == 0 && i < size; i++ )
			{
				if( (ret=eeprom_write_byte(e, addr++, pBuffer[0])) )
				{
					fprintf(stderr, "write error at addr %0x\n", addr);
				}
			}
		}
	}

#ifdef _OLD_STYLE_MODE
	int c;
	while((c = fgetc(fp)) != EOF)
	{
		fflush(stdout);
		if(eeprom_write_byte(e, addr++, c))
		{
			fprintf(stderr, "write error at addr %0x\n", addr);
		}

	}
#endif // _OLD_STYLE_MODE
	return( ret );
}
コード例 #14
0
bool lcd_material_verify_material_settings()
{
    bool hasUPET = false;
    
    uint8_t cnt = eeprom_read_byte(EEPROM_MATERIAL_COUNT_OFFSET());
    if (cnt < 2 || cnt > EEPROM_MATERIAL_SETTINGS_MAX_COUNT)
        return false;
    while(cnt > 0)
    {
        cnt --;
        if (eeprom_read_word(EEPROM_MATERIAL_TEMPERATURE_OFFSET(cnt)) > HEATER_0_MAXTEMP)
            return false;
//        if (eeprom_read_word(EEPROM_MATERIAL_BED_TEMPERATURE_OFFSET(cnt)) > BED_MAXTEMP)
//            return false;
        if (eeprom_read_byte(EEPROM_MATERIAL_FAN_SPEED_OFFSET(cnt)) > 100)
            return false;
        if (eeprom_read_word(EEPROM_MATERIAL_FLOW_OFFSET(cnt)) > 1000)
            return false;
        if (eeprom_read_float(EEPROM_MATERIAL_DIAMETER_OFFSET(cnt)) > 10.0)
            return false;
        if (eeprom_read_float(EEPROM_MATERIAL_DIAMETER_OFFSET(cnt)) < 0.1)
            return false;

        eeprom_read_block(card.longFilename, EEPROM_MATERIAL_NAME_OFFSET(cnt), 8);
        if (strcmp_P(card.longFilename, PSTR("UPET")) == 0)
            hasUPET = true;
    }
    cnt = eeprom_read_byte(EEPROM_MATERIAL_COUNT_OFFSET());
    if (!hasUPET && cnt < EEPROM_MATERIAL_SETTINGS_MAX_COUNT)
    {
        strcpy_P(card.longFilename, PSTR("UPET"));
        eeprom_write_block(card.longFilename, EEPROM_MATERIAL_NAME_OFFSET(cnt), 5);
        eeprom_write_word(EEPROM_MATERIAL_TEMPERATURE_OFFSET(cnt), 250);
//        eeprom_write_word(EEPROM_MATERIAL_BED_TEMPERATURE_OFFSET(cnt), 60);
        eeprom_write_byte(EEPROM_MATERIAL_FAN_SPEED_OFFSET(cnt), 50);
        eeprom_write_word(EEPROM_MATERIAL_FLOW_OFFSET(cnt), 100);
        eeprom_write_float(EEPROM_MATERIAL_DIAMETER_OFFSET(cnt), 2.85);
        
        eeprom_write_byte(EEPROM_MATERIAL_COUNT_OFFSET(), cnt + 1);
    }
    return true;
}
コード例 #15
0
ファイル: printcounter.cpp プロジェクト: ClumsyApe/Marlin
void PrintCounter::initStats() {
  #if ENABLED(DEBUG_PRINTCOUNTER)
    PrintCounter::debug(PSTR("initStats"));
  #endif

  this->loaded = true;
  this->data = { 0, 0, 0, 0, 0.0 };

  this->saveStats();
  eeprom_write_byte((uint8_t *) this->address, 0x16);
}
コード例 #16
0
ファイル: main.c プロジェクト: 0CodeJam0/Tinyer-800
unsigned char GetActiveParamSetNumber(void)
{
    unsigned char set;
    set = eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET]);
    if(set > 5)
    {
        set = 2;
        eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], set);  				// diesen Parametersatz als aktuell merken
    }
    return(set);
}
コード例 #17
0
ファイル: save_data.c プロジェクト: kaisert/kilobot
static uint8_t write_byte(uint8_t *p, uint8_t data)
{
    if(0x00 <= p && p < 0x100) {
        error_state();
        return 0;
    }
    else {
        eeprom_write_byte(p, data);
    }
    return 1;
}
コード例 #18
0
ファイル: ledrender.c プロジェクト: huangdonghai/ps2avrU
static void writeLEDMode(void) {
	// LED 모드 저장, 너무많은 eeprom접근을 막기위해 일정 간격으로 저장한다.
	const int countMAX = 1000;
	if(ledStateCount > 0 && ++ledStateCount == countMAX){
		// DEBUG_PRINT(("writeLEDMode : mode %d, br %d \n", _fullLEDMode, _ledBrightnessMax));
		ledStateCount = 0;
		if(_fullLEDMode != _fullLEDMode_saved){
			_fullLEDMode_saved = _fullLEDMode;
			eeprom_write_byte((uint8_t *)EEPROM_LED_MODE, _fullLEDMode);  // 1바이트 11번지 쓰기
			// DEBUG_PRINT(("eeprom_write_byte : mode %d \n", _fullLEDMode));
		}

		// brightness
		if(_ledBrightnessMax_saved != _ledBrightnessMax){
			_ledBrightnessMax_saved = _ledBrightnessMax;
			eeprom_write_byte((uint8_t *)EEPROM_LED_BRIGHTNESS, _ledBrightnessMax);  // 1바이트 9번지 쓰기
			// DEBUG_PRINT(("eeprom_write_byte : _ledBrightnessMax %d \n", _ledBrightnessMax));
		}
	}
}
コード例 #19
0
ファイル: eeprom_test.c プロジェクト: getting/nfc-smart-tag
static void test_rollover_to_zero() {
  test("test_rollover_to_zero");
  uint32_t *memory = (uint32_t *)112;

  eeprom_write_dword(memory, 0xFFFFFFFF);
  eeprom_write_byte((uint8_t *)memory + 4, 0xa5);
  uint32_t result = increment_eeprom_uint32(memory);
  assert(result == 0x00000000);
  assert(eeprom_read_dword(memory) == 0x00000000);
  assert(eeprom_read_byte((uint8_t *)memory + 4) == 0xa5);
}
コード例 #20
0
ファイル: main.c プロジェクト: Theemuts/eLuaBrain
static void pgm_init()
{
  // Check internal EEPROM data 
  if( eeprom_read_byte( PGMADDR ) == 0xFF ) // initial EEPROM is blank
  {
    eeprom_write_byte( PGMADDR, 0x00 );
    eeprom_busy_wait();
  }
  pgm_mask = eeprom_read_byte( PGMADDR );
  pgm_crt = pgm_get_first_index();
}
コード例 #21
0
ファイル: main.c プロジェクト: grassyhilltop/blocktopus
/* Modify module type. */
void update_module_type(uint8_t new_type)
{
    module_type = new_type;
    init_modules();
    // Keep module_type state in memory. TODO: Does this stay in EEPROM
    // even when I re-run micronucleus? We wouldn't want that though.
    // Unsure whether this is in interrupt context or standard context here
    cli();
    eeprom_write_byte(MODULE_TYPE_EEPROM_ADDR, module_type);
    sei();
}
コード例 #22
0
// Set station name to eeprom
void OpenSprinkler::set_station_name(byte sid, char tmp[]) {
  int i=0;
  int start = ADDR_EEPROM_STN_NAMES + (int)sid * STATION_NAME_SIZE;
  tmp[STATION_NAME_SIZE]=0;
  while(1) {
    eeprom_write_byte((unsigned char *)(start+i), tmp[i]);
    if (tmp[i]==0 || i==(STATION_NAME_SIZE-1)) break;
    i++;
  }
  return;  
}
コード例 #23
0
ファイル: myavreeprom.cpp プロジェクト: NeMarat/myAvrEeprom
void MyEeprom::write_byte(uint8_t b, uint16_t relative_address) {
    cli();
    while (!eeprom_is_ready());
    uint16_t pCurrentOffset = currentOffset;
    if (firstAddress + (currentOffset + 1) * (dataLength + servisInfo) > maxAddress) {
        currentOffset = 0;
    } else { currentOffset++; }
    uint8_t tb = 0;
    for (uint16_t i = 0; i < dataLength; i++) {
        if (i == relative_address) {
            eeprom_write_byte((uint8_t*)(firstAddress + currentOffset * (dataLength + servisInfo) + servisInfo + i), b);
        } else {
          tb = eeprom_read_byte((uint8_t*)(firstAddress + pCurrentOffset * (dataLength + servisInfo) + servisInfo + i));
          eeprom_write_byte((uint8_t*)(firstAddress + currentOffset * (dataLength + servisInfo) + servisInfo + i), tb);
        }
    }
    eeprom_write_byte((uint8_t*)(firstAddress + currentOffset * (dataLength + servisInfo)), P_VALID);
    eeprom_write_byte((uint8_t*)(firstAddress + pCurrentOffset * (dataLength + servisInfo)), P_INVALID);
    sei();
}
コード例 #24
0
ファイル: Common.c プロジェクト: mikedehaan/mad-phenom
void togglePreset(){
	if (CURRENT_PRESET >= (MAX_PRESETS - 1)) {
		CURRENT_PRESET = 0;
	} else {
		CURRENT_PRESET++;
	}
	
	eeprom_write_byte(&EEPROM_PRESET, CURRENT_PRESET);
	
	loadPreset();
}
コード例 #25
0
ファイル: ADS7846.c プロジェクト: BadgeWiz/TR16Badge
uint_least8_t ADS7846_writeCalibration(uint16_t eeprom_addr)
{
	if (tp_matrix.div != 0) {
		eeprom_write_byte((uint8_t *) eeprom_addr++, 0x55);
		eeprom_write_block((void *)&tp_matrix, (void *)eeprom_addr,
				   sizeof(CAL_MATRIX));
		return 1;
	}

	return 0;
}
コード例 #26
0
ファイル: WaspPWR.cpp プロジェクト: Babody/waspmoteapi
/*
 * hibernate(time2wake, offset, mode) - enter a hibernate state
 * 
 * Waspmote enters hibernate. The device is off and no variable will be stored
 * in RAM memory
 * 
 */
void WaspPWR::hibernate(const char* time2wake, uint8_t offset, uint8_t mode)
{
	int retries = 3;
	
	// set EEPROM Hibernate flag
	eeprom_write_byte((unsigned char *) HIB_ADDR, HIB_VALUE);
   
	pinMode(XBEE_PW,OUTPUT);
	digitalWrite(XBEE_PW, LOW);
	//~ closeSerial(0);
	//~ while(digitalRead(GPS_PW))
	//~ {              
		//~ digitalWrite(GPS_PW,LOW);
	//~ }
   
	// switch multiplexers power supply 
	Utils.muxOFF();
      
	RTC.ON();
	// Set RTC alarme to wake up from Sleep Power Down Mode
	RTC.setAlarm1(time2wake,offset,mode);
	// get backup of selected Alarm	
	uint8_t day_aux = RTC.day_alarm1; 
	uint8_t hour_aux = RTC.hour_alarm1; 
	uint8_t minute_aux = RTC.minute_alarm1; 
	uint8_t second_aux = RTC.second_alarm1; 
	// get Alarm
	RTC.getAlarm1();
	// check Alarm was correctly set	
	if(	( day_aux != RTC.day_alarm1 ) 
	||	( hour_aux != RTC.hour_alarm1 )
	||	( minute_aux != RTC.minute_alarm1 )
	||	( second_aux != RTC.second_alarm1 ) )
	{
		return (void)0;
	}
	RTC.OFF();
   
	pinMode(RTC_SLEEP,OUTPUT);
	digitalWrite(RTC_SLEEP,HIGH);
	delay(50);
	digitalWrite(RTC_SLEEP,LOW);
   
	// To avoid executing any other function after calling hibernate
	while( retries > 0 ) 
	{
	   retries--;
       pinMode(RTC_SLEEP,OUTPUT);
       digitalWrite(RTC_SLEEP,HIGH);
       delay(50);
       digitalWrite(RTC_SLEEP,LOW);
       delay(50);
	}
}
コード例 #27
0
void DataWarehouse::putData( int16_t data, uint8_t dataType, uint8_t hour )
{
    uint8_t todayIndex;
    uint8_t dataTypeIndex;
    uint8_t hourIndex;

    todayIndex = eeprom_read_byte((const uint8_t *)STORE_ADDR_TODAYINDEX);
    dataTypeIndex = getDataTypeIndex(dataType);
    hourIndex = hour2Index(hour);


    eeprom_write_byte( (uint8_t *)STORE_ADDR_VALIDFLAG, ~DATA_VALID );
	writeData( data, todayIndex, dataTypeIndex, hourIndex );
    eeprom_write_byte( (uint8_t *)STORE_ADDR_VALIDFLAG, DATA_VALID );


    DBG_PRINT("putData:")
    DBG_PRINTLN_VAR(dataType, DEC);
    DBG_PRINTLN_VAR(data, DEC);
}
コード例 #28
0
void lcd_material_store_current_material()
{
    for(uint8_t e=0; e<EXTRUDERS; e++)
    {
        eeprom_write_word(EEPROM_MATERIAL_TEMPERATURE_OFFSET(EEPROM_MATERIAL_SETTINGS_MAX_COUNT+e), material[e].temperature);
        eeprom_write_word(EEPROM_MATERIAL_BED_TEMPERATURE_OFFSET(EEPROM_MATERIAL_SETTINGS_MAX_COUNT+e), material[e].bed_temperature);
        eeprom_write_byte(EEPROM_MATERIAL_FAN_SPEED_OFFSET(EEPROM_MATERIAL_SETTINGS_MAX_COUNT+e), material[e].fan_speed);
        eeprom_write_word(EEPROM_MATERIAL_FLOW_OFFSET(EEPROM_MATERIAL_SETTINGS_MAX_COUNT+e), material[e].flow);
        eeprom_write_float(EEPROM_MATERIAL_DIAMETER_OFFSET(EEPROM_MATERIAL_SETTINGS_MAX_COUNT+e), material[e].diameter);
    }
}
コード例 #29
0
ファイル: tcpcmd.c プロジェクト: jlunz/AVR-Webserver
/**
 * \ingroup usartcmdline
 * \b WOL-Befehl Wake-On-Lan Paket versenden
 */
int16_t command_wol (char *outbuffer)
{
	if (outbuffer)					// nur bei USART
		return cmd_502(outbuffer);

	#if USE_WOL
	uint32_t var = 0;

	// EEPROM beschreiben, falls Parameter angegeben wurden
	if (getLong(&var))
	{	
		//schreiben der MAC
		for (unsigned char count = 0; count<6; count++)
		{
			eeprom_busy_wait ();
			eeprom_write_byte((unsigned char *)(WOL_MAC_EEPROM_STORE + count),(uint8_t)var);
			if (!getLong(&var))
				break;
		}

		//zusätzlich schreiben der Broadcast-Adresse, falls vorhandenden
		if (getLong(&var))
		{
			for (unsigned char count = 0; count<4;++count)
			{
				eeprom_busy_wait ();
				eeprom_write_byte((unsigned char*)(WOL_BCAST_EEPROM_STORE + count),(uint8_t)var);
				if (!getLong(&var))
					break;
			}
		}

		//init
		wol_init();
	}else{
		//MagicPacket senden
		wol_request();
	}
	#endif //USE_WOL	
	return 0;
}
コード例 #30
0
void set_tune()
{
uint8_t i;
// set up port B

	DDRB  = _BV(OUTPIN);	// set output pin
	PORTB = ~_BV(OUTPIN);	// set pullups on inputs

// set test mode --- play all "hit" sounds if TESTIN is 0

	while (!(PINB & _BV(TESTIN))) {
               for (i=0; i<(sizeof(list)/sizeof(list[0])); i++) {
                        PLAYTIME = (uint8_t*) (pgm_read_word(list+i));
                        hit();
			_delay_loop_1(250);	// delay 1000 cycles

			// select tune using PICKTUNE
                        if (!(PINB & _BV(PICKTUNE))){
                                if (PINB & _BV(FOILEPEE))
                                        eeprom_write_byte(&ee_epeesong, i);
                                else
                                        eeprom_write_byte(&ee_foilsong, i);
                                break;
                        }
                }
	}

	i = eeprom_read_byte(&ee_foilsong);
	if (i < (sizeof(list)/sizeof(list[0])))
		foil_song = (uint8_t*) (pgm_read_word(list+i));
	else
		foil_song = (uint8_t*) (pgm_read_word(list));

	i = eeprom_read_byte(&ee_epeesong);
	if (i < (sizeof(list)/sizeof(list[0])))
		epee_song = (uint8_t*) (pgm_read_word(list+i));
	else
		epee_song = (uint8_t*) (pgm_read_word(list+1));

	return;
}