本文整理汇总了C++中eeprom_write_block函数的典型用法代码示例。如果您正苦于以下问题:C++ eeprom_write_block函数的具体用法?C++ eeprom_write_block怎么用?C++ eeprom_write_block使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eeprom_write_block函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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
}
示例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);
}
示例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);
}
示例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));
}
示例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);
}
示例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));
}
示例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();
}
示例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;
}
}
示例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));
}
示例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;
}
}
示例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;
}
示例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();
}
示例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();
}
}
示例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();
}
}