本文整理汇总了C++中eeprom_read函数的典型用法代码示例。如果您正苦于以下问题:C++ eeprom_read函数的具体用法?C++ eeprom_read怎么用?C++ eeprom_read使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eeprom_read函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: node_id_restore
/*---------------------------------------------------------------------------*/
void
node_id_restore(void)
{
unsigned char buf[2];
eeprom_read(NODE_ID_EEPROM_OFFSET, buf, 2);
if(buf[0] == 0xad &&
buf[1] == 0xde) {
eeprom_read(NODE_ID_EEPROM_OFFSET + 2, buf, 2);
node_id = (buf[0] << 8) | buf[1];
} else {
node_id = 0;
}
}
开发者ID:Ammar-85,项目名称:contiki-arduino,代码行数:14,代码来源:node-id.c
示例17: read_factory_r
/*****************************************************************************
* read "factory" part of EEPROM and set some environment variables
*****************************************************************************/
void read_factory_r (void)
{
/* read 'factory' part of EEPROM */
uchar buf[81];
uchar *p;
uint length;
uint addr;
uint len;
/* get length first */
addr = CFG_FACT_OFFSET;
if (eeprom_read (CFG_I2C_FACT_ADDR, addr, buf, 2)) {
bailout:
printf ("cannot read factory configuration\n");
printf ("be sure to set ethaddr yourself!\n");
return;
}
length = buf[0] + (buf[1] << 8);
addr += 2;
/* sanity check */
if (length < 20 || length > CFG_FACT_SIZE - 2)
goto bailout;
/* read lines */
while (length > 0) {
/* read one line */
len = length > 80 ? 80 : length;
if (eeprom_read (CFG_I2C_FACT_ADDR, addr, buf, len))
goto bailout;
/* mark end of buffer */
buf[len] = 0;
/* search end of line */
for (p = buf; *p && *p != 0x0a; p++);
if (!*p)
goto bailout;
*p++ = 0;
/* advance to next line start */
length -= p - buf;
addr += p - buf;
/*printf ("%s\n", buf); */
/* search for our specific entry */
if (!strncmp ((char *) buf, "[RLA/lan/Ethernet] ", 19)) {
setenv ("ethaddr", (char *)(buf + 19));
} else if (!strncmp ((char *) buf, "[BOARD/SERIAL] ", 15)) {
setenv ("serial#", (char *)(buf + 15));
} else if (!strncmp ((char *) buf, "[BOARD/TYPE] ", 13)) {
setenv ("board_id", (char *)(buf + 13));
}
}
}
开发者ID:380121850,项目名称:u-boot-mini2440,代码行数:54,代码来源:vpd.c
示例18: _read_loramac_config
static inline void _read_loramac_config(semtech_loramac_t *mac)
{
DEBUG("[semtech-loramac] reading configuration from EEPROM\n");
uint8_t magic[SEMTECH_LORAMAC_EEPROM_MAGIC_LEN] = {0};
size_t pos = SEMTECH_LORAMAC_EEPROM_START;
pos += eeprom_read(pos, magic, SEMTECH_LORAMAC_EEPROM_MAGIC_LEN);
if (strncmp((char*)magic, "RIOT", SEMTECH_LORAMAC_EEPROM_MAGIC_LEN) != 0) {
DEBUG("[semtech-loramac] no configuration present on EEPROM "
"(invalid magic '%s')\n", magic);
return;
}
/* LoRaWAN EUIs, Keys and device address */
pos += eeprom_read(pos, mac->deveui, LORAMAC_DEVEUI_LEN);
pos += eeprom_read(pos, mac->appeui, LORAMAC_APPEUI_LEN);
pos += eeprom_read(pos, mac->appkey, LORAMAC_APPKEY_LEN);
pos += eeprom_read(pos, mac->appskey, LORAMAC_APPSKEY_LEN);
pos += eeprom_read(pos, mac->nwkskey, LORAMAC_NWKSKEY_LEN);
pos += eeprom_read(pos, mac->devaddr, LORAMAC_DEVADDR_LEN);
/* uplink counter, mainly used for ABP activation */
uint8_t counter[4] = { 0 };
pos += eeprom_read(pos, counter, 4);
_set_uplink_counter(mac, counter);
}
开发者ID:OTAkeys,项目名称:RIOT,代码行数:27,代码来源:semtech_loramac.c
示例19: Modbus
void Modbus(uint8_t u8serno, uint8_t u8txenpin)
{
uint8_t tmpModbusId = eeprom_read(EE_MODBUS_ID);
if(tmpModbusId == 0xff)
tmpModbusId = DEFAULT_MODBUS_ID;
ModbusInit(tmpModbusId, u8serno, u8txenpin);
}
开发者ID:Reddds,项目名称:BOLID-C2000-BI,代码行数:7,代码来源:ModbusRtu.c
示例20: 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
注:本文中的eeprom_read函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论