本文整理汇总了C++中eeprom_write_block函数的典型用法代码示例。如果您正苦于以下问题:C++ eeprom_write_block函数的具体用法?C++ eeprom_write_block怎么用?C++ eeprom_write_block使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eeprom_write_block函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: lcd_material_reset_defaults
void lcd_material_reset_defaults()
{
//Fill in the defaults
char buffer[8];
strcpy_P(buffer, PSTR("PLA"));
eeprom_write_block(buffer, EEPROM_MATERIAL_NAME_OFFSET(0), 4);
eeprom_write_word(EEPROM_MATERIAL_TEMPERATURE_OFFSET(0), 210);
// eeprom_write_word(EEPROM_MATERIAL_BED_TEMPERATURE_OFFSET(0), 60);
eeprom_write_byte(EEPROM_MATERIAL_FAN_SPEED_OFFSET(0), 100);
eeprom_write_word(EEPROM_MATERIAL_FLOW_OFFSET(0), 100);
eeprom_write_float(EEPROM_MATERIAL_DIAMETER_OFFSET(0), 2.85);
strcpy_P(buffer, PSTR("ABS"));
eeprom_write_block(buffer, EEPROM_MATERIAL_NAME_OFFSET(1), 4);
eeprom_write_word(EEPROM_MATERIAL_TEMPERATURE_OFFSET(1), 260);
// eeprom_write_word(EEPROM_MATERIAL_BED_TEMPERATURE_OFFSET(1), 90);
eeprom_write_byte(EEPROM_MATERIAL_FAN_SPEED_OFFSET(1), 50);
eeprom_write_word(EEPROM_MATERIAL_FLOW_OFFSET(1), 107);
eeprom_write_float(EEPROM_MATERIAL_DIAMETER_OFFSET(1), 2.85);
strcpy_P(buffer, PSTR("UPET"));
eeprom_write_block(buffer, EEPROM_MATERIAL_NAME_OFFSET(2), 5);
eeprom_write_word(EEPROM_MATERIAL_TEMPERATURE_OFFSET(2), 250);
// eeprom_write_word(EEPROM_MATERIAL_BED_TEMPERATURE_OFFSET(2), 60);
eeprom_write_byte(EEPROM_MATERIAL_FAN_SPEED_OFFSET(2), 50);
eeprom_write_word(EEPROM_MATERIAL_FLOW_OFFSET(2), 100);
eeprom_write_float(EEPROM_MATERIAL_DIAMETER_OFFSET(2), 2.85);
eeprom_write_byte(EEPROM_MATERIAL_COUNT_OFFSET(), 3);
}
开发者ID:fablabbcn,项目名称:Ultimaker2Marlin,代码行数:31,代码来源:UltiLCD2_menu_material.cpp
示例2: PSTR
void AlgorithmRepository::writeToEEPROM()
{
#ifndef DEBUGGING
#ifdef ENABLE_DEBUG_UART
Comm::printf_P( PSTR("Store in EEPROM"));
#endif
WORD addr= 0;
eeprom_write_byte( (uint8_t *)addr++, 'J' );
eeprom_write_byte( (uint8_t *)addr++, 'P' );
eeprom_write_byte( (uint8_t *)addr++, ((RECEIVER_CHANNELS << 5) | OUTPUT_CHANNELS) );
eeprom_write_block( (const void *)&programArray, (void *)addr, (size_t)sizeof( programArray ) );
addr += sizeof( programArray );
eeprom_write_block( (const void *)&inputChannel, (void *)addr, (size_t)sizeof( inputChannel ) );
addr += sizeof( inputChannel );
for( BYTE i = 0; i < RECEIVER_CHANNELS; i++)
{
eeprom_write_word( (uint16_t *)addr, Receiver::getChannelMin( i ));
addr += sizeof( WORD );
eeprom_write_word( (uint16_t *)addr, Receiver::getChannelMax( i ));
addr += sizeof( WORD );
}
eeprom_write_byte( (uint8_t *) addr, Receiver::getChannelModeByte( ));
addr++;
eeprom_write_word((uint16_t *) addr, Adc::getLimit());
#endif
}
开发者ID:steff42,项目名称:AviLight4,代码行数:30,代码来源:EEProm.cpp
示例3: SaveSettings
inline void SaveSettings ()
{
/*
RegulationSettingsExtract te,he;
te = regSettingsTemp.GetExtract();
he = regSettingsHum.GetExtract();
// EEPROM is not valid, make it valid
uint8_t isInvalid = (eeprom_read_byte(&EEvalid) != EEvalidValue);
RegulationSettingsExtract t,h;
eeprom_read_block(&t, &EeTempConfig, sizeof(RegulationSettingsExtract));
eeprom_read_block(&h, &EeHumConfig, sizeof(RegulationSettingsExtract));
if(isInvalid || !te.Equals(&t))
{
eeprom_write_block(&te, &EeTempConfig, sizeof(RegulationSettingsExtract));
}
if (isInvalid || !he.Equals(&h))
{
eeprom_write_block(&he, &EeHumConfig, sizeof(RegulationSettingsExtract));
}
if (isInvalid)
{
eeprom_write_byte(&EEvalid, EEvalidValue);
}*/
eeprom_write_block(®SettingsTemp, &EeTempConfig, sizeof(RegulationSettings));
eeprom_write_block(®SettingsHum, &EeHumConfig, sizeof(RegulationSettings));
eeprom_write_byte(&EEvalid, EEvalidValue);
}
开发者ID:Klocman,项目名称:MSREG,代码行数:33,代码来源:MSREG_universal.cpp
示例4: write_user_settings_to_eeprom
void write_user_settings_to_eeprom() {
int magicnumber=MAGICNUMBER;
int size=sizeof(settingsstruct);
eeprom_write_block((const void*)&magicnumber, (void*)0, sizeof(magicnumber));
eeprom_write_block((const void*)&size, (void*)2, sizeof(size));
eeprom_write_block((const void*)&settings, (void*)4, size);
}
开发者ID:brewpoo,项目名称:multifly,代码行数:8,代码来源:eeprom.cpp
示例5: EepromWriteConfig
void EepromWriteConfig(void * baseadr, void * buf, uint8_t len)
{
struct netCheckSum_t checksum;
eeprom_write_block(buf, baseadr, len);
checksum.positive = calculateCheckSum(buf, len);
checksum.negative = ~checksum.positive;
eeprom_write_block(&checksum, baseadr+len, sizeof(checksum));
}
开发者ID:BackupTheBerlios,项目名称:rtpbond,代码行数:9,代码来源:config.c
示例6: cfg_save
void cfg_save()
{
eeprom_busy_wait();
eeprom_write_byte((uint8_t *)EEPROM_MAGIC_ADDR, EEPROM_MAGIC);
eeprom_busy_wait();
eeprom_write_block(profile1, (void *)EEPROM_PROF1_ADDR, TC_NUM_PARAMS);
eeprom_busy_wait();
eeprom_write_block(profile2, (void *)EEPROM_PROF2_ADDR, TC_NUM_PARAMS);
}
开发者ID:74hc595,项目名称:Terminalscope,代码行数:9,代码来源:termconfig.c
示例7: store_in_eeprom
void store_in_eeprom(void)
{
eeprom_write_byte((uint8_t *)0x0,19); // magic number
eeprom_write_block((uint8_t *)myip,(void *)1,sizeof(myip));
eeprom_write_block((uint8_t *)monitoredhost,(void *)6,sizeof(monitoredhost));
eeprom_write_byte((uint8_t *)11,pinginterval);
eeprom_write_byte((uint8_t *)12,sendping);
password[7]='\0'; // make sure it is terminated, should not be necessary
eeprom_write_block((char *)password,(void *)13,sizeof(password));
}
开发者ID:abdulmajeed90,项目名称:smarthus,代码行数:10,代码来源:main.c
示例8: writeusersettingstoeeprom
void writeusersettingstoeeprom(void)
{
uint16_t magicnumber = MAGICNUMBER;
int size = sizeof(usersettingsstruct);
eeprom_write_block((const void *)&magicnumber, 0, sizeof(magicnumber));
eeprom_write_block((const void *)&size, 2, sizeof(size));
eeprom_write_block((const void *)&usersettings, 4, size);
eeprom_commit();
}
开发者ID:trollcop,项目名称:bradwii,代码行数:10,代码来源:eeprom.c
示例9: key_dw_process
//*******************************************************************************************
//
// Function : key_dw_process
// Description :
//
//*******************************************************************************************
void key_dw_process ( void )
{
BYTE temp;
// standby display, display board status
if(menu_index == 0)
{
if(standby_cursor==1){
turn_devices(ind_device_cur);
return;
}
if ( -- standby_cursor == 0 )
standby_cursor = sizeof(standby_list)/2;
flag1.bits.update_display = 1;
}
// main menu
else if(menu_index == 1)
{
if( --submenu_index == 0 )
{
submenu_index = (sizeof(menu_list)/2)-1;
}
}
// setup avr ip
else if( menu_index == 2 )
{
avr_ip.byte [ setting_cursor ]--;
eeprom_write_block ( &avr_ip, ee_avr_ip, 4 );
}
// setup server ip
else if( menu_index == 3 )
{
server_ip.byte [ setting_cursor ]--;
eeprom_write_block ( &server_ip, ee_server_ip, 4 );
}
// setup countdown timer
else if( menu_index == 4 )
{
temp = pgm_read_byte ( (PGM_P)(count_time_max + setting_cursor) );
if ( --count_time [ setting_cursor ] == 0xff )
count_time [ setting_cursor ] = temp;
eeprom_write_block ( count_time, ee_count_time, 4 );
}else if(menu_index == 6){
if(screen_timeout == 0){
screen_timeout=240;
}else{
screen_timeout--;
}
timeout_cur_screen=screen_timeout;
}
}
开发者ID:quahansudung,项目名称:AVRnet_RF_Smarthome,代码行数:59,代码来源:menu.c
示例10: data2eeprom
void data2eeprom(void)
{
eeprom_write_byte((uint8_t *)40,19); // magic number
eeprom_write_block((uint8_t *)gwip,(void *)41,sizeof(gwip));
eeprom_write_block((uint8_t *)udpsrvip,(void *)45,sizeof(udpsrvip));
eeprom_write_word((void *)49,udpsrvport);
eeprom_write_byte((uint8_t *)51,alarmOn);
eeprom_write_word((void *)52,heartbeat_timeout_sec);
eeprom_write_byte((uint8_t *)54,dhcpOn);
eeprom_write_block((uint8_t *)myip,(void *)55,sizeof(myip));
eeprom_write_block((uint8_t *)myname,(void *)59,sizeof(myname));
}
开发者ID:denis-m-tyurin,项目名称:ethernet-alarm,代码行数:12,代码来源:EthernetAlarm.c
示例11: key_up_process
//*******************************************************************************************
//
// Function : key_up_process
// Description :
//
//*******************************************************************************************
void key_up_process ( void )
{
BYTE temp;
// standby display, display board status
if(menu_index == 0)
{
if(standby_cursor==1){
if(++ind_device_cur !=6){
return;
}else{
ind_device_cur=0;
}
}
if ( ++ standby_cursor == ((sizeof(standby_list)/2)+1) )
standby_cursor = 1;
flag1.bits.update_display = 1;
}
// main menu
else if(menu_index == 1)
{
if( ++submenu_index == (sizeof(menu_list)/2) )
{
submenu_index = 1;
}
}
// setup avr ip
else if( menu_index == 2 )
{
avr_ip.byte [ setting_cursor ]++;
eeprom_write_block ( &avr_ip, ee_avr_ip, 4 );
}
// setup server ip
else if( menu_index == 3 )
{
server_ip.byte [ setting_cursor ]++;
eeprom_write_block ( &server_ip, ee_server_ip, 4 );
}
// setup countdown timer
else if( menu_index == 4 )
{
temp = pgm_read_byte ( (PGM_P)(count_time_max + setting_cursor) );
if ( ++count_time [ setting_cursor ] == temp )
count_time [ setting_cursor ] = 0;
eeprom_write_block ( count_time, ee_count_time, 4 );
}else if(menu_index == 6){
screen_timeout++;
if(screen_timeout > 240){
screen_timeout=0;
}
timeout_cur_screen=screen_timeout;
}
}
开发者ID:quahansudung,项目名称:AVRnet_RF_Smarthome,代码行数:59,代码来源:menu.c
示例12: apply_power
int apply_power(void){
if(unlock_stage>0){
RED_ON;
}
if(unlock_stage==3){ //unlock finished
power_mode = MODE_IDLE;
unlock_stage = 0;
}
if(power_mode==255){power_mode=MODE_IDLE;}
if(power_mode>MODE_FULL){power_mode=MODE_FULL;}
if(power_mode==MODE_OFF){
DRIVER_OFF;
OCR0B=0;
}else{
DRIVER_ON;
set_sleep_mode(SLEEP_MODE_IDLE);
sleep_disable();
// stop_timer();
start_timer();
}
// if(power_mode==MODE_IDLE) {OCR0B=0; }
// if(power_mode==MODE_LOW_VOLTAGE){OCR0B=0; }
// if(power_mode==MODE_OVERTEMP) {OCR0B=0; }
// if(power_mode==MODE_LOW) {OCR0B=16; }
// if(power_mode==MODE_HALF) {OCR0B=0;}
// if(power_mode==MODE_FULL) {OCR0B=0;}
if(power_mode==MODE_IDLE) {OCR0B=0; }
if(power_mode==MODE_LOW_VOLTAGE){OCR0B=16; }
if(power_mode==MODE_OVERTEMP) {OCR0B=8; }
if(power_mode==MODE_LOW) {OCR0B=64; }
if(power_mode==MODE_HALF) {OCR0B=127;}
if(power_mode==MODE_FULL) {OCR0B=255;}
if(prev_power_mode!=power_mode){
seconds_on[prev_power_mode] += seconds;
times_on[prev_power_mode] += 1;
if(max_on[prev_power_mode] < seconds){
max_on[prev_power_mode] = seconds;
}
if(power_mode==MODE_LOW_VOLTAGE||power_mode==MODE_OFF){
//will store data only on power off or low batt to save eeprom
eeprom_write_block(&seconds_on, &nv_seconds_on, sizeof(seconds_on));
eeprom_write_block(×_on, &nv_times_on, sizeof(times_on) );
eeprom_write_block(&max_on, &nv_max_on, sizeof(max_on) );
}
prev_power_mode=power_mode;
seconds=0;
}
return 0;
}
开发者ID:dmitryshagin,项目名称:led_driver_12v_1a,代码行数:52,代码来源:main.c
示例13: settings_save
void settings_save()
{
if(conf.camera.cameraMake == PANASONIC) conf.camera.halfPress = HALF_PRESS_DISABLED;
if(settings_camera_index > 0)
{
eeprom_write_block((const void*)&conf.camera, &camera_settings_eep[settings_camera_index - 1], sizeof(camera_settings_t));
eeprom_read_block((void*)&conf.camera, &conf_eep.camera, sizeof(camera_settings_t));
}
conf.camera.autoConfigured = 0;
eeprom_write_block((const void*)&conf, &conf_eep, sizeof(settings_t));
lcd.init(conf.lcdContrast);
lcd.update();
}
开发者ID:jreinholm,项目名称:TimelapsePlus-Firmware,代码行数:13,代码来源:settings.cpp
示例14: TLE_Handler_SetNewTLE
void TLE_Handler_SetNewTLE(char * l0, char * l1, char * l2)
{
if (l0 && l1 && l2)
{
strncpy(line0, l0, TLE_TITLE_LENGTH);
strncpy(line1, l1, TLE_LINE_LENGTH);
strncpy(line2, l2, TLE_LINE_LENGTH);
eeprom_write_block(line0, eeprom_line0, TLE_TITLE_LENGTH);
eeprom_write_block(line1, eeprom_line1, TLE_LINE_LENGTH);
eeprom_write_block(line2, eeprom_line2, TLE_LINE_LENGTH);
updateTLEData();
}
}
开发者ID:jamesfowkes,项目名称:ISSTracker2,代码行数:15,代码来源:tlehandler.c
示例15: run_graph
void
run_graph (void)
{
static uint32_t lastsec = 0, lastmin = 0, lasthour = 0, lastday = 0;
static int32_t pLastMin = 0, pLastHour = 0, pLastDay = 0;
static uint8_t mincount = 0;
// see if a second has passed, if so add power into minute accumulator
if (uptime() >= lastsec + 1)
{
pLastMin += gPower;
lastsec = uptime();
}
// see if a minute has passed, if so advance the pointer to track the last 60 minutes
if (uptime() >= lastmin + 60)
{
pLastHour += pLastMin / 60;
if (++mincount >= 3)
{
median_add(&PowerMins, (int16_t)(pLastMin / 60));
mincount = 0;
}
pLastMin = 0;
lastmin = uptime();
}
// see if an hour has passed, if so advance the pointer to track the last 20 of them
if (uptime() >= lasthour + 3600)
{
pLastDay += pLastHour / 60;
median_add(&PowerHours, (int16_t)(pLastHour / 60));
eeprom_write_block ((const void *) &PowerHours, (void *) &eePowerHours, sizeof (PowerHours));
pLastHour = 0;
lasthour = uptime();
}
// see if a day has passed, if so advance the pointer to track the last 20 days
if (uptime() >= lastday + 86400)
{
// track daily totals in watt-hours
median_add(&PowerDays, (int16_t)pLastDay);
eeprom_write_block ((const void *) &PowerDays, (void *) &eePowerDays, sizeof (PowerDays));
pLastDay = 0;
lastday = uptime();
}
}
开发者ID:g8ecj,项目名称:turbine,代码行数:48,代码来源:graph.c
示例16: defined
/**
* \brief Saves the random seed to EEPROM.
*
* During system startup, noise sources typically won't have accumulated
* much entropy. But startup is usually the time when the system most
* needs to generate random data for session keys, IV's, and the like.
*
* The purpose of this function is to pass some of the accumulated entropy
* from one session to the next after a loss of power. Thus, once the system
* has been running for a while it will get progressively better at generating
* random values and the accumulated entropy will not be completely lost.
*
* Normally it isn't necessary to call save() directly. The loop() function
* will automatically save the seed on a periodic basis (default of 1 hour).
*
* The seed that is saved is generated in such a way that it cannot be used
* to predict random values that were generated previously or subsequently
* in the current session. So a compromise of the EEPROM contents of a
* captured device should not result in compromise of random values
* that have already been generated. However, if power is lost and the
* system restarted, then there will be a short period of time where the
* random state will be predictable from the seed. For this reason it is
* very important to stir() in new noise data at startup.
*
* \sa loop(), stir()
*/
void RNGClass::save()
{
// Generate random data from the current state and save
// that as the seed. Then force a rekey.
++(block[12]);
ChaCha::hashCore(stream, block, RNG_ROUNDS);
#if defined(RNG_EEPROM)
// We shorten the seed from 48 bytes to 47 to leave room for
// the CRC-8 value. We do this to align the data on an 8-byte
// boundary in EERPOM.
int address = RNG_EEPROM_ADDRESS;
eeprom_write_block(stream, (void *)address, SEED_SIZE - 1);
eeprom_write_byte((uint8_t *)(address + SEED_SIZE - 1),
crypto_crc8('S', stream, SEED_SIZE - 1));
#elif defined(RNG_DUE_TRNG)
unsigned posn;
((uint32_t *)(RNG_SEED_ADDR))[0] = crypto_crc8('S', stream, SEED_SIZE);
for (posn = 0; posn < 12; ++posn)
((uint32_t *)(RNG_SEED_ADDR))[posn + 1] = stream[posn];
for (posn = 13; posn < (RNG_FLASH_PAGE_SIZE / 4); ++posn)
((uint32_t *)(RNG_SEED_ADDR))[posn + 13] = 0xFFFFFFFF;
eraseAndWriteSeed();
#elif defined(RNG_ESP_NVS)
// Save the seed into ESP non-volatile storage (NVS).
nvs_handle handle = 0;
if (nvs_open("rng", NVS_READWRITE, &handle) == 0) {
nvs_erase_all(handle);
nvs_set_blob(handle, "seed", stream, SEED_SIZE);
nvs_commit(handle);
nvs_close(handle);
}
#endif
rekey();
timer = millis();
}
开发者ID:EternityForest,项目名称:KaithemAutomation,代码行数:61,代码来源:RNG.cpp
示例17: clear_events
void clear_events()
{
events_count = 0;
// clear all data
for (int i = 0; i < EVENTS_SIZE; i++)
{
events[i].pin = -1;
events[i].time = 0;
events[i].pin_state = 0;
events[i].inc = 0;
events[i].duration = 0;
events[i].type = 0;
}
// save event to eeprom
eeprom_busy_wait();
eeprom_write_block(&events, &events_ee, sizeof(struct Event) * EVENTS_SIZE);
// save count
eeprom_busy_wait();
eeprom_write_byte(&events_count_ee, events_count);
event_mode = MANUAL_MODE;
}
开发者ID:snegtec,项目名称:MeropiModerariModuli,代码行数:26,代码来源:events.c
示例18: add_event
void add_event(int pin, int32_t time, int pin_state)
{
// don't add if no space
if (events_count >= EVENTS_SIZE - 1)
return;
events[events_count].pin = pin;
events[events_count].time = time;
events[events_count].pin_state = pin_state;
if (pin_state > 1)
events[events_count].type = PWM;
else
events[events_count].type = EXP;
events_count++;
// save event to eeprom
eeprom_busy_wait();
eeprom_write_block(&events, &events_ee, sizeof(struct Event) * EVENTS_SIZE);
// save count
eeprom_busy_wait();
eeprom_write_byte(&events_count_ee, events_count);
}
开发者ID:snegtec,项目名称:MeropiModerariModuli,代码行数:25,代码来源:events.c
示例19: store_side_state
void store_side_state(uint8_t *side_state_src, uint8_t bank_num)
{
// Calculate the address of the side state being writen
uint8_t *bank_state_address = STATE_STORAGE_START_ADDRESS + bank_num * STATE_BANK_LEN;
eeprom_write_block((const void*) side_state_src, (void*) bank_state_address, STATE_BANK_LEN);
}
开发者ID:roman-tershak,项目名称:4DMC-Model,代码行数:7,代码来源:state_storage.c
示例20: writeGlobalSet
void writeGlobalSet(uint8_t b) {
global_conf.checksum = calculate_sum((uint8_t*)&global_conf, sizeof(global_conf));
eeprom_write_block((const void*)&global_conf, (void*)0, sizeof(global_conf));
if (b == 1) blinkLED(15,20,1);
SET_ALARM_BUZZER(ALRM_FAC_CONFIRM, ALRM_LVL_CONFIRM_1);
}
开发者ID:MORP,项目名称:MyMultiwii,代码行数:7,代码来源:EEPROM.cpp
注:本文中的eeprom_write_block函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论