当前位置: 首页>>代码示例>>C++>>正文


C++ eeprom_read_word函数代码示例

本文整理汇总了C++中eeprom_read_word函数的典型用法代码示例。如果您正苦于以下问题:C++ eeprom_read_word函数的具体用法?C++ eeprom_read_word怎么用?C++ eeprom_read_word使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了eeprom_read_word函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

// Setup the registers and read settings from EEPROM
int main(){
	// Read settings from EEPROM
	
	off_time 	= ((unsigned int )eeprom_read_word(OFF_TIME_ADDR ));
	ramp_time   = ((unsigned char )eeprom_read_byte(RAMP_TIME_ADDR))*(unsigned int)100;
	fade_time   = ((unsigned char )eeprom_read_byte(FADE_TIME_ADDR));
	dim_level	= ((unsigned char)eeprom_read_byte(DIM_LVL_ADDR));
	

	DDRB |= PWM; // Set SWITCH to output
	DDRB &= ~(ON | DIM | OFF | SENSE); // Set ON, OFF, DIM, SENSE to input
	PORTB |= (ON | DIM | OFF ); // Enable Pull Up resistors

	TIMSK0 |= 0x02; // Enable timer overflow interrupts

	GIMSK |= 0x20; // Enable Pin Change interrupts
	PCMSK |= 0x1A; // Interupt on 1, 3, 4

	// Enable PWM on OCR0A
	TCCR0B |= 0x03; // Divide clock by 64	
	TCCR0A |= 0x83; // Fast PWM
	current_level = 255;
	target_level = 255;
	OCR0A = 255; // Start lights at full

	sei(); // Enable global interrupts

	while(1);
}
开发者ID:metcalf,项目名称:light-controller,代码行数:30,代码来源:light-controller.c

示例2: init_RDM

// *************** RDM Reception Initialisation ****************
void init_RDM(void)
{
    if (!eeprom_read_byte((uint8_t*)EEPROM_STATUS)) {
        //use DevID from EEPROM if set
        eeprom_read_block(&DevID, (uint16_t*)EEPROM_DEVICE_ID, 6);
    }
	DmxAddress= eeprom_read_word((uint16_t*)EEPROM_DMX_ADDRESS);
    //moved from check_RDM, doesn't need to be done every time label i s read
    if(eeprom_read_byte((uint8_t*)EEPROM_LABEL_LEN) > 32)
        eeprom_write_byte((uint8_t*)EEPROM_LABEL_LEN , 0);
    

	DDRD  |= (1<<PD2)|(1<<PD1);
	PORTD &= ~(1<<PD2);											//enable reception
	PORTD |= (1<<PD1);
	UBRRH  = 0;
	UBRRL  = ((F_OSC/4000)-1);									//250kbaud, 8N2
	
	UCSRC  = (3<<UCSZ0)|(1<<USBS);
	UCSRB  = (1<<RXEN)|(1<<RXCIE);
	RxState= IDLE;

	uint8_t i;
	for (i=0; i<sizeof(DmxField); i++)
	{
		DmxField[i]= 0;
	}
}
开发者ID:neffs,项目名称:RDM-LED-Spot,代码行数:29,代码来源:lib_rdm_in.c

示例3: main

int main(void) {

  initUSART();
  char ramString[STRING_LEN];
  uint8_t counter;

  while (1) {
    printString("\r\n------------------\r\n");
    eeprom_read_block(ramString, eepromString, STRING_LEN);
    printString(ramString);

    printString("\r\nThe counter reads: ");
    counter = eeprom_read_byte(&eepromCounter);
    printByte(counter);

    printString("\r\nMy uint16_t value is: ");
    printWord(eeprom_read_word(&eepromWord));

    printString("\r\n   Enter a new introduction string below:\r\n");
    readString(ramString, STRING_LEN);
    eeprom_update_block(ramString, eepromString, STRING_LEN);
    counter++;
    eeprom_update_byte(&eepromCounter, counter);
  }
  return 0;
}
开发者ID:DanielVercouteren,项目名称:AVR-Programming,代码行数:26,代码来源:eememDemo.c

示例4: do_time_monitor

void do_time_monitor(void *dummy)
{
	uint16_t seconds;
	seconds = eeprom_read_word(EEPROM_TIME_ADDRESS);
	seconds ++;
	eeprom_write_word(EEPROM_TIME_ADDRESS, seconds);
}
开发者ID:onitake,项目名称:aversive,代码行数:7,代码来源:main.c

示例5: setup

void setup(void)
{
    g_press_down_timer = 0;
    g_idle_timer = 0;

    g_rom_select = eeprom_read_word(EEPROM_DEFAULT_ROM_SEL_ADDR);

    DDRB =  ROM_SELECT_PIN | POWER_ENABLE_PIN | UART_TX_PIN;
    PORTB = (g_power_enabled?0:POWER_ENABLE_PIN) | RESTORE_KEY_PIN;
    PCMSK = RESTORE_KEY_PIN;

    softuart_init();

    // Configure OCR1B output for 60Hz
    TCCR1 = _BV(CTC1) | _BV(CS13) | _BV(CS11) | _BV(CS10);  // Prescale select CK/1024
    GTCCR = _BV(PWM1B) | _BV(COM1B1);                       // Enable PWM on OCB1
    OCR1A = 0;
    OCR1B = 66;
    OCR1C = 132;

    TIMSK |= _BV(TOV1);  // Interrupt on Timer 1 Overflow (used for button)
    GIMSK |= _BV(PCIE);  // Interrupt on pin change for Restore Key (used to wake from sleep)

    sei();               // Enable interrupts 
}
开发者ID:mkotyk,项目名称:c128power,代码行数:25,代码来源:main.c

示例6: sendStats

void sendStats( boolean isStart ) {
	uint8_t tt			= GetTemp();
	uint16_t starts		= eeprom_read_word(&eeprom_starts);
	uint8_t rid_low		= eeprom_read_byte((unsigned char *)(EEPROM_ROBOT_ID_LOW*2));
	uint8_t rid_high	= eeprom_read_byte((unsigned char *)(EEPROM_ROBOT_ID_HIGH*2));
	// RRS,VERSION,TEMP,STARTS,ROBOT_ID
	// RRS,4,60,3222,40,0,3		= version 4, TEMP = 60 somethings (not celsius or fahrenheits), starts 3222, robot_id_low = 40,  robot_id_high = 0, pcb_type = 3
	Serial.print("RRS,");
	Serial.print(B2_VERSION, DEC );
	Serial.print(",");
	Serial.print(tt, DEC);
	Serial.print(",");
	Serial.print(starts, DEC);
	Serial.print(",");
	Serial.print(rid_low, DEC);
	Serial.print(",");
	Serial.print(rid_high, DEC);
	Serial.print(",");
	Serial.print(pcb_type, DEC);			// pcb type
	Serial.println();
	if(isStart){
		starts++;
		eeprom_write_word(&eeprom_starts, starts);
	}
}
开发者ID:ArturFormella,项目名称:barobot,代码行数:25,代码来源:barobot_carret2.cpp

示例7: main

int main(void) {
	DDRD = 0xff;
	DDRB = 0xff;
	DDRC = 0;
	
	PORTC = _BV(2) | _BV(3) | _BV(4) | _BV(5);	// keyboard pull-up
	

	TCCR1A = 0;
	TCCR1B = _BV(CS11) | _BV(CS10);
	
	TIMSK = _BV(OCIE1A);
	
	sei();
	enableLed(false);
	enablePower(false);
	displayOutTime(0);
	
	timer_interval = eeprom_read_word(EEPROM_OFFSET_TIME);
	if (timer_interval > MAX_TIME_INTERVAL_MINUTES || timer_interval == 0) {
		timer_interval = 10;
	}
	
    while(1) {
		keyboardCheck();
		if (timer_mode == TIMER_MODE_WAIT) {
			if (key_pressed[KEY_PLUS] == 0xff && timer_interval < MAX_TIME_INTERVAL_MINUTES) {
				timer_interval++;
				key_pressed[KEY_PLUS] = 220;
			} else if (key_pressed[KEY_MINUS] == 0xff && timer_interval > 0) {
				timer_interval--;
				key_pressed[KEY_MINUS] = 220;
			}
		}
		for (uint8_t i = 0; i < 8; i++) {
			displayUpdate(i);
			if (timer_mode == TIMER_MODE_RUN) {
				displayOutTime(time);
				displayOutSeparator(hsec < 50);
				if (time < 30) {
					enableLed(hsec < 25 || (hsec > 50 && hsec < 75));	
				} else if (time < 60) {
					enableLed(hsec < 75);
				}
			} else {
				displayOutTime(timer_interval);
				displayOutSeparator(true);
				//displayOutSeparator(hsec < 25 || (hsec > 50 && hsec < 75));
				//if (hsec < 25 || (hsec > 50 && hsec < 75)) {
					//displayOutTime(timer_interval);
					//displayOutSeparator(true);
				//} else {
					//displayClear();
				//}
			}
			_delay_us(500);
		}
    }
}
开发者ID:trol73,项目名称:avr-lamp-timer,代码行数:59,代码来源:timer-for-uv-lamp.c

示例8: trigger_jog_timer

static void trigger_jog_timer(const struct reg *reg)
{
  struct storage s;
  s=reg_storage(reg);
  cli();
  jog_timer=eeprom_read_word((void *)s.loc.eeprom.start);
  sei();
}
开发者ID:sde1000,项目名称:fvcontroller,代码行数:8,代码来源:temp.c

示例9: lcd_material_read_current_material

void lcd_material_read_current_material()
{
    for(uint8_t e=0; e<EXTRUDERS; e++)
        {
            material[e].temperature = eeprom_read_word(EEPROM_MATERIAL_TEMPERATURE_OFFSET(EEPROM_MATERIAL_SETTINGS_MAX_COUNT+e));
            material[e].bed_temperature = eeprom_read_word(EEPROM_MATERIAL_BED_TEMPERATURE_OFFSET(EEPROM_MATERIAL_SETTINGS_MAX_COUNT+e));
            material[e].flow = eeprom_read_word(EEPROM_MATERIAL_FLOW_OFFSET(EEPROM_MATERIAL_SETTINGS_MAX_COUNT+e));

            material[e].fan_speed = eeprom_read_byte(EEPROM_MATERIAL_FAN_SPEED_OFFSET(EEPROM_MATERIAL_SETTINGS_MAX_COUNT+e));
            material[e].diameter = eeprom_read_float(EEPROM_MATERIAL_DIAMETER_OFFSET(EEPROM_MATERIAL_SETTINGS_MAX_COUNT+e));
            strcpy_P(material_name[e],PSTR("???"));

            eeprom_read_block(material_name[e], EEPROM_MATERIAL_NAME_OFFSET(EEPROM_MATERIAL_SETTINGS_MAX_COUNT+e), MATERIAL_NAME_LENGTH);
            material_name[e][MATERIAL_NAME_LENGTH] = '\0';

        }
}
开发者ID:norpchen,项目名称:Ultimaker2Marlin,代码行数:17,代码来源:UltiLCD2_menu_material.cpp

示例10: init_rand

inline static void init_rand()
{
	uint16_t srand_seed_value;
	
	srand_seed_value = eeprom_read_word((void*) EEPROM_SRAND_ADDR);
	srand(srand_seed_value);
	eeprom_write_word((void*)EEPROM_SRAND_ADDR, rand());
}
开发者ID:denis-m-tyurin,项目名称:rgb_bedside_lamp,代码行数:8,代码来源:RGB_Bedside_Lamp.c

示例11: lcd_material_set_material

void lcd_material_set_material(uint8_t nr, uint8_t e)
{
    material[e].temperature = eeprom_read_word(EEPROM_MATERIAL_TEMPERATURE_OFFSET(nr));
    material[e].bed_temperature = eeprom_read_word(EEPROM_MATERIAL_BED_TEMPERATURE_OFFSET(nr));
    material[e].flow = eeprom_read_word(EEPROM_MATERIAL_FLOW_OFFSET(nr));

    material[e].fan_speed = eeprom_read_byte(EEPROM_MATERIAL_FAN_SPEED_OFFSET(nr));
    material[e].diameter = eeprom_read_float(EEPROM_MATERIAL_DIAMETER_OFFSET(nr));
    eeprom_read_block(card.longFilename, EEPROM_MATERIAL_NAME_OFFSET(nr), 8);
    card.longFilename[8] = '\0';
    if (material[e].temperature > HEATER_0_MAXTEMP - 15)
        material[e].temperature = HEATER_0_MAXTEMP - 15;
    if (material[e].bed_temperature > BED_MAXTEMP - 15)
        material[e].bed_temperature = BED_MAXTEMP - 15;
    
    lcd_material_store_current_material();
}
开发者ID:DiamondMind3DPrinters,项目名称:DMv2-Marlin,代码行数:17,代码来源:UltiLCD2_menu_material.cpp

示例12: sns_power_Init

void sns_power_Init(void)
{
#ifdef sns_power_USEEEPROM
	if (EEDATA_OK)
	{
	  ///TODO: Use stored data to set initial values for the module
	  sns_power_ReportInterval = eeprom_read_byte(EEDATA.reportInterval);
	  EnergyCounter = eeprom_read_word(EEDATA16.EnergyCounterLower);
	  EnergyCounter += (((uint32_t)(eeprom_read_word(EEDATA16.EnergyCounterUpper)))<<16);
	    #ifdef POWER_SNS_PIN_ch2
	      EnergyCounter_ch2 = eeprom_read_word(EEDATA16.EnergyCounterLower_ch2);
	      EnergyCounter_ch2 += (((uint32_t)(eeprom_read_word(EEDATA16.EnergyCounterUpper_ch2)))<<16);
	    #endif
	} else
	{	//The CRC of the EEPROM is not correct, store default values and update CRC
	  eeprom_write_byte_crc(EEDATA.reportInterval, sns_power_SEND_PERIOD, WITHOUT_CRC);
	  eeprom_write_word_crc(EEDATA16.EnergyCounterUpper, 0, WITHOUT_CRC);
	  eeprom_write_word_crc(EEDATA16.EnergyCounterLower, 0, WITHOUT_CRC);
	  #ifdef POWER_SNS_PIN_ch2
	    eeprom_write_word_crc(EEDATA16.EnergyCounterUpper_ch2, 0, WITHOUT_CRC);
	    eeprom_write_word_crc(EEDATA16.EnergyCounterLower_ch2, 0, WITHOUT_CRC);
	  #endif
	  EEDATA_UPDATE_CRC;
	  sns_power_ReportInterval = eeprom_read_byte(EEDATA.reportInterval);
	}
#endif  
	///Initialize hardware etc
	gpio_set_in(POWER_SNS_PIN);	// Set to input
	gpio_set_pin(POWER_SNS_PIN);	// Enable pull-up
	
	Pcint_SetCallbackPin(sns_power_PCINT, POWER_SNS_PIN, &sns_power_pcint_callback);

	MeasurmentBufferPointer = 0;
#ifdef POWER_SNS_PIN_ch2
	gpio_set_in(POWER_SNS_PIN_ch2);	// Set to input
	gpio_set_pin(POWER_SNS_PIN_ch2);	// Enable pull-up
	
	Pcint_SetCallbackPin(sns_power_PCINT_ch2, POWER_SNS_PIN_ch2, &sns_power_pcint_callback_ch2);

	MeasurmentBufferPointer_ch2 = 0;
#endif
	Timer_SetTimeout(sns_power_SEND_TIMER, sns_power_ReportInterval*1000 , TimerTypeFreeRunning, 0);
#if sns_power_SEND_1_MIN_AVG == 1
	Timer_SetTimeout(sns_power_SEND_TIMER_1_MIN_AVG, 60000-10 , TimerTypeFreeRunning, &sns_power_timer_callback);
#endif
}
开发者ID:codesburner,项目名称:HomeAutomation,代码行数:46,代码来源:sns_power.c

示例13: was_bootloader_requested

bool
was_bootloader_requested()
{
    bool requested = (eeprom_read_word((uint16_t *)Board::kConfigMagic) == Board::kBLMagic);
    eeprom_update_word((uint16_t *)Board::kConfigMagic, 0xffff);

    return requested;
}
开发者ID:John-Titor,项目名称:LIN_Nodes,代码行数:8,代码来源:board.cpp

示例14: init

inline void init()
{
  uint16_t wfc_timeout = eeprom_read_word(U16P(eeprom::WFC_TIMEOUT));
  cmdProcessor::init(wfc_timeout);
  pwm::init();
  transceiver::init(cmdProcessor::processCommand);

  sei();
}
开发者ID:fengye0316,项目名称:car-driver,代码行数:9,代码来源:car-driver.cpp

示例15: settings_get_word

uint16_t settings_get_word(uint8_t key)
{
	if (key < WordSettingsKeyCount)
	{
		return eeprom_read_word(&eeWordSettings[key]);
	}

	return 0;
}
开发者ID:bkbme,项目名称:CALLogViewer,代码行数:9,代码来源:settings.c


注:本文中的eeprom_read_word函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。