本文整理汇总了C++中eeprom_busy_wait函数的典型用法代码示例。如果您正苦于以下问题:C++ eeprom_busy_wait函数的具体用法?C++ eeprom_busy_wait怎么用?C++ eeprom_busy_wait使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eeprom_busy_wait函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: constrain
Waypoints::WP
Waypoints::get_waypoint_with_index(uint8_t i)
{
Waypoints::WP wp;
i = constrain(i, 0, _total);
uint32_t mem = _start_byte + (i * _wp_size);
eeprom_busy_wait();
wp.id = eeprom_read_byte((uint8_t *)mem);
mem++;
eeprom_busy_wait();
wp.p1 = eeprom_read_byte((uint8_t *)mem);
mem++;
eeprom_busy_wait();
wp.alt = (long)eeprom_read_dword((uint32_t *)mem);
mem += 4;
eeprom_busy_wait();
wp.lat = (long)eeprom_read_dword((uint32_t *)mem);
mem += 4;
eeprom_busy_wait();
wp.lng = (long)eeprom_read_dword((uint32_t *)mem);
}
示例2: gui_set_autostart_action
void gui_set_autostart_action(uint8_t index)
{
switch(index)
{
case(1):
gui_value_conf_P(PSTR("Start threshold"), GUI_VAL_NUMBER_DISABLE, PSTR("+/-%0.0fm"), config.autostart.start_sensititvity, 0, 100, 1, gui_set_autostart_start_threshold_cb);
gui_switch_task(GUI_SET_VAL);
break;
case(2):
gui_value_conf_P(PSTR("Land threshold"), GUI_VAL_NUMBER_DISABLE, PSTR("+/-%0.0fm"), config.autostart.land_sensititvity, 0, 100, 1, gui_set_autostart_land_threshold_cb);
gui_switch_task(GUI_SET_VAL);
break;
case(3):
gui_value_conf_P(PSTR("Timeout"), GUI_VAL_NUMBER, PSTR("%0.0f sec"), config.autostart.timeout, 5, 240, 1, gui_set_autostart_timeout_cb);
gui_switch_task(GUI_SET_VAL);
break;
case(4):
config.autostart.flags ^= AUTOSTART_SUPRESS_AUDIO;
eeprom_busy_wait();
eeprom_update_byte(&config_ee.autostart.flags, config.autostart.flags);
break;
case(5):
config.autostart.flags ^= AUTOSTART_ALWAYS_ENABLED;
eeprom_busy_wait();
eeprom_update_byte(&config_ee.autostart.flags, config.autostart.flags);
break;
}
}
示例3: command_wol
//------------------------------------------------------------------------------
//
void command_wol (void)
{
#if USE_WOL
// EEPROM beschreiben, falls Parameter angegeben wurden
if ((*((unsigned int*)&variable[0]) != 0x00000000) || (*((unsigned int*)&variable[1]) != 0x00000000) || (*((unsigned int*)&variable[2]) != 0x00000000))
{
//schreiben der MAC
for (unsigned char count = 0; count<6; count++)
{
eeprom_busy_wait ();
eeprom_write_byte((unsigned char *)(WOL_MAC_EEPROM_STORE + count),variable[count]);
}
//zusätzlich schreiben der Broadcast-Adresse, falls vorhandenden
for (unsigned char count = 0; count<4 && (*((unsigned int*)&variable[6]) != 0x00000000); count++)
{
eeprom_busy_wait ();
eeprom_write_byte((unsigned char*)(WOL_BCAST_EEPROM_STORE + count),variable[count+6]);
}
//init
wol_init();
} else {
//MagicPacket senden
wol_request();
}
#endif //USE_WOL
}
示例4: gui_set_logger_action
void gui_set_logger_action(uint8_t index)
{
switch(index)
{
case(0):
config.logger.enabled = !config.logger.enabled;
eeprom_busy_wait();
eeprom_update_byte(&config_ee.logger.enabled, config.logger.enabled);
break;
case(1):
if (fc.logger_state == FLIGHT_LAND)
{
gui_showmessage_P(PSTR("Cannot change\nin flight!"));
return;
}
config.logger.format = (config.logger.format + 1) % NUMBER_OF_FORMATS;
eeprom_busy_wait();
eeprom_update_byte(&config_ee.logger.format, config.logger.format);
break;
case(2):
gui_switch_task(GUI_SET_AUTOSTART);
break;
}
}
示例5: calibrate
void calibrate(void)
{
uint16_t min, max;
// Timer/Counter0,1 Overflow Interrupt Enable - LED1 blinking
TIMSK |= _BV(TOIE1);
// Calibrate minimum value
PORTA &= ~_BV(LED2);
wait_for_prog();
min = pressure();
PORTA |= _BV(LED2);
// Calibrate maximum value
PORTA &= ~_BV(LED3);
wait_for_prog();
max = pressure();
PORTA |= _BV(LED3) | _BV(LED1);
// Save values in EEPROM
eeprom_busy_wait();
eeprom_write_word(PMINIMUM, min);
eeprom_busy_wait();
eeprom_write_word(PMAXIMUM, max);
// Timer/Counter0,1 Overflow Interrupt Disable
TIMSK &= ~_BV(TOIE1);
}
示例6: logger_next_flight
void logger_next_flight()
{
uint8_t sec, min, hour, day, wday, month;
uint16_t year;
uint32_t today;
datetime_from_epoch(time_get_local(), &sec, &min, &hour, &day, &wday, &month, &year);
today = datetime_to_epoch(0, 0, 0, day, month, year);
if (today == logger_flight_day)
{
logger_flight_number++;
eeprom_busy_wait();
eeprom_update_byte(&config_ro.flight_number, logger_flight_number);
}
else
{
logger_flight_number = 0;
logger_flight_day = today;
eeprom_busy_wait();
eeprom_update_block((void *)&logger_flight_day, &config_ro.flight_date, sizeof(logger_flight_day));
eeprom_update_byte(&config_ro.flight_number, logger_flight_number);
}
DEBUG("date is: ");
print_datetime(today);
DEBUG("flight number is: %d\n", logger_flight_number);
}
示例7: logger_init
void logger_init()
{
log_fil = new FIL;
fc.logger_state = LOGGER_IDLE;
uint8_t sec, min, hour, day, wday, month;
uint16_t year;
uint32_t today;
datetime_from_epoch(time_get_local(), &sec, &min, &hour, &day, &wday, &month, &year);
today = datetime_to_epoch(0, 0, 0, day, month, year);
eeprom_busy_wait();
eeprom_read_block((void *)&logger_flight_day, &config_ro.flight_date, sizeof(logger_flight_day));
logger_flight_number = eeprom_read_byte(&config_ro.flight_number);
if (logger_flight_day != today)
{
logger_flight_number = 0;
logger_flight_day = today;
eeprom_busy_wait();
eeprom_update_block((void *)&logger_flight_day, &config_ro.flight_date, sizeof(logger_flight_day));
eeprom_update_byte(&config_ro.flight_number, logger_flight_number);
}
DEBUG("date is: ");
print_datetime(today);
DEBUG("flight number is: %d\n", logger_flight_number);
}
示例8: PROFILING
void PLEN2::JointController::resetSettings()
{
#if DEBUG
PROFILING("JointController::resetSettings()");
#endif
EEPROM[INIT_FLAG_ADDRESS] = INIT_FLAG_VALUE;
eeprom_busy_wait();
for (uint8_t index = 0; index < sizeof(Shared::m_SETTINGS_INITIAL); index++)
{
EEPROM[SETTINGS_HEAD_ADDRESS + index] = pgm_read_byte(
reinterpret_cast<const uint8_t*>(Shared::m_SETTINGS_INITIAL) + index
);
eeprom_busy_wait();
}
for (uint8_t joint_id = 0; joint_id < JOINTS_SUM; joint_id++)
{
m_SETTINGS[joint_id].MIN = pgm_read_word(Shared::m_SETTINGS_INITIAL + joint_id * 3 + 0);
m_SETTINGS[joint_id].MAX = pgm_read_word(Shared::m_SETTINGS_INITIAL + joint_id * 3 + 1);
m_SETTINGS[joint_id].HOME = pgm_read_word(Shared::m_SETTINGS_INITIAL + joint_id * 3 + 2);
setAngle(joint_id, m_SETTINGS[joint_id].HOME);
}
}
示例9: cfg_load
void cfg_load()
{
eeprom_busy_wait();
/* check for magic number */
uint8_t magic = eeprom_read_byte((const uint8_t *)EEPROM_MAGIC_ADDR);
if (magic != EEPROM_MAGIC)
{
/* no data previously stored; set defaults and save */
cfg_set_defaults();
cfg_save();
}
else
{
/* data previously stored; read it */
eeprom_busy_wait();
eeprom_read_block(profile1,(const void *)EEPROM_PROF1_ADDR,TC_NUM_PARAMS);
eeprom_busy_wait();
eeprom_read_block(profile2,(const void *)EEPROM_PROF2_ADDR,TC_NUM_PARAMS);
/* sanity check */
uint8_t i;
for (i = 0; i < TC_NUM_PARAMS; i++)
{
/* if the value is corrupt, restore the default */
uint8_t maxval = pgm_read_byte(&(params[i]->numvals));
if (profile1[i] >= maxval)
profile1[i] = pgm_read_byte(&(params[i]->defaultval));
if (profile2[i] >= maxval)
profile2[i] = pgm_read_byte(&(params[i]->defaultval));
}
}
}
示例10: gui_set_advanced_action
void gui_set_advanced_action(uint8_t index)
{
switch(index)
{
case(0):
config.connectivity.usb_mode = !config.connectivity.usb_mode;
eeprom_busy_wait();
eeprom_update_byte(&config_ee.connectivity.usb_mode, config.connectivity.usb_mode);
break;
case(1):
config.connectivity.uart_function = (config.connectivity.uart_function + 1) % NUMBER_OF_UART_FORWARD;
eeprom_busy_wait();
eeprom_update_byte(&config_ee.connectivity.uart_function, config.connectivity.uart_function);
uart_stop();
uart_init();
break;
case(2):
if (!storage_card_in())
{
gui_showmessage_P(PSTR("No SD card!"));
return;
}
gui_dialog_set_P(PSTR("Warning"), PSTR("This will erase\nall data from SD\ncard! Continue?"), GUI_STYLE_YESNO, gui_set_advanced_format_cb);
gui_switch_task(GUI_DIALOG);
break;
case(3):
gui_switch_task(GUI_SET_CALIB);
break;
}
}
示例11: gui_layouts_action
void gui_layouts_action(uint8_t index)
{
switch(index)
{
case(0):
gui_switch_task(GUI_SET_WIDGETS);
break;
case(1):
gui_switch_task(GUI_SET_LAYOUT);
break;
case(2):
gui_value_conf_P(PSTR("Pages count"), GUI_VAL_NUMBER, PSTR("%1.0f"), config.gui.number_of_pages, 1, MAX_NUMBER_OF_PAGES, 1, gui_set_layouts_pages_cb);
gui_switch_task(GUI_SET_VAL);
break;
case(3):
config.gui.silent ^= (1 << active_page);
eeprom_busy_wait();
eeprom_update_byte(&config_ee.gui.silent, config.gui.silent);
break;
case(4):
config.gui.hide_label ^= (1 << active_page);
eeprom_busy_wait();
eeprom_update_byte(&config_ee.gui.hide_label, config.gui.hide_label);
break;
case(5):
gui_switch_task(GUI_SET_AUTOSET);
break;
}
}
示例12: gui_set_bluetooth_action
void gui_set_bluetooth_action(uint8_t index)
{
switch (index)
{
case(1):
config.system.use_bt = !config.system.use_bt;
eeprom_busy_wait();
eeprom_update_byte(&config_ee.system.use_bt, config.system.use_bt);
if (config.system.use_bt)
bt_module_init();
else
bt_module_deinit();
break;
case(2):
config.system.protocol = (config.system.protocol + 1) % NUMBER_OF_PROTOCOLS;
eeprom_busy_wait();
eeprom_update_byte(&config_ee.system.protocol, config.system.protocol);
break;
case(3):
config.system.forward_gps = !config.system.forward_gps;
eeprom_busy_wait();
eeprom_update_byte(&config_ee.system.forward_gps, config.system.forward_gps);
break;
}
}
示例13: p
void PLEN2::JointController::resetSettings()
{
#if DEBUG
volatile Utility::Profiler p(F("JointController::resetSettings()"));
#endif
EEPROM[INIT_FLAG_ADDRESS()] = INIT_FLAG_VALUE();
eeprom_busy_wait();
for (int index = 0; index < sizeof(Shared::m_SETTINGS_INITIAL); index++)
{
EEPROM[SETTINGS_HEAD_ADDRESS() + index] = pgm_read_byte(
reinterpret_cast<const char*>(Shared::m_SETTINGS_INITIAL) + index
);
eeprom_busy_wait();
}
for (char joint_id = 0; joint_id < SUM; joint_id++)
{
m_SETTINGS[joint_id].MIN = pgm_read_word(Shared::m_SETTINGS_INITIAL + joint_id * 3 + 0);
m_SETTINGS[joint_id].MAX = pgm_read_word(Shared::m_SETTINGS_INITIAL + joint_id * 3 + 1);
m_SETTINGS[joint_id].HOME = pgm_read_word(Shared::m_SETTINGS_INITIAL + joint_id * 3 + 2);
setAngle(joint_id, m_SETTINGS[joint_id].HOME);
}
}
示例14: 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;
}
示例15: 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);
}