本文整理汇总了C++中eeprom_read_dword函数的典型用法代码示例。如果您正苦于以下问题:C++ eeprom_read_dword函数的具体用法?C++ eeprom_read_dword怎么用?C++ eeprom_read_dword使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eeprom_read_dword函数的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: pid_init
/** Inititalise PID data structures.
\param i Index of the heater to initialise by Teacup numbering.
*/
void pid_init() {
uint8_t i;
for (i = 0; i < NUM_HEATERS; i++) {
#ifdef HEATER_SANITY_CHECK
// 0 is a "sane" temperature when we're trying to cool down.
heaters_runtime[i].sane_temperature = 0;
#endif
#ifndef BANG_BANG
#ifdef EECONFIG
// Read factors from EEPROM.
heaters_pid[i].p_factor =
eeprom_read_dword((uint32_t *)&EE_factors[i].EE_p_factor);
heaters_pid[i].i_factor =
eeprom_read_dword((uint32_t *)&EE_factors[i].EE_i_factor);
heaters_pid[i].d_factor =
eeprom_read_dword((uint32_t *)&EE_factors[i].EE_d_factor);
heaters_pid[i].i_limit =
eeprom_read_word((uint16_t *)&EE_factors[i].EE_i_limit);
if (crc_block(&heaters_pid[i].p_factor, 14) !=
eeprom_read_word((uint16_t *)&EE_factors[i].crc))
#endif /* EECONFIG */
{
heaters_pid[i].p_factor = DEFAULT_P;
heaters_pid[i].i_factor = DEFAULT_I;
heaters_pid[i].d_factor = DEFAULT_D;
heaters_pid[i].i_limit = DEFAULT_I_LIMIT;
}
#endif /* BANG_BANG */
}
}
示例3: page_linear_sweep_load_parameters
void page_linear_sweep_load_parameters(struct menuitem *self)
{
f1 = eeprom_read_dword(&f1_eeprom);
if(f1 == 0xFFFFFFFF) // cell after erase cycle
f1 = 0;
f2 = eeprom_read_dword(&f2_eeprom);
if(f2 == 0xFFFFFFFF) // cell after erase cycle
f2 = 0;
time = eeprom_read_dword(&time_eeprom);
if(time == 0xFFFFFFFF) // cell after erase cycle
time = 50;
}
示例4: temp_init
void temp_init() {
p_factor = eeprom_read_dword((uint32_t *) &EE_p_factor);
i_factor = eeprom_read_dword((uint32_t *) &EE_i_factor);
d_factor = eeprom_read_dword((uint32_t *) &EE_d_factor);
i_limit = eeprom_read_word((uint16_t *) &EE_i_limit);
if ((p_factor == 0) && (i_factor == 0) && (d_factor == 0) && (i_limit == 0)) {
p_factor = DEFAULT_P;
i_factor = DEFAULT_I;
d_factor = DEFAULT_D;
i_limit = DEFAULT_I_LIMIT;
}
}
示例5: eeconfig_read_rgblight
uint32_t eeconfig_read_rgblight(void) {
#if defined(__AVR__) || defined(STM32_EEPROM_ENABLE) || defined(PROTOCOL_ARM_ATSAM) || defined(EEPROM_SIZE)
return eeprom_read_dword(EECONFIG_RGBLIGHT);
#else
return 0;
#endif
}
示例6: get_seed
uint32_t get_seed(uint32_t* eeprom_begin, uint32_t* eeprom_end)
{
uint32_t* ptr;
uint32_t seed = eeprom_read_dword(eeprom_begin);
for (ptr=eeprom_begin+1; ptr<eeprom_end; ++ptr)
if (++seed != eeprom_read_dword(ptr)) break;
if (ptr >= eeprom_end) ptr = eeprom_begin;
eeprom_write_dword(ptr, seed);
if (seed == 0) seed = 0xaaaaaaaa;
return seed;
}
示例7: load_lifetime_stats
static void load_lifetime_stats()
{
unsigned long magic = eeprom_read_dword((uint32_t*)(LIFETIME_EEPROM_OFFSET + 0));
if (magic == LIFETIME_MAGIC)
{
lifetime_minutes = eeprom_read_dword((uint32_t*)(LIFETIME_EEPROM_OFFSET + 4));
lifetime_print_minutes = eeprom_read_dword((uint32_t*)(LIFETIME_EEPROM_OFFSET + 8));
triptime_minutes = eeprom_read_dword((uint32_t*)(LIFETIME_EEPROM_OFFSET + 12));
triptime_print_minutes = eeprom_read_dword((uint32_t*)(LIFETIME_EEPROM_OFFSET + 16));
}else{
lifetime_minutes = 0;
lifetime_print_minutes = 0;
triptime_minutes = 0;
triptime_print_minutes = 0;
}
}
示例8: eeprom_read_dword
/**
* Read a single 32 bits integer
*/
uint32_t Eeprom::readLong(int address)
{
if (!isReadOk(address + sizeof(uint32_t)))
return 0;
return eeprom_read_dword((unsigned long *) address);
}
示例9: zoSmsInitSettingsFromEeprom
void zoSmsInitSettingsFromEeprom(void)
{
Sms.Settings.NodeID = eeprom_read_byte((u08*)ZO_EEPROM_ADDRESS_NODE_ID);
Sms.Pid.GainP = eeprom_read_word((u16*)ZO_EEPROM_ADDRESS_GAIN_P);
Sms.Pid.GainI = eeprom_read_word((u16*)ZO_EEPROM_ADDRESS_GAIN_I);
Sms.Pid.GainD = eeprom_read_word((u16*)ZO_EEPROM_ADDRESS_GAIN_D);
Sms.Settings.CurrentLimit = eeprom_read_word((u16*)ZO_EEPROM_ADDRESS_CURRENT_LIMIT);
Sms.Settings.CurrentLimitDuration = eeprom_read_word((u16*)ZO_EEPROM_ADDRESS_CURRENT_LIMIT_DURATION);
Sms.Settings.DigitalIoConfig = eeprom_read_byte((u08*)ZO_EEPROM_ADDRESS_DIGITAL_IO_CONFIG);
Sms.Settings.BaudUart = eeprom_read_dword((u32*)ZO_EEPROM_ADDRESS_BAUD_UART);
Sms.Settings.BaudI2C = eeprom_read_dword((u32*)ZO_EEPROM_ADDRESS_BAUD_I2C);
Sms.Profile.DesiredAcceleration = eeprom_read_word((u16*)ZO_EEPROM_ADDRESS_PROFILE_ACCELERATION);
Sms.Profile.DesiredVelocity = eeprom_read_word((u16*)ZO_EEPROM_ADDRESS_PROFILE_VELOCITY);
Sms.Settings.localAcceptanceMask = eeprom_read_byte((u08*)ZO_EEPROM_ADDRESS_LAM);
Sms.Settings.errorReportingLevel = eeprom_read_byte((u08*)ZO_EEPROM_ADDRESS_ERROR_REPORTING_LVL);
}
示例10: eeconfig_read_rgblight
uint32_t eeconfig_read_rgblight(void) {
#ifdef __AVR__
return eeprom_read_dword(EECONFIG_RGBLIGHT);
#else
return 0;
#endif
}
示例11: heater_init
void heater_init() {
heater_t i;
// setup pins
for (i = 0; i < NUM_HEATERS; i++) {
*(heaters[i].heater_port) &= ~MASK(heaters[i].heater_pin);
// DDR is always 1 address below PORT. ugly code but saves ram and an extra field in heaters[] which will never be used anywhere but here
*(heaters[i].heater_port - 1) |= MASK(heaters[i].heater_pin);
if (heaters[i].heater_pwm) {
*heaters[i].heater_pwm = 0;
// this is somewhat ugly too, but switch() won't accept pointers for reasons unknown
switch((uint16_t) heaters[i].heater_pwm) {
case (uint16_t) &OCR0A:
TCCR0A |= MASK(COM0A1);
break;
case (uint16_t) &OCR0B:
TCCR0A |= MASK(COM0B1);
break;
case (uint16_t) &OCR2A:
TCCR2A |= MASK(COM2A1);
break;
case (uint16_t) &OCR2B:
TCCR2A |= MASK(COM2B1);
break;
}
}
#ifdef HEATER_SANITY_CHECK
// 0 is a "sane" temperature when we're trying to cool down
heaters_runtime[i].sane_temperature = 0;
#endif
#ifndef BANG_BANG
// read factors from eeprom
heaters_pid[i].p_factor = eeprom_read_dword((uint32_t *) &EE_factors[i].EE_p_factor);
heaters_pid[i].i_factor = eeprom_read_dword((uint32_t *) &EE_factors[i].EE_i_factor);
heaters_pid[i].d_factor = eeprom_read_dword((uint32_t *) &EE_factors[i].EE_d_factor);
heaters_pid[i].i_limit = eeprom_read_word((uint16_t *) &EE_factors[i].EE_i_limit);
if ((heaters_pid[i].p_factor == 0) && (heaters_pid[i].i_factor == 0) && (heaters_pid[i].d_factor == 0) && (heaters_pid[i].i_limit == 0)) {
heaters_pid[i].p_factor = DEFAULT_P;
heaters_pid[i].i_factor = DEFAULT_I;
heaters_pid[i].d_factor = DEFAULT_D;
heaters_pid[i].i_limit = DEFAULT_I_LIMIT;
}
#endif /* BANG_BANG */
}
}
示例12: seed_rand
void seed_rand()
{
uint32_t next_seed = eeprom_read_dword( (uint32_t*)SEED_ADDR );
srandom( next_seed );
eeprom_write_dword( (uint32_t*)SEED_ADDR, random() );
}
示例13: main
int main()
{
stdout = &mystdout;
// read the eeprom value
uint32_t c = eeprom_read_dword((void*)&value);
printf("Read from eeprom 0x%08lx -- should be 0xdeadbeef\n", c);
// change the eeprom
eeprom_write_dword((void*)&value, 0xcafef00d);
// re-read it
c = eeprom_read_dword((void*)&value);
printf("Read from eeprom 0x%08lx -- should be 0xcafef00d\n", c);
// this quits the simulator, since interupts are off
// this is a "feature" that allows running tests cases and exit
sleep_cpu();
}
示例14: Vector2l
/*
fence boundaries fetch/store
*/
Vector2l AP_Limit_Geofence::get_fence_point_with_index(uint8_t i)
{
uint32_t mem;
Vector2l ret;
if (i > (unsigned) fence_total()) {
return Vector2l(0,0);
}
// read fence point
mem = _eeprom_fence_start + (i * _fence_wp_size);
ret.x = eeprom_read_dword((uint32_t *)mem);
mem += sizeof(uint32_t);
ret.y = eeprom_read_dword((uint32_t *)mem);
return ret;
}
示例15: replace_sys_env_value
/**
@brief Replace HTML's variables to system configuration value
*/
static uint16_t replace_sys_env_value(
uint8_t* base, /**< pointer to html buffer */
uint16_t len
)
{
uint8_t sys_string[16]; // if there are more characters to substituted in response file, then make this bigger
uint8_t *tptr, *ptr;
time_t time_stamp;
tm local_time;
tptr = ptr = base;
while((ptr = (uint8_t*)strchr((char*)tptr, '$')))
{
if((tptr = (uint8_t*)strstr((char*)ptr, EVB_PAGES_SERVED)))
{
memset(tptr,0x20,14); // erase system variable trigger string
if( eeprom_is_ready() )
sprintf_P((char *)sys_string, PSTR("%08u"), eeprom_read_dword(&pagesServed) ); // number of pages served by the http server.
memcpy(tptr,sys_string,8); // copy the characters, but don't copy the /0
tptr+=8;
}
#if defined (portRTC_DEFINED)
else if((tptr = (uint8_t*)strstr((char*)ptr, EVB_RTC)))
{
memset(tptr,0x20,11); // erase system variable trigger string
if ( getDateTimeDS1307( (tm*)&local_time ) == pdTRUE)
sprintf_P((char *)sys_string, PSTR("%02u:%02u:%02u"), local_time.tm_hour, local_time.tm_min, local_time.tm_sec);
memcpy(tptr,sys_string,8); // copy the characters, but don't copy the /0
tptr+=8;
}
#else
else if((tptr = (uint8_t*)strstr((char*)ptr, EVB_RTC)))
{
memset(tptr,0x20,11); // erase system variable trigger string
time(&time_stamp);
localtime_r( &time_stamp, &local_time);
sprintf_P((char *)sys_string, PSTR("%02d:%02d:%02d"), local_time.tm_hour, local_time.tm_min, local_time.tm_sec);
memcpy(tptr,sys_string,8); // copy the characters, but don't copy the /0
tptr+=8;
}
#endif
else // tptr == 0 && ptr!=0;
{
if(ptr==base)
{
// xSerialPrint_P(PSTR("$ Character"));
return len;
}
// xSerialPrint_P(PSTR("REPLACE CONTINUE"));
tptr = ptr;
break;
}
}
if(!ptr) return len;
return (uint16_t)(tptr-base);
}