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


C++ eeprom_read_block函数代码示例

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


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

示例1: usbFunctionRead

/*
 * EEPROM Quick macro reading
 */
uchar usbFunctionRead(uchar *data, uchar len)
{
    uchar i = len;
    usbMsgPtr_t r = usbMsgPtr;
    /* EEPROM data */
    /*do{
       uchar c = eeprom_read_byte(r);
       *data++ = c;
       r++;
    }while(--i);*/

    eeprom_read_block(data, (void *)r, i);

    usbMsgPtr = r + i;

    return len;
}
开发者ID:super-fishz,项目名称:ps2avrU,代码行数:20,代码来源:vusb.c

示例2: lcd_material_set_material

void lcd_material_set_material(uint8_t nr, uint8_t e)
{
    material[e].temperature = eeprom_read_word(EEPROM_MATERIAL_TEMPERATURE_OFFSET(nr));
    material[e].bed_temperature = eeprom_read_word(EEPROM_MATERIAL_BED_TEMPERATURE_OFFSET(nr));
    material[e].flow = eeprom_read_word(EEPROM_MATERIAL_FLOW_OFFSET(nr));

    material[e].fan_speed = eeprom_read_byte(EEPROM_MATERIAL_FAN_SPEED_OFFSET(nr));
    material[e].diameter = eeprom_read_float(EEPROM_MATERIAL_DIAMETER_OFFSET(nr));
    eeprom_read_block(material_name[e], EEPROM_MATERIAL_NAME_OFFSET(nr), MATERIAL_NAME_LENGTH);
    material_name[e][MATERIAL_NAME_LENGTH] = '\0';
    if (material[e].temperature > HEATER_0_MAXTEMP - 15)
        material[e].temperature = HEATER_0_MAXTEMP - 15;
    if (material[e].bed_temperature > BED_MAXTEMP - 15)
        material[e].bed_temperature = BED_MAXTEMP - 15;

    lcd_material_store_current_material();
}
开发者ID:norpchen,项目名称:Ultimaker2Marlin,代码行数:17,代码来源:UltiLCD2_menu_material.cpp

示例3: EeFsOpen

bool EeFsOpen()
{
  eeprom_read_block((uint8_t *)&eeFs, 0, sizeof(eeFs));

#ifdef SIMU
  if (eeFs.version != EEFS_VERS) {
    printf("bad eeFs.version (%d instead of %d)\n", eeFs.version, EEFS_VERS);
    fflush(stdout);
  }
  if (eeFs.mySize != sizeof(eeFs)) {
    printf("bad eeFs.mySize (%d instead of %d)\n", (int)eeFs.mySize, (int)sizeof(eeFs));
    fflush(stdout);
  }
#endif  

  return eeFs.version == EEFS_VERS && eeFs.mySize == sizeof(eeFs);
}
开发者ID:chrisshum128,项目名称:mbtx,代码行数:17,代码来源:eeprom_rlc.cpp

示例4: lcd_material_select_callback

static char* lcd_material_select_callback(uint8_t nr)
{
    uint8_t count = eeprom_read_byte(EEPROM_MATERIAL_COUNT_OFFSET());
    if (nr == 0)
        strcpy_P(card.longFilename, PSTR("< RETURN"));
    else if (nr == count + 1)
        strcpy_P(card.longFilename, PSTR("Customize"));
    else if (nr == count + 2)
        strcpy_P(card.longFilename, PSTR("Export to SD"));
    else if (nr == count + 3)
        strcpy_P(card.longFilename, PSTR("Import from SD"));
    else{
        eeprom_read_block(card.longFilename, EEPROM_MATERIAL_NAME_OFFSET(nr - 1), 8);
        card.longFilename[8] = '\0';
    }
    return card.longFilename;
}
开发者ID:fablabbcn,项目名称:Ultimaker2Marlin,代码行数:17,代码来源:UltiLCD2_menu_material.cpp

示例5: menu_init

//*******************************************************************************************
//
// Function : menu_init
// Description : initial I/O direction for all key,
// initial timer1 for countdown timer
//
//*******************************************************************************************
void menu_init ( void )
{	
	// setup countdown initial value
	sec_count = 0;
	eeprom_read_block ( count_time, ee_count_time, 3 );
	count_time[3] = 0;

	// setup menu and standby display
	flag1.byte = 0;
	flag2.byte = 0;
	menu_index = 0;
	submenu_index = 0;
	menu_stack = 0;
	submenu_stack = 0;
	setting_cursor = 0;
	standby_cursor = 1;
}
开发者ID:quahansudung,项目名称:AVRnet_RF_Smarthome,代码行数:24,代码来源:menu.c

示例6: MixerTable_ReadFromEEProm

uint8_t MixerTable_ReadFromEEProm(void)
{
	uint8_t crc;

	// calculate checksum in eeprom
	crc = EEProm_Checksum(EEPROM_ADR_MIXERTABLE, sizeof(Mixer) - 1);

	// check crc
	if( crc != eeprom_read_byte((uint8_t*)(EEPROM_ADR_MIXERTABLE + sizeof(Mixer) - 1)) ) return 0;

	// check revision
	if(eeprom_read_byte((uint8_t*)(EEPROM_ADR_MIXERTABLE)) != EEMIXER_REVISION) return 0;

	// read mixer table
	eeprom_read_block((void *) &Mixer, (void*)(EEPROM_ADR_MIXERTABLE), sizeof(Mixer));
	return 1;
}
开发者ID:wanglehui,项目名称:MikroKopterFlightController,代码行数:17,代码来源:eeprom.c

示例7: lcd_material_read_current_material

void lcd_material_read_current_material()
{
    for(uint8_t e=0; e<EXTRUDERS; e++)
        {
            material[e].temperature = eeprom_read_word(EEPROM_MATERIAL_TEMPERATURE_OFFSET(EEPROM_MATERIAL_SETTINGS_MAX_COUNT+e));
            material[e].bed_temperature = eeprom_read_word(EEPROM_MATERIAL_BED_TEMPERATURE_OFFSET(EEPROM_MATERIAL_SETTINGS_MAX_COUNT+e));
            material[e].flow = eeprom_read_word(EEPROM_MATERIAL_FLOW_OFFSET(EEPROM_MATERIAL_SETTINGS_MAX_COUNT+e));

            material[e].fan_speed = eeprom_read_byte(EEPROM_MATERIAL_FAN_SPEED_OFFSET(EEPROM_MATERIAL_SETTINGS_MAX_COUNT+e));
            material[e].diameter = eeprom_read_float(EEPROM_MATERIAL_DIAMETER_OFFSET(EEPROM_MATERIAL_SETTINGS_MAX_COUNT+e));
            strcpy_P(material_name[e],PSTR("???"));

            eeprom_read_block(material_name[e], EEPROM_MATERIAL_NAME_OFFSET(EEPROM_MATERIAL_SETTINGS_MAX_COUNT+e), MATERIAL_NAME_LENGTH);
            material_name[e][MATERIAL_NAME_LENGTH] = '\0';

        }
}
开发者ID:norpchen,项目名称:Ultimaker2Marlin,代码行数:17,代码来源:UltiLCD2_menu_material.cpp

示例8: load_events

void load_events()
{
	// initialize random number generator; it has to be done only once (after reset)
	srand(current_time());
	
	events_count = eeprom_read_byte(&events_count_ee);
	
	// initialize - for testing purposes
	/*
	if (events_count == 0)
	{
	send_string("add_default\r\n");
	add_default_events();
	}
	*/
	
	if (events_count == 0)
	{
		send_line("No events => MANUAL_MODE");
		event_mode = MANUAL_MODE;
		return;
	}
	
	// load events into ram
	eeprom_read_block(&events, &events_ee, sizeof(struct Event) * EVENTS_SIZE);
	
	// prepare
	prepare_actual_events();
	
	// print events
	print_events();
	
	// check current state of pins
	// if the device is power off, and later power on - it doesn't know what should be current state of pins
	
	int32_t time = current_time();
	send_string(" start time: ");
	
	char formatted_date[30];
	timeToString(time, formatted_date);
	send_string(formatted_date);
	send_enter();
	
	current_state();
}
开发者ID:snegtec,项目名称:MeropiModerariModuli,代码行数:45,代码来源:events.c

示例9: main

int main(int argc, const char *argv[])
{
    // Point stdout to serial stream (for testing to see adc value)
    stdout = &mystdout;

	// Initialize usart
	init_usart(BAUDRATE, TRANSMIT_RATE, DATA_BITS, STOP_BITS, PARITY_BITS);

	// printf("The first recipe is shown below!\n\n\n");

	char recipe_name[RECIPE_NAME_LENGTH];

    eeprom_read_block((void*)&recipe_name, (const void*)0x00, RECIPE_NAME_LENGTH);

    printf("Recipe Name: '%s'\n", recipe_name);

	return 0;
}
开发者ID:cjeustis,项目名称:senior-project,代码行数:18,代码来源:read_eeprom_test.c

示例10: enableUsbLines

// declares config and config_EEPROM
CFG_DECLARATION

#define enableUsbLines()	PORTD |= (1<<0)
#define disableUsbLines()	PORTD &= ~(1<<0);

void readConfig(uint8_t newConfig[CONFIG_BYTE_WIDTH + 2]) {
	 // read config from EEPROM
	eeprom_read_block(config, config_EEPROM, CONFIG_BYTE_WIDTH + 2);

	if(config[0] != CONFIG_DEVICE || config[1] != CONFIG_VERSION) {
		/* if EEPROM does not conform to current version and device set to default config */
        CONFIG_SET_DEFAULTS(newConfig)
	}
	else {
		for(int i = 0; i < (CONFIG_BYTE_WIDTH + 2); i++)
			newConfig[i] = config[i];
	}
}
开发者ID:IvIePhisto,项目名称:Dual-Strike,代码行数:19,代码来源:dualstrike.c

示例11: eeprom_read_block

// Return the key for a variable.
//
AP_Var::Key
AP_Var::key(void)
{
    Var_header  var_header;

    if (_group) {                   // group members don't have keys
        return k_key_none;
    }
    if (_key && k_key_not_located) {    // if not located, key is in memory
        return _key & k_key_mask;
    }

    // Read key from EEPROM, note that _key points to the space
    // allocated for storage; the header is immediately before.
    //
    eeprom_read_block(&var_header, (void *)(_key - sizeof(var_header)), sizeof(var_header));
    return var_header.key;
}
开发者ID:Artoko,项目名称:ardupilotdev,代码行数:20,代码来源:AP_Var.cpp

示例12: main

int
main (void)
{
  term_io_init ();

  // Delay a bit at startup to give use time to launch screen and watch the
  // initial values of thigs after reprogramming or changing the ID.
  _delay_ms (3042);

  for ( ; ; ) {

    void const   *id_address = 0;   // ID is at start of EEPROM
    size_t const  id_size    = 8;   // ID is this many bytes long
    uint64_t      id;               // ID itself (to be read)

    eeprom_read_block (&id, id_address, id_size);

    // Print the ID value one byte at a time.  WARNING: endianness can cause
    // confusion when you interpret id as a single uint64_t.  For example,
    // if your ID happens to be 0x0123456789abcdef, then to declare a
    // literal uint64_t that will compare equal to it you would need to write
    // '0xefcdab8967452301ULL' (or 'UINT64_C (0xefcdab8967452301)' if you're
    // using the better integer literal macros from stdint.h).  WARNING:
    // also, AVR libc doesn't support 64 bit printf/scanf conversions.
    printf ("ID: ");
    for ( uint8_t ii = 0 ; ii < id_size ; ii++ ) {
      printf ("%02" PRIx8, ((uint8_t *) (&id))[ii] );
    }
    printf ("\n");

    // This block is used to verify that writing the first 8 bytes of the
    // flash doesn't change the others: after running this program, then
    // changing the ID with the make target, then restarting this program,
    // the value should still be 42 the first time we hit this point.
    uint8_t *byte_8_offset = (uint8_t *) 8;
    uint8_t byte_offset_8_value = eeprom_read_byte (byte_8_offset);
    printf (
        "Current value of byte at offset 8: %" PRIu8 "\n",
        byte_offset_8_value );
    eeprom_write_byte (byte_8_offset, 42);

    _delay_ms (1042);   // Delay a little bit between repetitions of the ID
  }
}
开发者ID:bkerin,项目名称:cduino,代码行数:44,代码来源:random_id_test.c

示例13: main

int main(void)
{
    wdt_disable();
    /* Clear WDRF in MCUSR */
    MCUSR &= ~(1<<WDRF);
    /* Write logical one to WDCE and WDE */
    /* Keep old prescaler setting to prevent unintentional time-out */
    WDTCSR |= (1<<WDCE) | (1<<WDE);
    /* Turn off WDT */
    WDTCSR = 0x00;
    //DDRA |= 0x07;
    //PORTA &= ~7;
    //DDRC |= 0x07;
    //DDRC |= 0xC0;

    eeprom_read_block(&state, &state_ee, sizeof(state));
    aes_handler_init();
    bus_handler_init();
    serial_init();
    bus_init();
    cmd_init();
    buttons_init();
    leds_init();
    timer0_init();
    sei();
    
    leds_set(0,LED_SHORT_FLASH);

    while( 1 ){
        if( timer0_timebase ){
            timer0_timebase--;
            bus_tick();
            serial_tick();
            buttons_tick();
            leds_tick();
        }
        bus_process();
        serial_process();

        //aes128_enc(data, &ctx); /* encrypting the data block */
    }

}
开发者ID:nictally,项目名称:luftschleuse2,代码行数:43,代码来源:mastercontroller.c

示例14: lcd_material_verify_material_settings

bool lcd_material_verify_material_settings()
{
    SERIAL_ECHO_START;
    uint8_t max_mats = eeprom_read_byte(EEPROM_MATERIAL_COUNT_OFFSET());
    SERIAL_ECHOPAIR("Checking ", (unsigned long) max_mats);
    SERIAL_ECHOPAIR(" presets and ", (unsigned long)  EXTRUDERS);
    SERIAL_ECHOLNPGM (" extruder settings:");

    if (max_mats < 2 || max_mats > EEPROM_MATERIAL_SETTINGS_MAX_COUNT)
        return false;
    byte cnt =0;
    while(cnt < max_mats+EXTRUDERS)
        {
            SERIAL_ECHOPAIR("Checking preset # ",(unsigned long) cnt);
            if (eeprom_read_word(EEPROM_MATERIAL_TEMPERATURE_OFFSET(cnt)) > HEATER_0_MAXTEMP)
                return false;
            if (eeprom_read_word(EEPROM_MATERIAL_BED_TEMPERATURE_OFFSET(cnt)) > BED_MAXTEMP)
                return false;
            if (eeprom_read_byte(EEPROM_MATERIAL_FAN_SPEED_OFFSET(cnt)) > 100)
                return false;
            if (eeprom_read_word(EEPROM_MATERIAL_FLOW_OFFSET(cnt)) > 1000)
                return false;
            if (eeprom_read_float(EEPROM_MATERIAL_DIAMETER_OFFSET(cnt)) > 10.0)
                return false;
            if (eeprom_read_float(EEPROM_MATERIAL_DIAMETER_OFFSET(cnt)) < 0.1)
                return false;
            strcpy_P (material_name_buf,"???");
            eeprom_read_block(material_name_buf, EEPROM_MATERIAL_NAME_OFFSET(cnt), MATERIAL_NAME_LENGTH);
            material_name_buf[MATERIAL_NAME_LENGTH] = '\0';

            if (cnt >= max_mats )
                { SERIAL_ECHOPAIR(".....verified extruder setting # ",(unsigned long) cnt-max_mats);}
            else
                { SERIAL_ECHOPAIR(".....verified preset # ",(unsigned long) cnt);}
            SERIAL_ECHO(" (");
            SERIAL_ECHO(material_name_buf);

            SERIAL_ECHO(")");
            SERIAL_ECHOLN("");
            cnt++;
        }
    return true;
}
开发者ID:norpchen,项目名称:Ultimaker2Marlin,代码行数:43,代码来源:UltiLCD2_menu_material.cpp

示例15: send_packet

void send_packet(uint8_t aes_key_nr, uint8_t data_len)
{
	// set device ID (base station has ID 0 by definition)
	bufx[0] = 0;

	// update packet counter
	packetcounter++;
	
	if (packetcounter % PACKET_COUNTER_WRITE_CYCLE == 0)
	{
		eeprom_write_dword((uint32_t*)0, packetcounter);
	}

	setBuf32(1, packetcounter);

	// set CRC32
	uint32_t crc = crc32(bufx, data_len + 6);
	setBuf32(data_len + 6, crc);

	// load AES key (0 is first AES key)
	if (aes_key_nr >= AES_KEY_EEPROM_COUNT)
	{
		aes_key_nr = AES_KEY_EEPROM_COUNT - 1;
	}
	
	eeprom_read_block (aes_key, (uint8_t *)(EEPROM_POS_AES_KEY + aes_key_nr * 32), 32);
	
	// show info
	decode_data(data_len + 6);
	UART_PUTF("       AES key: %u\r\n", aes_key_nr);
	
	UART_PUTF("         CRC32: %02lx\r\n", crc);
	UART_PUTS("   Unencrypted: ");
	printbytearray(bufx, data_len + 10);

	// encrypt and send
	uint8_t aes_byte_count = rfm12_sendbuf(data_len + 10);
	
	UART_PUTS("Send encrypted: ");
	printbytearray(bufx, aes_byte_count);

	UART_PUTS("\r\n");
}
开发者ID:palashjhabak,项目名称:ohc,代码行数:43,代码来源:ohc_basestation.c


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