本文整理汇总了C++中eeprom_write函数的典型用法代码示例。如果您正苦于以下问题:C++ eeprom_write函数的具体用法?C++ eeprom_write怎么用?C++ eeprom_write使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eeprom_write函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: test_write
static void
test_write(void)
{
printf("Debug: test eeprom_write ... ");
/*
* Write twice, 8 bytes per write
*/
eeprom_write (CONFIG_SYS_I2C_EEPROM_ADDR, EEPROM_TEST_OFFSET,
testbuf, 8);
eeprom_write (CONFIG_SYS_I2C_EEPROM_ADDR, EEPROM_TEST_OFFSET+8,
testbuf, 16);
printf("done\n");
pll_debug(EEPROM_TEST_OFFSET);
}
开发者ID:OpenInkpot-archive,项目名称:uboot-n516,代码行数:16,代码来源:cmd_pll.c
示例17: eeprom_store_data
void eeprom_store_data()
{
uint8_t buf[200] = {0}; // initialize with zeros
int len = ts.pub_msg_cbor(buf + EEPROM_HEADER_SIZE, sizeof(buf) - EEPROM_HEADER_SIZE, eeprom_data_objects, sizeof(eeprom_data_objects)/sizeof(uint16_t));
uint32_t crc = _calc_crc(buf + EEPROM_HEADER_SIZE, len);
// store EEPROM_VERSION, number of bytes and CRC
*((uint16_t*)&buf[0]) = (uint16_t)EEPROM_VERSION;
*((uint16_t*)&buf[2]) = (uint16_t)(len); // length of data
*((uint32_t*)&buf[4]) = crc;
//printf("Data (len=%d): ", len);
//for (int i = 0; i < len; i++) printf("%.2x ", buf[i + EEPROM_HEADER_SIZE]);
//printf("Header: %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x\n",
// buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
if (len == 0) {
printf("EEPROM: Data could not be stored, ThingSet error: %d\n", len);
}
else if (eeprom_write(0, buf, len + EEPROM_HEADER_SIZE) < 0) {
printf("EEPROM: Write error.\n");
}
else {
printf("EEPROM: Data successfully stored.\n");
}
}
开发者ID:LibreSolar,项目名称:MPPT-Charger-12A_Software,代码行数:28,代码来源:eeprom.cpp
示例18: handle_vendorcommand
BOOL handle_vendorcommand(BYTE cmd)
{
WORD addr=SETUP_VALUE(),len=SETUP_LENGTH();
switch ( cmd ) {
case VC_EPSTAT:
{
xdata BYTE* pep= ep_addr(SETUPDAT[2]);
if (pep) {
EP0BUF[0] = *pep;
EP0BCH=0;
EP0BCL=1;
return TRUE;
}
}
break;
case VC_EEPROM:
{
// wait for ep0 not busy
switch (SETUP_TYPE) {
case 0xc0:
while (len) { // still have bytes to read
// can't read more than 64 bytes at a time
BYTE cur_read = len > 64 ? 64 : len;
while (EP0CS&bmEPBUSY); // can't do this until EP0 is ready
eeprom_read(0x51, addr, cur_read, EP0BUF );
EP0BCH=0;
SYNCDELAY();
EP0BCL=cur_read;
len -= cur_read;
addr += cur_read;
}
break;
case 0x40:
while (len) {
BYTE cur_write;
EP0BCL = 0; // allow pc transfer in
while(EP0CS & bmEPBUSY); // wait
cur_write=EP0BCL;
if ( !eeprom_write(0x51, addr, cur_write, EP0BUF ) ) return FALSE;
addr += cur_write;
len -= cur_write;
}
break;
default:
return FALSE; // bad type
}
printf ( "All OK\n" );
return TRUE;
}
break;
default:
{
printf ( "Need to implement vendor command: %02x\n", cmd );
return FALSE;
}
}
return FALSE;
}
开发者ID:AessentTechnology,项目名称:aes220,代码行数:60,代码来源:reset.c
示例19: do_i2c_test
static result_t do_i2c_test(uint8 slot)
{
#define MDC_IIC_TEST_STR "MDC IIC TEST"
uint8 buf[16] = {0};
int retval;
iic_device_t device;
if(SLOT_1 == slot){
device = MDC_SLOT1_IIC;
}else if(SLOT_2 == slot){
device = MDC_SLOT2_IIC;
}else{
return MDC_TEST_FAIL;
}
retval = eeprom_write(device, 0, (uint8 *)MDC_IIC_TEST_STR, strlen(MDC_IIC_TEST_STR));
if(retval == strlen(MDC_IIC_TEST_STR)){
retval = eeprom_read(device, 0, buf, strlen(MDC_IIC_TEST_STR));
if(retval == strlen(MDC_IIC_TEST_STR)){
if(!strcmp((char *)buf, MDC_IIC_TEST_STR)){
return MDC_TEST_PASS;
}
}
}
return MDC_TEST_FAIL;
}
开发者ID:saiyn,项目名称:OSAL,代码行数:30,代码来源:Mdc.c
示例20: 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
注:本文中的eeprom_write函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论