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


C++ eeprom_write函数代码示例

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


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

示例1: eepromWriteOD

// Write predefined object to EEPROM
static uint8_t eepromWriteOD(subidx_t *pSubidx, uint8_t Len, uint8_t *pBuf)
{
    uint16_t Base;

    Base = pSubidx->Base;

    switch(pSubidx->Type)
    {
        case objBool:
        case objInt8:
        case objUInt8:
            Len = sizeof(uint8_t);
            break;
        case objInt16:
        case objUInt16:
            Len = sizeof(uint16_t);
            break;
        case objInt32:
        case objUInt32:
            Len = sizeof(uint32_t);
            break;
        case objString:
        case objArray:
            eeprom_write(&Len, Base, 1);
            if(Len == 0)
                return MQTTSN_RET_ACCEPTED;
            Base++;
            break;
        default:
            return MQTTSN_RET_REJ_NOT_SUPP;
    }
    eeprom_write(pBuf, Base, Len);
    return MQTTSN_RET_ACCEPTED;
}
开发者ID:Wassili-Hense,项目名称:Vers3,代码行数:35,代码来源:ObjDict.c

示例2: 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

示例3: SMS_Format

void SMS_Format(void)
{
	u8 i;
	u16 BaseAddr;
#ifdef SMS_DEBUG_ON
	u8 index;
#endif 

	for (i=0;i<SMS_MAX;i++)
	{
		BaseAddr=SMS_Base_Addr(i); ///<获得第i个存储区的基地址
		eeprom_write(&i,BaseAddr,1);
		eeprom_write("\0",BaseAddr+SMS_INDEX_LEN,1);
		eeprom_write("\0",BaseAddr+SMS_INDEX_LEN+SMS_TITLE_MAX_LEN,1);
	}
	///用于验证格式化的结果
 #ifdef SMS_DEBUG_ON
	for (i=0;i<SMS_MAX;i++)
	{
		BaseAddr=SMS_Base_Addr(i); ///<获得第i个存储区的基地址
		eeprom_read(&index,BaseAddr,1);
		printf("%d->%d\r\n",i,index);
	}
	printf("格式化短信息存储区成功\r\n");
 #endif
}
开发者ID:scarecrowli,项目名称:LCD_TTS_Code,代码行数:26,代码来源:SMSAPP.c

示例4: save_int_to_eeprom

void save_int_to_eeprom( unsigned char add, unsigned int data )
{
  eeprom_write( add, Hi( data ) );                             //and save msb
  DelayMs( 10 );
  eeprom_write( add + 1, Lo( data ) );                      //and lsb
  DelayMs( 10 );
}
开发者ID:Gioragg1,项目名称:Shira_2,代码行数:7,代码来源:func.c

示例5: local_device_info_save

/* 保存本地设备信息 */
void local_device_info_save()
{
    UINT8 i, ret;
    struct kfish_ctrl info;
    /* cfg avail */
    /* get device name */
    ret = eeprom_write(EEPROM_OFS_DEV_NAME, (UINT8 *)__device_name, 
		       strlen(__device_name) + 1);
    DBG_PRINT("mod dev name %s, modify %d bytes\n", __device_name, ret);
    
    /* get controller info */
    for(i=0; i<__local_ctrl_num; i++){
        DBG_PRINT("save %d\n", i);
        memcpy((char *)&info, (char *)&__local_ctrl[i], sizeof(struct kfish_ctrl));
        /* clear dynamic */
        memset((char *)info.ctrl.swi.rsv, 0, 8);
        ret = eeprom_write(EEPROM_OFS_CTRL(i), (UINT8*)&info, sizeof(struct kfish_ctrl));
        if(ret > 0){
            DBG_PRINT("save, modify %d bytes\n", ret);
        }else{
            DBG_PRINT("save, info not changed\n");
        }
    }
    EEPROM_put(EEPROM_OFS_DEV_INFOAVAIL, DEVICE_INFO_MAGIC);
}
开发者ID:kemaliu,项目名称:kFishTank,代码行数:26,代码来源:kTankCfg.c

示例6: write_alerts

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

示例7: node_id_burn

/*---------------------------------------------------------------------------*/
void
node_id_burn(unsigned short id)
{
  unsigned char buf[2];
  buf[0] = 0xad;
  buf[1] = 0xde;
  eeprom_write(NODE_ID_EEPROM_OFFSET, buf, 2);
  buf[0] = id >> 8;
  buf[1] = id & 0xff;
  eeprom_write(NODE_ID_EEPROM_OFFSET + 2, buf, 2);
}
开发者ID:Ammar-85,项目名称:contiki-arduino,代码行数:12,代码来源:node-id.c

示例8: write_sensor_settings_to_eeprom

/*==============================================================================
Name    : write_sensor_settings_to_eeprom
--------------------------------------------------------------------------------
Purpose : Save sensor parameter settings to EEPROM
Input   :
Output  :
Notes   :
==============================================================================*/
void write_sensor_settings_to_eeprom(void)
{
   uint8_t i;
   for(i = 0u; i < num_sensors; i++)
   {
      eeprom_write((EEPROM_LIB_CONFIG_START_ADDRESS + 7u + (i * 2u)),
                   sensors[i].threshold);
      eeprom_write((EEPROM_LIB_CONFIG_START_ADDRESS + 8u + (i * 2u)),
                   sensors[i].type_aks_pos_hyst);
   }
}
开发者ID:GordonMcGregor,项目名称:luminous,代码行数:19,代码来源:eeprom_access.c

示例9: main

int
main(void)
{
  u2_init();

  putstr("\nFactory Test, Board Rev 3.0\n");

  bool ok = true;
  unsigned char maj = HW_REV_MAJOR;
  unsigned char min = HW_REV_MINOR;
  ok = eeprom_write(I2C_ADDR_MBOARD, MBOARD_REV_MSB, &maj, 1);
  ok &= eeprom_write(I2C_ADDR_MBOARD, MBOARD_REV_LSB, &min, 1);

  putstr("\nset_hw_rev\n");
  if (ok)
    printf("OK: set h/w rev to %d.%d\n", HW_REV_MAJOR, HW_REV_MINOR);
  else {
    printf("FAILED to set h/w rev to %d.%d\n", HW_REV_MAJOR, HW_REV_MINOR);
    hal_finish();
    return 0;
  }

  if(test_sd())
    puts("SD OK\n");
  else {
    puts("SD FAIL\n");
    //hal_finish();
    //return 0;
  }
  if(test_ram())
    puts("RAM OK\n");
  else {
    puts("RAM FAIL\n");
    hal_finish();
    return 0;
  }

  print_mac_addr(ethernet_mac_addr()->addr);
  newline();

  clocks_mimo_config(MC_WE_LOCK_TO_SMA);

  while (!clocks_lock_detect()) {
    puts("No Lock");
    mdelay(1000);
  }
  puts("Clock Locked\n");

}
开发者ID:GREO,项目名称:GNU-Radio,代码行数:49,代码来源:burnrev30.c

示例10: qNVRAM_setDefaults

Status qNVRAM_setDefaults(nvram_t * p){
	p->rateController[ROLL].K = 0.01;
	p->rateController[ROLL].Ti = 1/0.1;
	p->rateController[ROLL].Td = 0.0;
	p->rateController[ROLL].Nd = 5.0;

	p->rateController[PITCH].K = 0.01;
	p->rateController[PITCH].Ti = 1/0.1;
	p->rateController[PITCH].Td = 0.0;
	p->rateController[PITCH].Nd = 5.0;


	p->attiController[ROLL].K = 1.0;
	p->attiController[ROLL].Ti = 1/0.02;
	p->attiController[ROLL].Td = 0.0;
	p->attiController[ROLL].Nd = 4.0;

	p->attiController[PITCH].K = 1.0;
	p->attiController[PITCH].Ti = 1/0.02;
	p->attiController[PITCH].Td = 0.0;
	p->attiController[PITCH].Nd = 4.0;

	// =========================================================
	p->rateController[YAW].K = 0.05;
	p->rateController[YAW].Ti = 1/0.1;
	p->rateController[YAW].Td = 0.000;
	p->rateController[YAW].Nd = 5;

	p->attiController[YAW].K = 5;
	p->attiController[YAW].Ti = 1/0.05;
	p->attiController[YAW].Td = 0.0;
	p->attiController[YAW].Nd = 4;

	return eeprom_write(EEPROM_ADDRESS,(uint8_t*)p,0x0000,sizeof(nvram_t));
}
开发者ID:Facu28,项目名称:firmware,代码行数:35,代码来源:nvram.c

示例11: setPassword

/***********************************************************************
		module		:	[WIFI]
		function		:	[设置连接服务器密码]
  		return		:	[无]
		comment	:	[全局普通函数]
		machine		:	[EH-0818]
		language	:	[CHN]
 		keyword		:	[WIFI]
		date			:	[11/08/24]
 		author		:	[chen-zhengkai]
************************************************************************/
void setPassword()
{
	char password[20] = {0};
	char retStr[20] = {0};
	char ret = -2;	//设置失败
	
	if (eeprom_read(password, 16, EEPROM_OFFSET_SEVPASSWORD)) {
		ret = -1;
	}
	if (ret != -1) {
		 InputData((char*)"密码", password, 1);
		if (password[0] != 0) {	//判断字符串不为空
			if (eeprom_write(password, 16, EEPROM_OFFSET_SEVPASSWORD)) {
				ret = -2;	//设置失败
			}
			else {
				ret = 0;	//设置成功
			}
		}
	}
	 if (!ret) {
		strcpy(retStr, "设置成功");
	}
	else if (ret == -1) {
		strcpy(retStr, "EEPROM访问失败");
	}
	else if (ret == -2) {
		strcpy(retStr, "设置失败");
	}
	DispStr_CE(0,6,retStr,DISP_CENTER|DISP_CLRSCR);
	DispStr_CE(0,8,"按任意键继续",DISP_CENTER);
	delay_and_wait_key( 3, EXIT_KEY_ALL, 0 );
}
开发者ID:BaixiangLiu,项目名称:ykt4sungard,代码行数:44,代码来源:wifi_con.c

示例12: xmux_config_write_test_data

void xmux_config_write_test_data()
{
	/* pid map table */
	{
	struct xmux_pid_map_table *t;

	t = &g_eeprom_param.pid_map_table_area.pid_map_table;
	build_pid_map_table();
	eeprom_write(EEPROM_OFF_PID_MAP_TABLE, t, sizeof(*t));
	}

	/* psi */
	{
	struct xmux_output_psi_data *data;
	data = &g_eeprom_param.output_psi_area.output_psi;
	data->pkt_nr = 10;
	data->psi_ents[0].offset = 0;
	data->psi_ents[0].nr_ts_pkts = 10;
	memset(data->ts_pkts, 0x47, 10);
	xmux_config_save_output_psi_data();
	}

	/* pid trans info */
	{
	build_pid_trans_info();
	xmux_config_save_pid_trans_info_all();
	}
}
开发者ID:wucan,项目名称:xmux,代码行数:28,代码来源:xmux_config.c

示例13: net_cs8900a_write_halfword

int
net_cs8900a_write_halfword (struct device_desc *dev, uint32 addr, uint16 data)
{
	struct net_device *net_dev = (struct net_device *) dev->dev;
	struct net_cs8900a_io *io = (struct net_cs8900a_io *) dev->data;

	int offset = (uint16) (addr - dev->base);
	int ret = ADDR_HIT;

	switch (offset) {
	case Tx_Frame_Port:
		frame_write (dev, data);
		break;
	case IO_TxCMD:
		io->tx_cmd = data;
		break;
	case IO_TxLength:
		io->tx_length = data;
		break;
	case PP_Address:
		io->pp_address = data;
		break;
	case PP_Data:
		if (io->pp_address >= 0x100 && io->pp_address < 0x140) {

			ctrl_status_write (dev, data);
		}
		switch (io->pp_address) {
		case PP_IntNum:
			io->int_num = data;
			break;
		case PP_EEPROMCommand:
			io->eeprom_cmd = data;
			eeprom_write (dev, data);
			break;
		case PP_EEPROMData:
			if (io->eeprom_writable == 1)
				io->eeprom_data = data;
			break;
		case PP_IA:
		case PP_IA + 2:
		case PP_IA + 4:
			io->ieee_addr[io->pp_address - PP_IA] = data & 0xff;
			io->ieee_addr[io->pp_address - PP_IA + 1] =
				(data >> 8) & 0xff;
			break;
		case PP_TxCMD:
			io->tx_cmd = data;
			break;
		case PP_TxLength:
			io->tx_length = data;
			break;
		}
		break;
	default:
		break;
	}

	return ret;
}
开发者ID:Jarvishappy,项目名称:tsinghua,代码行数:60,代码来源:dev_net_cs8900a.c

示例14: xmux_config_save_net_param

void xmux_config_save_net_param(struct xmux_net_param *net)
{
	net->csc = wu_csc(net, sizeof(*net) - 1);
	g_eeprom_param.net = *net;
	eeprom_write(EEPROM_OFF_NET, net, sizeof(*net));
	hex_dump("save net", &g_eeprom_param.net, sizeof(*net));
}
开发者ID:wucan,项目名称:xmux,代码行数:7,代码来源:xmux_config.c

示例15: eeprom_rw_test_1

static void eeprom_rw_test_1()
{
	int i, cnt = 0;
	uint8_t *wbuf = &g_eeprom_param;
	uint8_t *rbuf = &tmp_eeprom_param;

	while (1) {
		// write something
		for (i = 0; i < 1024; i++)
			wbuf[i] = i;
		memset(wbuf, cnt, NBYTES);
		cnt++;
		eeprom_write(0, wbuf, NBYTES);
		// read back
		memset(rbuf, 0xFF, NBYTES);
		eeprom_read(0, rbuf, NBYTES);
		// check
		for (i = 0; i < NBYTES; i++) {
			if (rbuf[i] != wbuf[i]) {
				trace_err("check failed begin at %#x!", i);
				hex_dump("write", &wbuf[i], NBYTES - i);
				hex_dump("read", &rbuf[i], NBYTES - i);
				break;
			}
		}
		if (i == NBYTES) {
			trace_info("check passed");
		}

		sleep(2);
		//break;
	}
	exit(0);
}
开发者ID:wucan,项目名称:xmux,代码行数:34,代码来源:xmux_config.c


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