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


C++ eeprom_read函数代码示例

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


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

示例1: metering_init

void
metering_init(void)
{
  /* Load reference values from EEPROM */
  metering_reference_value = eeprom_read_word((void*) EE_METERING_REF );
  metering_calibration_power = eeprom_read_word((void*)EE_METERING_CAL_LOAD);

#if METERING_ENERGY
  // reset energy metering value
  metering_pulses = metering_pulses_total = 0;
#if METERING_ENERGY_PERSISTENT
  DDRB &= ~(1 << METERING_POWERDOWN_DETECT_PIN); // Set PB3 as input -> Cut trace to relay, add voltage divider instead.
  DDRB &= ~(1 << METERING_ANALOG_COMPARATOR_REF_PIN); // Set PB2 as input
  PORTB &= ~(1 << METERING_POWERDOWN_DETECT_PIN); // no internal pullup
  PORTB &= ~(1 << METERING_ANALOG_COMPARATOR_REF_PIN); // no internal pullup
  ENABLE_POWERDOWN_INTERRUPT();
  sei(); // global interrupt enable

  eeprom_read((uint8_t*)EE_ENERGY_METERING_PULSES_TOTAL, (uint8_t*)&metering_pulses_total, sizeof(metering_pulses));
  eeprom_read((uint8_t*)EE_ENERGY_METERING_PULSES, (uint8_t*)&metering_pulses, sizeof(metering_pulses));
#endif // METERING_ENERGY_PERSISTENT
#endif // METERING_ENERGY

  SET_METERING_INT();

  metering_start();

	ENDPOINT_REGISTER(endpoint_power);
#if METERING_ENERGY
	ENDPOINT_REGISTER(endpoint_energy_total);
	ENDPOINT_REGISTER(endpoint_energy);
#endif
}
开发者ID:ChristianKniep,项目名称:hexabus,代码行数:33,代码来源:metering.c

示例2: read_settings_from_eeprom

/*==============================================================================
Name    : read_settings_from_eeprom
--------------------------------------------------------------------------------
Purpose : Will read settings from EEPROM
Input   :
Output  :
Notes   : Data is stored in 'eeprom_gv_block[]' in the format shown above
==============================================================================*/
void read_settings_from_eeprom(void)
{
   uint8_t i;
   /* Read Global configuration */
   qt_config_data.qt_recal_threshold =(recal_threshold_t)
      eeprom_read(EEPROM_LIB_CONFIG_START_ADDRESS + 0u);
   qt_config_data.qt_di              =
      eeprom_read(EEPROM_LIB_CONFIG_START_ADDRESS + 1u);
   qt_config_data.qt_drift_hold_time =
      eeprom_read(EEPROM_LIB_CONFIG_START_ADDRESS + 2u);
   qt_config_data.qt_max_on_duration =
      eeprom_read(EEPROM_LIB_CONFIG_START_ADDRESS + 3u);
   qt_config_data.qt_neg_drift_rate  =
      eeprom_read(EEPROM_LIB_CONFIG_START_ADDRESS + 4u);
   qt_config_data.qt_pos_drift_rate  =
      eeprom_read(EEPROM_LIB_CONFIG_START_ADDRESS + 5u);
   qt_config_data.qt_pos_recal_delay =
      eeprom_read(EEPROM_LIB_CONFIG_START_ADDRESS + 6u);
   /* Read Sensor specific configuration */
   for(i = 0u; i < num_sensors; i++)
   {
      sensors[i].threshold =
         eeprom_read(EEPROM_LIB_CONFIG_START_ADDRESS + 7u + (i * 2u));
      sensors[i].type_aks_pos_hyst =
         eeprom_read(EEPROM_LIB_CONFIG_START_ADDRESS + 8u + (i * 2u));
   }
   /* Read burst length for all channels */
   #ifdef _QMATRIX_
      uint16_t address = EEPROM_LIB_CONFIG_START_ADDRESS + 7u + (num_sensors * 2u);
      for(i = 0u; i < QT_NUM_CHANNELS; i++)
      {
         qt_burst_lengths[i] = eeprom_read((address + i));
      }
   #endif
}
开发者ID:GordonMcGregor,项目名称:luminous,代码行数:43,代码来源:eeprom_access.c

示例3: eeprom_apply_settings

//**************************************************************************
void eeprom_apply_settings(void)
{
  if(eeprom_read(contrast_address)!=Settings.contrast)       
	{
		display_off();
		delay_ms(200);
		display_on();
	}
	// -------------------------------------------------------------------
  if(eeprom_read(Display_reverse_address)!=Settings.Display_reverse)
	{
		display_off();
		delay_ms(200);
		display_on();
	}
	// -------------------------------------------------------------------
  if(eeprom_read(v4_target_pump_address)!=Settings.v4_target_pump)
	{
		reset_TIM_prescallers_and_Compare();	
	}
	// -------------------------------------------------------------------
	if(eeprom_read(Geiger_voltage_address) !=Settings.Geiger_voltage) 
 	{
		dac_reload(); //перезагрузить в ЦАП новое напряжение отсечки накачки
 	}
	// -------------------------------------------------------------------
	if(eeprom_read(LSI_freq_address)       !=Settings.LSI_freq)
  {
		if(Settings.LSI_freq != 0x00) // если запустился кварц, попытки сохранения игнорировать
		{
			eeprom_write(LSI_freq_address,Settings.LSI_freq);   NVIC_SystemReset();
		}
	}
}
开发者ID:htol,项目名称:ultramicron,代码行数:35,代码来源:eeprom.c

示例4: connectWifi

/***********************************************************************
		module		:	[WIFI]
		function	:	[连接网络]
  		return		:	[无]
		comment		:	[全局普通函数]
		machine		:	[EH-0818]
		language	:	[CHN]
 		keyword		:	[WIFI]
		date		:	[11/07/27]
 		author		:	[chen-zhengkai]
************************************************************************/
void connectWifi()
{
	//u16 pHandle[1] = {0};	//wifi连接句柄
	//unsigned char pHandle_char[2] = {0};	//wifi连接句柄存放数组
	char dspBuf[20] = {0};
	char serverPort[20] = {0};
	unsigned char serverIPAdd[16] = {0};
	
	//CWiFi_OpenMould();
	if (eeprom_read(serverIPAdd, sizeof(serverIPAdd), EEPROM_OFFSET_SERVERIPADD)) {
		strcpy(dspBuf, "读取IP失败");
	}
	if (eeprom_read(serverPort, 8, EEPROM_OFFSET_SERVERPORT)) {
		strcpy(dspBuf, "读取端口失败");
	}
	else if(NaNo_OK == CWiFi_Connect(g_pHandle, (char*)serverIPAdd, serverPort, 0)) {
		strcpy(dspBuf, "连接成功");
		//shortTochar(g_pHandle, pHandle_char);
		//eeprom_write(pHandle_char, sizeof(pHandle_char), EEPROM_OFFSET_WIFI_HANDLE);
	}
	else {
		//..注:若连接失败,则需要30秒后再次连接
		strcpy(dspBuf, "连接失败");
		CWiFi_ConnState(0);
	}

	DispStr_CE(0,6,dspBuf,DISP_CENTER|DISP_NORMAL|DISP_CLRSCR);
	DispStr_CE(0,8,"按任意键继续",DISP_CENTER);
	delay_and_wait_key( 3, EXIT_KEY_ALL, 0 );
}
开发者ID:BaixiangLiu,项目名称:ykt4sungard,代码行数:41,代码来源:wifi_con.c

示例5: eeprom_restore_data

void eeprom_restore_data()
{
    uint8_t buf_req[200] = {0};  // ThingSet request buffer, initialize with zeros

    // EEPROM header
    uint8_t buf_header[EEPROM_HEADER_SIZE];
    if (eeprom_read(0, buf_header, EEPROM_HEADER_SIZE) < 0) {
        printf("EEPROM: read error!\n");
        return;
    }
    uint16_t version = *((uint16_t*)&buf_header[0]);
    uint16_t len     = *((uint16_t*)&buf_header[2]);
    uint32_t crc     = *((uint32_t*)&buf_header[4]);

    //printf("EEPROM header restore: ver %d, len %d, CRC %.8x\n", version, len, (unsigned int)crc);
    //printf("Header: %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x\n",
    //    buf_header[0], buf_header[1], buf_header[2], buf_header[3],
    //    buf_header[4], buf_header[5], buf_header[6], buf_header[7]);

    if (version == EEPROM_VERSION && len <= sizeof(buf_req)) {
        eeprom_read(EEPROM_HEADER_SIZE, buf_req, len);

        //printf("Data (len=%d): ", len);
        //for (int i = 0; i < len; i++) printf("%.2x ", buf_req[i]);

        if (_calc_crc(buf_req, len) == crc) {
            int status = ts.init_cbor(buf_req, sizeof(buf_req));     // first byte is ignored
            printf("EEPROM: Data objects read and updated, ThingSet result: %d\n", status);
        }
        else {
            printf("EEPROM: CRC of data not correct, expected 0x%x (data_len = %d)\n", (unsigned int)crc, len);
        }
    }
}
开发者ID:LibreSolar,项目名称:MPPT-Charger-12A_Software,代码行数:34,代码来源:eeprom.cpp

示例6: calLibRead

boolean calLibRead(byte device, CALLIB_DATA *calData)
{
  byte *ptr = (byte *)calData;
  byte length = sizeof(CALLIB_DATA);
  int eeprom = MPU9150_CAL + sizeof(CALLIB_DATA) * device;

  calData->magValid = false;
  calData->accelValid = false;

  char d[2];
  memset(d, 0, sizeof d);
  eeprom_read(&d[0], eeprom, 1);
  eeprom_read(&d[1], eeprom+1, 1);
  if ((d[0] != CALLIB_DATA_VALID_LOW) ||
      (d[1] != CALLIB_DATA_VALID_HIGH)) {
    printf("NO CALIBRATION DATA FOUND\n");
    return false;                                  // invalid data
  }
    
  for (unsigned i = 0; i < length; i++)
    eeprom_read(ptr++, eeprom + i, 1);

  printf("Calibration data found\n");
  return true;  
}
开发者ID:Tjeerdm,项目名称:Raspberry-Pi-Sensorbox,代码行数:25,代码来源:CalLib.cpp

示例7: xpl_init_instance_id

//////////////////////////////////////////////////////////
// xpl_init_instance_id
// Get the instance id from EEPROM, and set to 'default'
//  if no ID is present in the EEPROM
void xpl_init_instance_id(void) {
    char count;

	xpl_node_configuration = 0;

	// Get the instance ID from EEPROM
	// Maximum size = 16 chars + 1 null char
	for (count = 0; count < 16; count++){
		xpl_instance_id[count] = eeprom_read(count+XPL_EEPROM_INSTANCE_ID_OFFSET);

		// When we encounter the null, stop reading
		if (xpl_instance_id[count] == '\0') { 
			xpl_node_configuration |= NODE_CONFIGURED;
			break;
		} 

		// When the first char is 0xFF, flash is uninitialised
		if (count == 0 && xpl_instance_id[0] == 0xFF) {
			sprintf(xpl_instance_id, "default");
			eeprom_write(XPL_EEPROM_OUPUTS_COUNT,'0');
            eeprom_write(XPL_EEPROM_INPUTS_COUNT,'0');
			break;
		}
	}
	output_count = eeprom_read(XPL_EEPROM_OUPUTS_COUNT);
	input_count = eeprom_read(XPL_EEPROM_INPUTS_COUNT);
}    
开发者ID:cobree,项目名称:hasy,代码行数:31,代码来源:xpl.c

示例8: load_int_from_eeprom

unsigned int load_int_from_eeprom( unsigned char add )
{
  unsigned int a;
  a = eeprom_read( add );
  a <<= 8;
  a += eeprom_read( add + 1 );
  return a;
}
开发者ID:Gioragg1,项目名称:Shira_2,代码行数:8,代码来源:func.c

示例9: read_alerts

void read_alerts()
{
unsigned char i=0;
a.min=eeprom_read(0);
a.hour=eeprom_read(1);
a.ae=eeprom_read(2);
for (i=3; i<10; i++) a.dow[i-3]=eeprom_read(i);
t_delay=eeprom_read(10);
}
开发者ID:darknesmonk,项目名称:clock,代码行数:9,代码来源:func.c

示例10: is_valid_card

unsigned int is_valid_card(){
	eeprom_read(0x00);
	eeprom_read(0x00);
	if (dataword==0xe8){
		return 1;
	} else {
		return 0;
	}
}
开发者ID:eni,项目名称:free-laundry,代码行数:9,代码来源:laundrycard.c

示例11: read_info_from_eeprom

/*==============================================================================
Name    : read_info_from_eeprom
--------------------------------------------------------------------------------
Purpose : Read Info block from EEPROM
Input   :
Output  :
Notes   : Returns library version currently on chip
==============================================================================*/
uint16_t read_info_from_eeprom( void )
{
   uint16_t rtnval;

   /* The first two bytes stored in EEPROM is the library version */
   rtnval = (uint16_t)(eeprom_read(EEPROM_START_ADDRESS));
   rtnval |= (uint16_t)(eeprom_read(EEPROM_START_ADDRESS + 1u)) << 8u;
   return rtnval;
}
开发者ID:GordonMcGregor,项目名称:luminous,代码行数:17,代码来源:eeprom_access.c

示例12: firmware_get_sector_length

unsigned int firmware_get_sector_length(unsigned char sector)
{
    unsigned int length;

    // little endian...
    length  = ( (unsigned int) eeprom_read(2L*sector + 1) ) << 8;
    length += eeprom_read(2L*sector);

    return length;
}
开发者ID:macbre,项目名称:telemetry,代码行数:10,代码来源:firmware.c

示例13: ex_isa_attach

static int
ex_isa_attach(device_t dev)
{
    struct ex_softc *	sc = device_get_softc(dev);
    int			error = 0;
    u_int16_t		temp;

    sc->dev = dev;
    sc->ioport_rid = 0;
    sc->irq_rid = 0;

    if ((error = ex_alloc_resources(dev)) != 0) {
        device_printf(dev, "ex_alloc_resources() failed!\n");
        goto bad;
    }

    /*
     * Fill in several fields of the softc structure:
     *	- I/O base address.
     *	- Hardware Ethernet address.
     *	- IRQ number (if not supplied in config file, read it from EEPROM).
     *	- Connector type.
     */
    sc->iobase = rman_get_start(sc->ioport);
    sc->irq_no = rman_get_start(sc->irq);

    ex_get_address(sc->iobase, sc->arpcom.ac_enaddr);

    temp = eeprom_read(sc->iobase, EE_W0);
    device_printf(sc->dev, "%s config, %s bus, ",
                  (temp & EE_W0_PNP) ? "PnP" : "Manual",
                  (temp & EE_W0_BUS16) ? "16-bit" : "8-bit");

    temp = eeprom_read(sc->iobase, EE_W6);
    printf("board id 0x%03x, stepping 0x%01x\n",
           (temp & EE_W6_BOARD_MASK) >> EE_W6_BOARD_SHIFT,
           temp & EE_W6_STEP_MASK);

    if ((error = ex_attach(dev)) != 0) {
        device_printf(dev, "ex_attach() failed!\n");
        goto bad;
    }

    error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET,
                           ex_intr, (void *)sc, &sc->ih);
    if (error) {
        device_printf(dev, "bus_setup_intr() failed!\n");
        goto bad;
    }

    return(0);
bad:
    ex_release_resources(dev);
    return (error);
}
开发者ID:MarginC,项目名称:kame,代码行数:55,代码来源:if_ex_isa.c

示例14: loadPortInfo

////////////////////////////////////////////////////////////
// LOAD PORT INFO FROM EEPROM
void loadPortInfo(byte forceReload)
{
	byte cs = 0;
	for(int i=0; i<NUM_PORTS; ++i)
	{
		PORT_INFO *p = port[i];
		memset(p, 0, sizeof(PORT_INFO));
		
		int eepromAddr = 16 * i;
		p->cfg.triggerChannel 	 = eeprom_read(eepromAddr + 0);
		p->cfg.triggerNote 		 = eeprom_read(eepromAddr + 1);
		p->cfg.durationMax		 = (int)eeprom_read(eepromAddr + 2) << 8;
		p->cfg.durationMax	    |= (int)eeprom_read(eepromAddr + 3);
		p->cfg.durationModulator = eeprom_read(eepromAddr + 4);
		p->cfg.dutyMax			 = eeprom_read(eepromAddr + 5);
		p->cfg.dutyModulator	 = eeprom_read(eepromAddr + 6);		
		byte flags = eeprom_read(eepromAddr + 7);
		p->cfg.invert = !!(flags & EEPROM_FLAG_INVERT);
		
		// default to full duration/duty
		p->status.duration = p->cfg.durationMax;
		p->status.duty = p->cfg.dutyMax;
		
		calcCheckSum((byte*)&p->cfg, sizeof(PORT_CONFIG), &cs); 
	}
	
	if(forceReload || eeprom_read(EEPROM_ADDR_CHECKSUM) != cs)
	{
		// failed checksum (possibly no previous stored config)
		flashLed(10);
		initPortInfo();
		savePortInfo();
	}
}
开发者ID:hotchk155,项目名称:MIDI-Switcher,代码行数:36,代码来源:midi-switcher.c

示例15: read_mac

static void read_mac(void) {
	if (has_eeprom) {
		uint32_t t;
		t = eeprom_read(0);
		mac[0] = t & 0xFF;
		mac[1] = t >> 8;
		t = eeprom_read(1);
		mac[2] = t & 0xFF;
		mac[3] = t >> 8;
		t = eeprom_read(2);
		mac[4] = t & 0xFF;
		mac[5] = t >> 8;
	} else {
开发者ID:klange,项目名称:ponyos,代码行数:13,代码来源:e1000.c


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