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


C++ readEEPROM函数代码示例

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


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

示例1: read_app_register

////////////////////////////////////////////////////////////////////////////////
// read_app_register
//
void read_app_register( uint08_t reg )
{
	SendMsg.priority = VSCP_PRIORITY_MEDIUM;
	SendMsg.vscp_class = VSCP_CLASS1_PROTOCOL;
	SendMsg.vscp_type = VSCP_TYPE_PROTOCOL_RW_RESPONSE;
	SendMsg.length =  2;
	SendMsg.data[0] = reg;
	SendMsg.data[1] = 0x00; // default read

	switch ( reg ) {
		// Zone
		case 0x21:
			SendMsg.data[1] = readEEPROM( REG_APP_ZONE );
			break;
		// SubZone
		case 0x22:
			SendMsg.data[1] = readEEPROM( REG_DOOR_SUBZONE );
			break;		

		default:
			SendMsg.data[1] = 0;	
			break;	
	}
	// Send data
	VSCP_enqMsgTx( &SendMsg, FALSE);	
}
开发者ID:grodansparadis,项目名称:vscp_firmware,代码行数:29,代码来源:VSCP_app.c

示例2: write_app_register

///////////////////////////////////////////////////////////////////////////////
// write_app_register
//
void write_app_register( uint08_t reg, uint08_t val )
{
	SendMsg.priority = VSCP_PRIORITY_MEDIUM;
	SendMsg.vscp_class = VSCP_CLASS1_PROTOCOL;
	SendMsg.vscp_type = VSCP_TYPE_PROTOCOL_RW_RESPONSE;
	SendMsg.length = 2;
	SendMsg.data[0] = reg;
	SendMsg.data[1] = ~val; // error return

	switch ( reg ) {
		// Zone
		case 0x23:
			writeEEPROM( REG_APP_ZONE, val);
			SendMsg.data[1] = readEEPROM( REG_APP_ZONE);
			break;
		// SubZone
		case 0x24:
			writeEEPROM( REG_DOOR_SUBZONE, val);
			SendMsg.data[1] = readEEPROM( REG_DOOR_SUBZONE);
			break;	

		default:
			SendMsg.data[1] = ~val; // error return	
			break;
	}
	// Send data
	VSCP_enqMsgTx( &SendMsg, FALSE);	
} 
开发者ID:grodansparadis,项目名称:vscp_firmware,代码行数:31,代码来源:VSCP_app.c

示例3: flush

bool Persistence::load()
{
    //free any previous loaded data
    flush();

    //load variable count
    readEEPROM(_mainPosition, (byte *)&_count, sizeof(_count));

    //validate variable count
    if ( _count > 0 && _count < MAX_VARIABLES )
    {
        //load data size
        readEEPROM(_mainPosition + sizeof(_count), (byte *)&_size, sizeof(_size));

        //copy data
        if (_size > 0)
        {
            _properties = (Property *) malloc(_size);
            readEEPROM(_mainPosition + sizeof(_count) + sizeof(_size), (byte *)_properties, _size);
            fixPointers();
        }

        return true;
    }
    else
    {
        _count = 0;
        return false;
    }
}
开发者ID:jfis,项目名称:dmc3xl_timeline,代码行数:30,代码来源:Persistence.cpp

示例4: doActionCtrlLed

void doActionCtrlLed( unsigned char dmflags, unsigned char arg )
{
	unsigned char i;
	unsigned char val;
	uart_puts("action\n");	
	for ( i=0; i<8; i++ ) {
		
		// If the rely should not be handled just move on
		if ( !( arg & ( 1 << i ) ) ) continue;
		
		// Check if subzone should match and if so if it match
		if ( dmflags & VSCP_DM_FLAG_CHECK_SUBZONE ) {
			if ( vscp_imsg.data[ 2 ] != readEEPROM( VSCP_EEPROM_END + 
															REG_SWITCH0_SUBZONE + 
															i ) ) {
				continue;
			}
		}
			
		val = readEEPROM( VSCP_EEPROM_END + REG_SWITCH0_SUBZONE + i );
		
	
		PORTB ^= _BV(i);
									
//		// Should off event be sent?
//		if( val & RELAY_CONTROLBIT_ONEVENT ) {
//			SendInformationEvent( i, VSCP_CLASS1_INFORMATION, VSCP_TYPE_INFORMATION_ON );			
//		}
		
		// Should stop event be sent?
//		if( val & RELAY_CONTROLBIT_STARTEVENT ) {
//			SendInformationEvent( i, VSCP_CLASS1_INFORMATION, VSCP_TYPE_INFORMATION_START );
//		}
	}	
}
开发者ID:grodansparadis,项目名称:vscp_firmware,代码行数:35,代码来源:vscp_actions.c

示例5: main

int main(void)
{
	tm gmt;
	WatchDogDisable();
	NutDelay(100);
	SysInitIO();
	SPIinit();
	LedInit();
	LcdLowLevelInit();
	Uart0DriverInit();
	Uart0DriverStart();
	LogInit();
	LogMsg_P(LOG_INFO, PSTR("-----------------------------------------------------------------------------------------------"));
	CardInit();
	X12Init();
	if (X12RtcGetClock(&gmt) == 0)
	{
		LogMsg_P(LOG_INFO, PSTR("RTC time [%02d:%02d:%02d]\n"), gmt.tm_hour, gmt.tm_min, gmt.tm_sec );
	}
	if (At45dbInit() == AT45DB041B)
	{
		
	}
	RcInit();
	KbInit();
	SysControlMainBeat(ON);             // enable 4.4 msecs hartbeat interrupt
	NutThreadSetPriority(1);
	NutTimerInit();
	sei();

	printf("\nreading EEPROM\n");
	NutSleep(1000);
	readEEPROM();
	printf("UTC: %d\n",IMCconfig.UTC);
	NutSleep(1000);

	IMCconfig.UTC++;	
	printf("na ophoging UTC: %d\n",IMCconfig.UTC);
	saveEEPROM();
	NutSleep(1000);
	readEEPROM();
	printf("na saving en reading UTC: %d\n",IMCconfig.UTC);

	printf("\nResetting EEPROM\n");
	NutSleep(1000);
	resetEEPROM();
	NutSleep(1000);
	readEEPROM();

	for (;;)
	{
		
	}

	return(0);      // never reached, but 'main()' returns a non-void, so.....
}
开发者ID:MaurodeLyon,项目名称:Embedded-Software-Ontwikkeling,代码行数:56,代码来源:main.c

示例6: writeEEPROM

void writeEEPROM(uint8_t b, uint8_t updateProfile)
{
    FLASH_Status status;
    uint32_t i;
    uint8_t chk = 0;
    const uint8_t *p;
    int tries = 0;

    // prepare checksum/version constants
    mcfg.version = EEPROM_CONF_VERSION;
    mcfg.size = sizeof(master_t);
    mcfg.magic_be = 0xBE;
    mcfg.magic_ef = 0xEF;
    mcfg.chk = 0;

    // when updateProfile = true, we copy contents of cfg to global configuration. when false, only profile number is updated, and then that profile is loaded on readEEPROM()
    if (updateProfile) {
        // copy current in-memory profile to stored configuration
        memcpy(&mcfg.profile[mcfg.current_profile], &cfg, sizeof(config_t));
    }

    // recalculate checksum before writing
    for (p = (const uint8_t *)&mcfg; p < ((const uint8_t *)&mcfg + sizeof(master_t)); p++)
        chk ^= *p;
    mcfg.chk = chk;

//taskENTER_CRITICAL();

    // write it
retry:
    FLASH_Unlock();
    FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR);

    if (FLASH_ErasePage(FLASH_WRITE_ADDR) == FLASH_COMPLETE) {
        for (i = 0; i < sizeof(master_t); i += 4) {
            status = FLASH_ProgramWord(FLASH_WRITE_ADDR + i, *(uint32_t *) ((char *)&mcfg + i));
            if (status != FLASH_COMPLETE) {
                FLASH_Lock();
                tries++;
                if (tries < 3)
                    goto retry;
                else
                    break;
            }
        }
    }
    FLASH_Lock();

//taskEXIT_CRITICAL();

    // Flash write failed - just die now
    if (tries == 3 || !validEEPROM()) {
        failureMode(10);
    }

    // re-read written data
    readEEPROM();
    if (b)
        blinkLED(15, 20, 1);
}
开发者ID:kyuyoung,项目名称:SkyRover_Nano,代码行数:60,代码来源:config.c

示例7: writeParams

void writeParams(uint8_t b)
{
    FLASH_Status status;
    uint32_t i;
    uint8_t chk = 0;
    const uint8_t *p;

    cfg.version    = EEPROM_CONF_VERSION;
    cfg.size       = sizeof(config_t);
    cfg.magic_be   = 0xBE;
    cfg.magic_ef   = 0xEF;
    cfg.chk        = 0;
    for (p = (const uint8_t *)&cfg; p < ((const uint8_t *)&cfg + sizeof(config_t)); p++) chk ^= *p; // recalculate checksum before writing
    cfg.chk = chk;
    FLASH_Unlock();                                                                       // write it
    FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR);
  
    for (i = 0; i < FLASH_PAGES_FORCONFIG; i++)                                           // Erase the pages here
    {
        while (FLASH_ErasePage(FLASH_WRITE_ADDR + (i * FLASH_PAGE_SIZE)) != FLASH_COMPLETE);
    }

    for (i = 0; i < sizeof(config_t); i += 4)                                             // Write that config now.
    {
        status = FLASH_ProgramWord(FLASH_WRITE_ADDR + i, *(uint32_t *) ((char *) &cfg + i));
        if (status != FLASH_COMPLETE) break;                                              // TODO: fail
    }
    FLASH_Lock();
    readEEPROM();
    if (b) blinkLED(15, 20, 1);
}
开发者ID:slashphotos,项目名称:TestCode2,代码行数:31,代码来源:config.c

示例8: changeProfile

void changeProfile(uint8_t profileIndex)
{
    masterConfig.current_profile_index = profileIndex;
    writeEEPROM();
    readEEPROM();
    blinkLedAndSoundBeeper(2, 40, profileIndex + 1);
}
开发者ID:bennyh88,项目名称:cleanflight,代码行数:7,代码来源:config.c

示例9: writeParams

void writeParams(void)
{
    FLASH_Status status;
    uint32_t i;
    uint8_t chk = 0;
    const uint8_t *p;
    
    cfg.version = EEPROM_CONF_VERSION;
    cfg.size = sizeof(config_t);
    cfg.magic_be = 0xBE;
    cfg.magic_ef = 0xEF;
    cfg.chk = 0;
    // recalculate checksum before writing
    for (p = (const uint8_t *)&cfg; p < ((const uint8_t *)&cfg + sizeof(config_t)); ++p)
        chk ^= *p;
    cfg.chk = chk;
    
    // write it
    FLASH_Unlock();
    FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR);

    if (FLASH_ErasePage(FLASH_WRITE_ADDR) == FLASH_COMPLETE) {
        for (i = 0; i < sizeof(config_t); i += 4) {
            status = FLASH_ProgramWord(FLASH_WRITE_ADDR + i, *(uint32_t *)((char *)&cfg + i));
            if (status != FLASH_COMPLETE)
                while(1);//break; // TODO: fail
        }
    }

    FLASH_Lock();

    readEEPROM();
}
开发者ID:Zero3nna,项目名称:Optima-PPM,代码行数:33,代码来源:config.c

示例10: changeProfile

void changeProfile(uint8_t profileIndex)
{
    masterConfig.current_profile_index = profileIndex;
    writeEEPROM();
    readEEPROM();
    beeperConfirmationBeeps(profileIndex + 1);
}
开发者ID:kc10kevin,项目名称:betaflight,代码行数:7,代码来源:config.c

示例11: main

void main(void) {
    byte evalue;
    initSquareWear();
    setModeOutput(pinC7);
    latC7 = 0;
    delayMilliseconds(250); // short delay for EEPROM to stablize
    evalue = readEEPROM(0x0);   // read EEPROM address 0
    switch(evalue) {
        case 0:
            writeEEPROM(0x0, 1);    // write next index to EEPROM address 0
            busyEEPROM();           // wait till write completes
            while(1) {
                latC7 = !latC7;
                delayMilliseconds(100);
            }
            break;
        case 1:
            writeEEPROM(0x0, 2);
            busyEEPROM();
            while(1) {
                latC7 = !latC7;
                delayMilliseconds(500);
            }
            break;
        default:
            writeEEPROM(0x0, 0);
            busyEEPROM();
            while(1) {
                latC7 = !latC7;
                delayMilliseconds(1000);
            }
            break;

    }
}
开发者ID:3dlogixbydesign,项目名称:squarewear,代码行数:35,代码来源:SquareWearDemo.c

示例12: readStrEEPROM

void readStrEEPROM(char addr, unsigned char length, char *str)
{
	unsigned char i;
	
	for(i=0;i<length;i++)
		str[i] = readEEPROM(addr+i);
}
开发者ID:PedroDiogo,项目名称:POV,代码行数:7,代码来源:eeprom.c

示例13: writeParams

void writeParams(uint8_t b) {
  global_conf.currentSet=0;
  conf.checksum = calculate_sum((uint8_t*)&conf, sizeof(conf));
  eeprom_write_block((const void*)&conf, (void*)(global_conf.currentSet * sizeof(conf) + sizeof(global_conf)), sizeof(conf));
  readEEPROM();
  if (b == 1) blinkLED(15,20,1);
}
开发者ID:NVSL,项目名称:Quadcopter-Class-Lab-06,代码行数:7,代码来源:EEPROM.cpp

示例14: delay

void MLX90621::initialise(int refrate) {
	refreshRate = refrate;
	Wire.begin(I2C_MASTER, 0, I2C_PINS_18_19, I2C_PULLUP_INT, I2C_RATE_100);
	delay(5);
	readEEPROM();
	writeTrimmingValue();
	setConfiguration();
}
开发者ID:robinvanemden,项目名称:MLX90621_Arduino_Processing,代码行数:8,代码来源:MLX90621.cpp

示例15: pinMode

//Initializers that should be called in the `setup()` function
//Initizalize the pin as output and the last value received 
void SensorFlare::DigitalOut::begin()
{
    pinMode(number, OUTPUT);
    Spark.function("digital",controlPin);
    //Initialize the output with the last receive value from SensorFlare    
    readEEPROM();
    digitalWrite(number,EEPROMData.outputData.digitalPin[number]);
  
}
开发者ID:LPFraile,项目名称:Sensorflare-SparkCore,代码行数:11,代码来源:sensorflare.cpp


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