本文整理汇总了C++中eeprom_read_word函数的典型用法代码示例。如果您正苦于以下问题:C++ eeprom_read_word函数的具体用法?C++ eeprom_read_word怎么用?C++ eeprom_read_word使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eeprom_read_word函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
// Setup the registers and read settings from EEPROM
int main(){
// Read settings from EEPROM
off_time = ((unsigned int )eeprom_read_word(OFF_TIME_ADDR ));
ramp_time = ((unsigned char )eeprom_read_byte(RAMP_TIME_ADDR))*(unsigned int)100;
fade_time = ((unsigned char )eeprom_read_byte(FADE_TIME_ADDR));
dim_level = ((unsigned char)eeprom_read_byte(DIM_LVL_ADDR));
DDRB |= PWM; // Set SWITCH to output
DDRB &= ~(ON | DIM | OFF | SENSE); // Set ON, OFF, DIM, SENSE to input
PORTB |= (ON | DIM | OFF ); // Enable Pull Up resistors
TIMSK0 |= 0x02; // Enable timer overflow interrupts
GIMSK |= 0x20; // Enable Pin Change interrupts
PCMSK |= 0x1A; // Interupt on 1, 3, 4
// Enable PWM on OCR0A
TCCR0B |= 0x03; // Divide clock by 64
TCCR0A |= 0x83; // Fast PWM
current_level = 255;
target_level = 255;
OCR0A = 255; // Start lights at full
sei(); // Enable global interrupts
while(1);
}
开发者ID:metcalf,项目名称:light-controller,代码行数:30,代码来源:light-controller.c
示例2: init_RDM
// *************** RDM Reception Initialisation ****************
void init_RDM(void)
{
if (!eeprom_read_byte((uint8_t*)EEPROM_STATUS)) {
//use DevID from EEPROM if set
eeprom_read_block(&DevID, (uint16_t*)EEPROM_DEVICE_ID, 6);
}
DmxAddress= eeprom_read_word((uint16_t*)EEPROM_DMX_ADDRESS);
//moved from check_RDM, doesn't need to be done every time label i s read
if(eeprom_read_byte((uint8_t*)EEPROM_LABEL_LEN) > 32)
eeprom_write_byte((uint8_t*)EEPROM_LABEL_LEN , 0);
DDRD |= (1<<PD2)|(1<<PD1);
PORTD &= ~(1<<PD2); //enable reception
PORTD |= (1<<PD1);
UBRRH = 0;
UBRRL = ((F_OSC/4000)-1); //250kbaud, 8N2
UCSRC = (3<<UCSZ0)|(1<<USBS);
UCSRB = (1<<RXEN)|(1<<RXCIE);
RxState= IDLE;
uint8_t i;
for (i=0; i<sizeof(DmxField); i++)
{
DmxField[i]= 0;
}
}
开发者ID:neffs,项目名称:RDM-LED-Spot,代码行数:29,代码来源:lib_rdm_in.c
示例3: main
int main(void) {
initUSART();
char ramString[STRING_LEN];
uint8_t counter;
while (1) {
printString("\r\n------------------\r\n");
eeprom_read_block(ramString, eepromString, STRING_LEN);
printString(ramString);
printString("\r\nThe counter reads: ");
counter = eeprom_read_byte(&eepromCounter);
printByte(counter);
printString("\r\nMy uint16_t value is: ");
printWord(eeprom_read_word(&eepromWord));
printString("\r\n Enter a new introduction string below:\r\n");
readString(ramString, STRING_LEN);
eeprom_update_block(ramString, eepromString, STRING_LEN);
counter++;
eeprom_update_byte(&eepromCounter, counter);
}
return 0;
}
开发者ID:DanielVercouteren,项目名称:AVR-Programming,代码行数:26,代码来源:eememDemo.c
示例4: do_time_monitor
void do_time_monitor(void *dummy)
{
uint16_t seconds;
seconds = eeprom_read_word(EEPROM_TIME_ADDRESS);
seconds ++;
eeprom_write_word(EEPROM_TIME_ADDRESS, seconds);
}
开发者ID:onitake,项目名称:aversive,代码行数:7,代码来源:main.c
示例5: setup
void setup(void)
{
g_press_down_timer = 0;
g_idle_timer = 0;
g_rom_select = eeprom_read_word(EEPROM_DEFAULT_ROM_SEL_ADDR);
DDRB = ROM_SELECT_PIN | POWER_ENABLE_PIN | UART_TX_PIN;
PORTB = (g_power_enabled?0:POWER_ENABLE_PIN) | RESTORE_KEY_PIN;
PCMSK = RESTORE_KEY_PIN;
softuart_init();
// Configure OCR1B output for 60Hz
TCCR1 = _BV(CTC1) | _BV(CS13) | _BV(CS11) | _BV(CS10); // Prescale select CK/1024
GTCCR = _BV(PWM1B) | _BV(COM1B1); // Enable PWM on OCB1
OCR1A = 0;
OCR1B = 66;
OCR1C = 132;
TIMSK |= _BV(TOV1); // Interrupt on Timer 1 Overflow (used for button)
GIMSK |= _BV(PCIE); // Interrupt on pin change for Restore Key (used to wake from sleep)
sei(); // Enable interrupts
}
开发者ID:mkotyk,项目名称:c128power,代码行数:25,代码来源:main.c
示例6: sendStats
void sendStats( boolean isStart ) {
uint8_t tt = GetTemp();
uint16_t starts = eeprom_read_word(&eeprom_starts);
uint8_t rid_low = eeprom_read_byte((unsigned char *)(EEPROM_ROBOT_ID_LOW*2));
uint8_t rid_high = eeprom_read_byte((unsigned char *)(EEPROM_ROBOT_ID_HIGH*2));
// RRS,VERSION,TEMP,STARTS,ROBOT_ID
// RRS,4,60,3222,40,0,3 = version 4, TEMP = 60 somethings (not celsius or fahrenheits), starts 3222, robot_id_low = 40, robot_id_high = 0, pcb_type = 3
Serial.print("RRS,");
Serial.print(B2_VERSION, DEC );
Serial.print(",");
Serial.print(tt, DEC);
Serial.print(",");
Serial.print(starts, DEC);
Serial.print(",");
Serial.print(rid_low, DEC);
Serial.print(",");
Serial.print(rid_high, DEC);
Serial.print(",");
Serial.print(pcb_type, DEC); // pcb type
Serial.println();
if(isStart){
starts++;
eeprom_write_word(&eeprom_starts, starts);
}
}
开发者ID:ArturFormella,项目名称:barobot,代码行数:25,代码来源:barobot_carret2.cpp
示例7: main
int main(void) {
DDRD = 0xff;
DDRB = 0xff;
DDRC = 0;
PORTC = _BV(2) | _BV(3) | _BV(4) | _BV(5); // keyboard pull-up
TCCR1A = 0;
TCCR1B = _BV(CS11) | _BV(CS10);
TIMSK = _BV(OCIE1A);
sei();
enableLed(false);
enablePower(false);
displayOutTime(0);
timer_interval = eeprom_read_word(EEPROM_OFFSET_TIME);
if (timer_interval > MAX_TIME_INTERVAL_MINUTES || timer_interval == 0) {
timer_interval = 10;
}
while(1) {
keyboardCheck();
if (timer_mode == TIMER_MODE_WAIT) {
if (key_pressed[KEY_PLUS] == 0xff && timer_interval < MAX_TIME_INTERVAL_MINUTES) {
timer_interval++;
key_pressed[KEY_PLUS] = 220;
} else if (key_pressed[KEY_MINUS] == 0xff && timer_interval > 0) {
timer_interval--;
key_pressed[KEY_MINUS] = 220;
}
}
for (uint8_t i = 0; i < 8; i++) {
displayUpdate(i);
if (timer_mode == TIMER_MODE_RUN) {
displayOutTime(time);
displayOutSeparator(hsec < 50);
if (time < 30) {
enableLed(hsec < 25 || (hsec > 50 && hsec < 75));
} else if (time < 60) {
enableLed(hsec < 75);
}
} else {
displayOutTime(timer_interval);
displayOutSeparator(true);
//displayOutSeparator(hsec < 25 || (hsec > 50 && hsec < 75));
//if (hsec < 25 || (hsec > 50 && hsec < 75)) {
//displayOutTime(timer_interval);
//displayOutSeparator(true);
//} else {
//displayClear();
//}
}
_delay_us(500);
}
}
}
开发者ID:trol73,项目名称:avr-lamp-timer,代码行数:59,代码来源:timer-for-uv-lamp.c
示例8: trigger_jog_timer
static void trigger_jog_timer(const struct reg *reg)
{
struct storage s;
s=reg_storage(reg);
cli();
jog_timer=eeprom_read_word((void *)s.loc.eeprom.start);
sei();
}
开发者ID:sde1000,项目名称:fvcontroller,代码行数:8,代码来源:temp.c
示例9: 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
示例10: init_rand
inline static void init_rand()
{
uint16_t srand_seed_value;
srand_seed_value = eeprom_read_word((void*) EEPROM_SRAND_ADDR);
srand(srand_seed_value);
eeprom_write_word((void*)EEPROM_SRAND_ADDR, rand());
}
开发者ID:denis-m-tyurin,项目名称:rgb_bedside_lamp,代码行数:8,代码来源:RGB_Bedside_Lamp.c
示例11: 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(card.longFilename, EEPROM_MATERIAL_NAME_OFFSET(nr), 8);
card.longFilename[8] = '\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:DiamondMind3DPrinters,项目名称:DMv2-Marlin,代码行数:17,代码来源:UltiLCD2_menu_material.cpp
示例12: sns_power_Init
void sns_power_Init(void)
{
#ifdef sns_power_USEEEPROM
if (EEDATA_OK)
{
///TODO: Use stored data to set initial values for the module
sns_power_ReportInterval = eeprom_read_byte(EEDATA.reportInterval);
EnergyCounter = eeprom_read_word(EEDATA16.EnergyCounterLower);
EnergyCounter += (((uint32_t)(eeprom_read_word(EEDATA16.EnergyCounterUpper)))<<16);
#ifdef POWER_SNS_PIN_ch2
EnergyCounter_ch2 = eeprom_read_word(EEDATA16.EnergyCounterLower_ch2);
EnergyCounter_ch2 += (((uint32_t)(eeprom_read_word(EEDATA16.EnergyCounterUpper_ch2)))<<16);
#endif
} else
{ //The CRC of the EEPROM is not correct, store default values and update CRC
eeprom_write_byte_crc(EEDATA.reportInterval, sns_power_SEND_PERIOD, WITHOUT_CRC);
eeprom_write_word_crc(EEDATA16.EnergyCounterUpper, 0, WITHOUT_CRC);
eeprom_write_word_crc(EEDATA16.EnergyCounterLower, 0, WITHOUT_CRC);
#ifdef POWER_SNS_PIN_ch2
eeprom_write_word_crc(EEDATA16.EnergyCounterUpper_ch2, 0, WITHOUT_CRC);
eeprom_write_word_crc(EEDATA16.EnergyCounterLower_ch2, 0, WITHOUT_CRC);
#endif
EEDATA_UPDATE_CRC;
sns_power_ReportInterval = eeprom_read_byte(EEDATA.reportInterval);
}
#endif
///Initialize hardware etc
gpio_set_in(POWER_SNS_PIN); // Set to input
gpio_set_pin(POWER_SNS_PIN); // Enable pull-up
Pcint_SetCallbackPin(sns_power_PCINT, POWER_SNS_PIN, &sns_power_pcint_callback);
MeasurmentBufferPointer = 0;
#ifdef POWER_SNS_PIN_ch2
gpio_set_in(POWER_SNS_PIN_ch2); // Set to input
gpio_set_pin(POWER_SNS_PIN_ch2); // Enable pull-up
Pcint_SetCallbackPin(sns_power_PCINT_ch2, POWER_SNS_PIN_ch2, &sns_power_pcint_callback_ch2);
MeasurmentBufferPointer_ch2 = 0;
#endif
Timer_SetTimeout(sns_power_SEND_TIMER, sns_power_ReportInterval*1000 , TimerTypeFreeRunning, 0);
#if sns_power_SEND_1_MIN_AVG == 1
Timer_SetTimeout(sns_power_SEND_TIMER_1_MIN_AVG, 60000-10 , TimerTypeFreeRunning, &sns_power_timer_callback);
#endif
}
开发者ID:codesburner,项目名称:HomeAutomation,代码行数:46,代码来源:sns_power.c
示例13: was_bootloader_requested
bool
was_bootloader_requested()
{
bool requested = (eeprom_read_word((uint16_t *)Board::kConfigMagic) == Board::kBLMagic);
eeprom_update_word((uint16_t *)Board::kConfigMagic, 0xffff);
return requested;
}
开发者ID:John-Titor,项目名称:LIN_Nodes,代码行数:8,代码来源:board.cpp
示例14: init
inline void init()
{
uint16_t wfc_timeout = eeprom_read_word(U16P(eeprom::WFC_TIMEOUT));
cmdProcessor::init(wfc_timeout);
pwm::init();
transceiver::init(cmdProcessor::processCommand);
sei();
}
开发者ID:fengye0316,项目名称:car-driver,代码行数:9,代码来源:car-driver.cpp
示例15: settings_get_word
uint16_t settings_get_word(uint8_t key)
{
if (key < WordSettingsKeyCount)
{
return eeprom_read_word(&eeWordSettings[key]);
}
return 0;
}
开发者ID:bkbme,项目名称:CALLogViewer,代码行数:9,代码来源:settings.c
示例16: read_eeprom
void read_eeprom(void){
backlight = eeprom_read_byte(ADDR_BACKLT);
volume = eeprom_read_byte(ADDR_VOLUME);
battery = eeprom_read_byte(ADDR_BATTERY);
freq_wave = eeprom_read_word(ADDR_FREQWV);
level_wave = eeprom_read_byte(ADDR_LEVELWV);
type_wave = eeprom_read_byte(ADDR_TYPEWV);
wave_out = eeprom_read_byte(ADDR_STATEWV);
}
开发者ID:dmitescu,项目名称:d-oscope,代码行数:9,代码来源:init_vars.c
示例17: main
/** Main program entry point. This routine configures the hardware required by the bootloader, then continuously
* runs the bootloader processing routine until it times out or is instructed to exit.
*/
int main(void)
{
/* Save the value of the boot key memory before it is overwritten */
uint16_t bootKeyPtrVal = *bootKeyPtr;
*bootKeyPtr = 0;
/* Check the reason for the reset so we can act accordingly */
uint8_t mcusr_state = MCUSR; // store the initial state of the Status register
MCUSR = 0; // clear all reset flags
/* Watchdog may be configured with a 15 ms period so must disable it before going any further */
wdt_disable();
/* Jump to bootloader only if correct key is present in eeprom */
if ((eeprom_read_word((uint16_t*)EEP_BOOTKEY_ADDR) != BOOTLOADER_BOOTKEY) && (eeprom_read_word((uint16_t*)EEP_BACKUP_BOOTKEY_ADDR) != BOOTLOADER_BOOTKEY))
{
StartSketch();
}
/* Setup hardware required for the bootloader */
SetupHardware();
/* Enable global interrupts so that the USB stack can function */
sei();
Timeout = 0;
while (RunBootloader)
{
CDC_Task();
USB_USBTask();
/* Time out and start the sketch if one is present */
if (Timeout > TIMEOUT_PERIOD)
RunBootloader = false;
LEDPulse();
}
/* Disconnect from the host - USB interface will be reset later along with the AVR */
USB_Detach();
/* Jump to beginning of application space to run the sketch - do not reset */
StartSketch();
}
开发者ID:Gastonius,项目名称:mooltipass,代码行数:47,代码来源:Caterina.c
示例18: game_over
void game_over(uint8_t i)
{
if (game.mode == 2 || game.mode == 3) {
connect_put(CONN_GAMEOVER);
connect_put(i);
if (connect_get() != CONN_READY) {
game_connFailed();
return;
}
}
sound_freq(SOUND_FAILED);
game_record(i);
RECTANGLE(GAME_OVER);
tft_setZoom(2);
STRING(GAME_OVER_STR);
tft_setXY(GAME_OVER_LOST_X, GAME_OVER_LOST_Y);
tft_setColour(GAME_OVER_LOST_FGC, GAME_OVER_LOST_BGC);
tft_print_string("Player");
tft_print_uint16(i + 1);
tft_print_string(" LOST");
tft_setXY(GAME_OVER_HIGH_X, GAME_OVER_HIGH_Y);
tft_setColour(GAME_OVER_HIGH_FGC, GAME_OVER_HIGH_BGC);
tft_print_uint16(eeprom_read_word(&NVScore[0]));
tft_print_string("/");
tft_print_uint16(eeprom_read_word(&NVScore[1]));
tft_setXY(GAME_OVER_REC_X, GAME_OVER_REC_Y);
tft_setColour(GAME_OVER_REC_FGC, GAME_OVER_REC_BGC);
tft_print_uint16(eeprom_read_word(&NVOverCnt[0]));
tft_print_string("/");
tft_print_uint16(eeprom_read_word(&NVOverCnt[1]));
STRING(GAME_OVER_CLN);
get:
switch (ROE_get()) {
case ROE_SW2:
case ROE_SW1:
game_record(2);
sound_freq(SOUND_CONF);
break;
case ROE_N:
goto get;
}
sound_freq(SOUND_CANCEL);
while (ROE_get() != ROE_N);
}
开发者ID:zhiyb,项目名称:Il-Matto,代码行数:44,代码来源:game.c
示例19: RefVoltage
void RefVoltage(void) {
// RefVoltage interpolates table RHtab corresponding to voltage ref_mv_offs .
// RHtab contain the factors to get capacity from load time with 470k for
// different Band gab reference voltages.
// for remember:
//resistor 470000 Ohm 1000 1050 1100 1150 1200 1250 1300 1350 1400 mV
//uint16_t RHTAB[] MEM_TEXT = { 954, 903, 856, 814, 775, 740, 707, 676, 648};
#define Ref_Tab_Abstand 50 // displacement of table is 50mV
#define Ref_Tab_Beginn 1000 // begin of table is 1000mV
unsigned int referenz;
unsigned int y1, y2;
uint8_t tabind;
uint8_t tabres;
#ifdef AUTO_CAL
referenz = ref_mv + (int16_t)eeprom_read_word((uint16_t *)(&ref_offset));
#else
referenz = ref_mv + REF_C_KORR;
#endif
ref_mv_offs = referenz;
#ifdef AUTO_RH
if (referenz >= Ref_Tab_Beginn) {
referenz -= Ref_Tab_Beginn;
} else {
referenz = 0; // limit to begin of table
}
tabind = referenz / Ref_Tab_Abstand;
tabres = referenz % Ref_Tab_Abstand;
tabres = Ref_Tab_Abstand-tabres;
if (tabind > 7) {
tabind = 7; // limit to end of table
}
// interpolate the table of factors
y1 = pgm_read_word(&RHtab[tabind]);
y2 = pgm_read_word(&RHtab[tabind+1]);
// RHmultip is the interpolated factor to compute capacity from load time with 470k
RHmultip = ((y1 - y2) * tabres + (Ref_Tab_Abstand/2)) / Ref_Tab_Abstand + y2;
//########################################
#else
RHmultip = DEFAULT_RH_FAKT; // default Multiplier for capacity measurement with R_H (470KOhm)
#endif
#if PROCESSOR_TYP == 8
referenz = 2560; // use defined internal ADC Voltage
#else
referenz = ref_mv; // use the read out internal Reference voltage
#endif
#ifdef AUTO_CAL
ADCconfig.U_Bandgap = (ref_mv + (int8_t)eeprom_read_byte((uint8_t *)&RefDiff));
#else
ADCconfig.U_Bandgap = (ref_mv + REF_R_KORR);
#endif
adc_internal_reference = ADCconfig.U_Bandgap;
}
开发者ID:lyovav,项目名称:mkstuff,代码行数:56,代码来源:RefVoltage.c
示例20: 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));
#if TEMP_SENSOR_BED != 0
material[e].bed_temperature = eeprom_read_word(EEPROM_MATERIAL_BED_TEMPERATURE_OFFSET(EEPROM_MATERIAL_SETTINGS_MAX_COUNT+e));
#endif
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));
material[e].change_temperature = eeprom_read_word(EEPROM_MATERIAL_CHANGE_TEMPERATURE(EEPROM_MATERIAL_SETTINGS_MAX_COUNT+e));
material[e].change_preheat_wait_time = eeprom_read_byte(EEPROM_MATERIAL_CHANGE_WAIT_TIME(EEPROM_MATERIAL_SETTINGS_MAX_COUNT+e));
if (material[e].change_temperature < 10)
material[e].change_temperature = material[e].temperature;
}
}
开发者ID:Ronan87,项目名称:Ultimaker2Marlin,代码行数:19,代码来源:UltiLCD2_menu_material.cpp
注:本文中的eeprom_read_word函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论