本文整理汇总了C++中eeprom_write_byte函数的典型用法代码示例。如果您正苦于以下问题:C++ eeprom_write_byte函数的具体用法?C++ eeprom_write_byte怎么用?C++ eeprom_write_byte使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eeprom_write_byte函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DACOffsetCalib
/********************************************//**
* @brief Funkcja kalibrujaca offset DAC
* @param speed : wartosc zmiany (-128 - 127)
* @return uint8_t : aktualna wartosc (0 - 255)
***********************************************/
uint8_t DACOffsetCalib(int8_t val)
{
uint8_t offset = eeprom_read_byte(&e_offset);
if((uint16_t)offset + val < 256 && offset + val >= 0)
offset+= val;
eeprom_write_byte(&e_offset, offset);
DACB.OFFSETCAL=offset;
return offset;
}
示例2: DACGainCalib
/********************************************//**
* @brief Funkcja kalibrujaca wzmocnienie DAC
* @param speed : wartosc zmiany (-128 - 127)
* @return uint8_t : aktualna wartosc (0 - 255)
***********************************************/
uint8_t DACGainCalib(int8_t val)
{
uint8_t gain = eeprom_read_byte(&e_gain);
if((uint16_t)gain + val < 256 && gain + val >= 0)
gain+= val;
eeprom_write_byte(&e_gain, gain);
DACB.GAINCAL=gain;
return gain;
}
示例3: _EEPROM_writeData
void _EEPROM_writeData(int &pos, uint8_t* value, uint8_t size)
{
do
{
eeprom_write_byte((unsigned char*)pos, *value);
pos++;
value++;
}while(--size);
}
示例4: while
int
EEPROM::Device::write(void* dest, const void* src, size_t size)
{
uint8_t* dp = (uint8_t*) dest;
const uint8_t* sp = (const uint8_t*) src;
size_t res = size;
while (size--) eeprom_write_byte(dp++, *sp++);
return (res);
}
示例5: eeprom_del_rule
uint8_t eeprom_del_rule (uint8_t pos)
{
/* del_rule
*
*/
uint8_t count,i;
uint16_t target_adress;
RULES_STRUCTUR hilf;
RULE_DEBUG("Del Rule:%i\r\n",pos);
//aktuelle Anzahl auslesen
count = get_rule_count();
if(pos>=0 && pos<=count)
{
//folgende Regeln nachr�ckenen lassen
for(i=pos;i<count;i++)
{
if(eeprom_get_rule(i+1,&hilf))
{
// Zieladresse berechnen
target_adress=RULES_EEPROM_STORE+1+(i*sizeof(RULES_STRUCTUR));
RULE_DEBUG("EEPROM write adress:%i\r\n",target_adress);
// Regel in den EEPROM schreiben
eeprom_busy_wait ();
eeprom_write_block((unsigned char *)&hilf,(unsigned char *)target_adress,sizeof(RULES_STRUCTUR));
}
else
{
return 0;
}
}
//bisher alles OK -> neuen Wert ins EEPROM schreiben
eeprom_busy_wait ();
eeprom_write_byte((unsigned char *)(RULES_EEPROM_STORE),--count);
return 1;
}
else
{
RULE_DEBUG("Failure: Out of Range\r\n");
return 0;
}
return 0;
}
示例6: writeColor
void writeColor(uint8_t color, uint8_t* base){
uint8_t i = RING_BUFFER_LEN;
uint8_t* loc = base;
while(i-->1){// Not going to bother to check if we can skip writing.
if(0 != eeprom_read_byte(loc)){
eeprom_write_byte(loc++,0);
if(color != 0)
eeprom_write_byte(loc,color);
return;
}
loc++;
}
// Otherwise, nuke the last byte with 0, and write the new value to the beginning
if(0 != eeprom_read_byte(loc))
eeprom_write_byte(loc,0);
if(color != 0)
eeprom_write_byte(base,color);
}
示例7: initializeDelays
void initializeDelays()
{
detectorOnDelay = eeprom_read_byte((uint8_t*)(CHANNEL0_ON_DELAY));
if (0xFF == detectorOnDelay || 0x00 == detectorOnDelay)
{
eeprom_write_byte((uint8_t*)(CHANNEL0_ON_DELAY), 4);
detectorOnDelay = eeprom_read_byte((uint8_t*)(CHANNEL0_ON_DELAY));
}
detectorOffDelay = eeprom_read_byte((uint8_t*)(CHANNEL0_OFF_DELAY));
if (0xFF == detectorOffDelay || 0x00 == detectorOffDelay)
{
eeprom_write_byte((uint8_t*)(CHANNEL0_OFF_DELAY), 25);
detectorOffDelay = eeprom_read_byte((uint8_t*)(CHANNEL0_OFF_DELAY));
}
}
示例8: try_reset_eeprom
void try_reset_eeprom() {
const char* symbol = "C_Quencer 0.4";
char id_str[13];
for (int i=0; i<13; ++i) {
eeprom_busy_wait();
id_str[i] = eeprom_read_byte((uint8_t*)(i+1000));
}
if (strncmp(id_str, symbol, sizeof(id_str)) != 0) {
for (int i=0; i<1000; ++i) {
eeprom_busy_wait();
eeprom_write_byte((uint8_t*)i, 0);
}
eeprom_write_block(symbol, (uint8_t*)1000, sizeof(symbol));
for (int i=0; i<13; ++i) {
eeprom_busy_wait();
eeprom_write_byte((uint8_t*)(i+1000), symbol[i]);
}
}
}
示例9: lcd_material_store_material
void lcd_material_store_material(uint8_t nr)
{
eeprom_write_word(EEPROM_MATERIAL_TEMPERATURE_OFFSET(nr), material[active_extruder].temperature);
eeprom_write_word(EEPROM_MATERIAL_BED_TEMPERATURE_OFFSET(nr), material[active_extruder].bed_temperature);
eeprom_write_word(EEPROM_MATERIAL_FLOW_OFFSET(nr), material[active_extruder].flow);
eeprom_write_byte(EEPROM_MATERIAL_FAN_SPEED_OFFSET(nr), material[active_extruder].fan_speed);
eeprom_write_float(EEPROM_MATERIAL_DIAMETER_OFFSET(nr), material[active_extruder].diameter);
//eeprom_write_block(card.longFilename, EEPROM_MATERIAL_NAME_OFFSET(nr), 8);
}
示例10: main
/**
* @fn void main(void)
* @brief eeprom emulation main function entry
*
*/
void main (void)
{
U16 i;
U8 tmp;
SFRPAGE_SWITCH()
ENABLE_VDDMON()
DISABLE_WDT()
SFRPAGE_RESTORE()
eeprom_init();
for(i = 0;i< EE_SIZE ;i++) {
if(eeprom_read_byte(i,&test_buf[i]) == ERROR)
goto error;
}
for(i = 0;i < 2;i++) {
test_buf[i] = i + 0x55;
if(eeprom_write_byte(i, test_buf[i]) == ERROR)
goto error;
}
tmp = 0;
while(tmp < 50){
for(i = 2;i< EE_SIZE; i++) {
test_buf[i] = i + 1;
if(eeprom_write_byte(i, test_buf[i] + tmp) == ERROR)
goto error;
}
tmp++;
}
for(i = 0; i< EE_SIZE; i++) {
if(eeprom_read_byte(i,&test_buf[i]) == ERROR)
goto error;
if((i == 0) || (i == 1)){
if ((test_buf[0] != 0x55) || (test_buf[1] != 0x56))
goto error;
}else{
if (test_buf[i] != (i + tmp))
goto error;
}
}
while(1);
error:
i = 0xDEAD;
while(1);
}
示例11: getAddress
void Preset::save(uint8_t index){
uint8_t buf[MIDI_ZONE_PRESET_SIZE];
uint8_t* offset = getAddress(index);
eeprom_write_byte(offset++, size);
for(uint8_t i=0; i<size; ++i){
uint8_t bts = writeZone(buf, i);
eeprom_write_block(buf, offset, bts);
offset += bts;
}
}
示例12: pgm_set_program_state
void pgm_set_program_state( u8 slot, u8 state )
{
u8 newstate = state ? ( pgm_mask | ( 1 << slot ) ) : ( pgm_mask & ( u8 )~( 1 << slot ) );
if( newstate == pgm_mask )
return;
pgm_mask = newstate;
eeprom_write_byte( PGMADDR, pgm_mask );
eeprom_busy_wait();
}
示例13: write_to_eeprom
int write_to_eeprom(struct eeprom *e, FILE *fp, int addr, char* pBuffer, int size)
{
int ret = -1;
int i;
if ( e != (struct eeprom *) NULL && pBuffer != NULL )
{
if( strlen(pBuffer) >= size )
{
for( i = 0, ret = 0; ret == 0 && i < size; i++ )
{
if( (ret=eeprom_write_byte(e, addr++, pBuffer[i])) )
{
fprintf(stderr, "write error at addr %0x\n", addr);
}
}
}
else
{
for( i = 0, ret = 0; ret == 0 && i < size; i++ )
{
if( (ret=eeprom_write_byte(e, addr++, pBuffer[0])) )
{
fprintf(stderr, "write error at addr %0x\n", addr);
}
}
}
}
#ifdef _OLD_STYLE_MODE
int c;
while((c = fgetc(fp)) != EOF)
{
fflush(stdout);
if(eeprom_write_byte(e, addr++, c))
{
fprintf(stderr, "write error at addr %0x\n", addr);
}
}
#endif // _OLD_STYLE_MODE
return( ret );
}
示例14: lcd_material_verify_material_settings
bool lcd_material_verify_material_settings()
{
bool hasUPET = false;
uint8_t cnt = eeprom_read_byte(EEPROM_MATERIAL_COUNT_OFFSET());
if (cnt < 2 || cnt > EEPROM_MATERIAL_SETTINGS_MAX_COUNT)
return false;
while(cnt > 0)
{
cnt --;
if (eeprom_read_word(EEPROM_MATERIAL_TEMPERATURE_OFFSET(cnt)) > HEATER_0_MAXTEMP)
return false;
// if (eeprom_read_word(EEPROM_MATERIAL_BED_TEMPERATURE_OFFSET(cnt)) > BED_MAXTEMP)
// return false;
if (eeprom_read_byte(EEPROM_MATERIAL_FAN_SPEED_OFFSET(cnt)) > 100)
return false;
if (eeprom_read_word(EEPROM_MATERIAL_FLOW_OFFSET(cnt)) > 1000)
return false;
if (eeprom_read_float(EEPROM_MATERIAL_DIAMETER_OFFSET(cnt)) > 10.0)
return false;
if (eeprom_read_float(EEPROM_MATERIAL_DIAMETER_OFFSET(cnt)) < 0.1)
return false;
eeprom_read_block(card.longFilename, EEPROM_MATERIAL_NAME_OFFSET(cnt), 8);
if (strcmp_P(card.longFilename, PSTR("UPET")) == 0)
hasUPET = true;
}
cnt = eeprom_read_byte(EEPROM_MATERIAL_COUNT_OFFSET());
if (!hasUPET && cnt < EEPROM_MATERIAL_SETTINGS_MAX_COUNT)
{
strcpy_P(card.longFilename, PSTR("UPET"));
eeprom_write_block(card.longFilename, EEPROM_MATERIAL_NAME_OFFSET(cnt), 5);
eeprom_write_word(EEPROM_MATERIAL_TEMPERATURE_OFFSET(cnt), 250);
// eeprom_write_word(EEPROM_MATERIAL_BED_TEMPERATURE_OFFSET(cnt), 60);
eeprom_write_byte(EEPROM_MATERIAL_FAN_SPEED_OFFSET(cnt), 50);
eeprom_write_word(EEPROM_MATERIAL_FLOW_OFFSET(cnt), 100);
eeprom_write_float(EEPROM_MATERIAL_DIAMETER_OFFSET(cnt), 2.85);
eeprom_write_byte(EEPROM_MATERIAL_COUNT_OFFSET(), cnt + 1);
}
return true;
}
示例15: ENABLED
void PrintCounter::initStats() {
#if ENABLED(DEBUG_PRINTCOUNTER)
PrintCounter::debug(PSTR("initStats"));
#endif
this->loaded = true;
this->data = { 0, 0, 0, 0, 0.0 };
this->saveStats();
eeprom_write_byte((uint8_t *) this->address, 0x16);
}