本文整理汇总了C++中writeEEPROM函数的典型用法代码示例。如果您正苦于以下问题:C++ writeEEPROM函数的具体用法?C++ writeEEPROM怎么用?C++ writeEEPROM使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了writeEEPROM函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: write_app_register
///////////////////////////////////////////////////////////////////////////////
// write_app_register
//
void write_app_register( uint08_t reg, uint08_t val )
{
SendMsg.priority = VSCP_PRIORITY_MEDIUM;
SendMsg.vscp_class = VSCP_CLASS1_PROTOCOL;
SendMsg.vscp_type = VSCP_TYPE_PROTOCOL_RW_RESPONSE;
SendMsg.length = 2;
SendMsg.data[0] = reg;
SendMsg.data[1] = ~val; // error return
switch ( reg ) {
// Zone
case 0x23:
writeEEPROM( REG_APP_ZONE, val);
SendMsg.data[1] = readEEPROM( REG_APP_ZONE);
break;
// SubZone
case 0x24:
writeEEPROM( REG_DOOR_SUBZONE, val);
SendMsg.data[1] = readEEPROM( REG_DOOR_SUBZONE);
break;
default:
SendMsg.data[1] = ~val; // error return
break;
}
// Send data
VSCP_enqMsgTx( &SendMsg, FALSE);
}
示例2: main
void main(void) {
byte evalue;
initSquareWear();
setModeOutput(pinC7);
latC7 = 0;
delayMilliseconds(250); // short delay for EEPROM to stablize
evalue = readEEPROM(0x0); // read EEPROM address 0
switch(evalue) {
case 0:
writeEEPROM(0x0, 1); // write next index to EEPROM address 0
busyEEPROM(); // wait till write completes
while(1) {
latC7 = !latC7;
delayMilliseconds(100);
}
break;
case 1:
writeEEPROM(0x0, 2);
busyEEPROM();
while(1) {
latC7 = !latC7;
delayMilliseconds(500);
}
break;
default:
writeEEPROM(0x0, 0);
busyEEPROM();
while(1) {
latC7 = !latC7;
delayMilliseconds(1000);
}
break;
}
}
示例3: savePassword
unsigned char savePassword(long g){
if(g>0){
processNumber(g);
unsigned char ca=getFCell();
writeEEPROM(ca,num1);
writeEEPROM((ca+1),num2);
writeEEPROM((ca+2),num3);
}
return 1;
}
示例4: initEEPROM
//Initialise l'EEPROM avec des valeurs par défaut
void initEEPROM() {
//Charge les coeffs PID par défaut
defaultPID();
//Charge les trims par défaut (consignes utilisées en mode failsafe également)
defaultTrim();
//Angles à 0
memset(&anglesOffsets, 0, sizeof(IMU_ANGLES_VITESSES));
//Ecrit les données en EEPROM
writeEEPROM (&coeffsPID, EEPROM_BASE, MAX_PID * sizeof(COEFFS_PID));
writeEEPROM (&telecommandeOffsets, EEPROM_BASE + EEPROM_OFFSET_TRIMS, sizeof(TELECOMMANDE_DATA));
writeEEPROM (&anglesOffsets, EEPROM_BASE + EEPROM_OFFSET_ANGLES, sizeof(IMU_ANGLES_VITESSES));
printf("->Initialisation EEPROM\n");
}
示例5: writeEEPROM
/*
* Save the settings in EEPROM
*/
void Network::writeSettings() {
int j = 1;
j+= writeEEPROM(mac_oui, j, sizeof(mac_oui) * sizeof(uint8_t));
j+= writeEEPROM(mac, j, sizeof(mac) * sizeof(uint8_t));
j+= writeEEPROM(&use_dhcp, j, sizeof(bool));
j+= writeEEPROM(&ip, j);
j+= writeEEPROM(&subnet, j);
j+= writeEEPROM(&gateway, j);
j+= writeEEPROM(&dns, j);
j+= writeEEPROM(&httpPort, j, sizeof(httpPort));
j+= writeEEPROM(&websocketPort, j,sizeof(websocketPort));
}
示例6: stickKnobCalibrationMiddle
/** @Brief 电位器\旋钮获取中值
* @ 多次采用取平均
*
* @Note
* 1) 调用此程序前,各电位器拨到中间位置
*/
void stickKnobCalibrationMiddle(void) {
uint32_t currentTime;
uint8_t i, count;
uint16_t adc;
uint32_t adcSum[STICK_KNOB_SUM];
for(i=0; i<STICK_KNOB_SUM; i++) {
adcSum[i] = 0;
StickKnob[i].adcLimitMiddle = 2048;
}
count = 0;
//1) 每20ms采样一次,1s后计算均值
currentTime = micros() + 300000;
while((int32_t)(currentTime - micros()) >= 0) {
for(i=0; i<STICK_KNOB_SUM; i++) {
adc = adcGetChannel(StickKnob[i].adcChannel);
adcSum[i] += adc;
}
count++;
delay(20);
LED0_TOGGLE;
}
for(i=0; i<STICK_KNOB_SUM; i++) {
StickKnob[i].adcLimitMiddle = adcSum[i]/count;
}
//2) 保存至EEPROM
for(i = 0; i < STICK_KNOB_SUM; i++) {
cfg.adcLimitMiddle[i] = StickKnob[i].adcLimitMiddle;
}
writeEEPROM(1, 1);
}
示例7: changeProfile
void changeProfile(uint8_t profileIndex)
{
masterConfig.current_profile_index = profileIndex;
writeEEPROM();
readEEPROM();
beeperConfirmationBeeps(profileIndex + 1);
}
示例8: cliSave
static void cliSave(char *cmdline)
{
cliPrint("Saving...");
copyCurrentProfileToProfileSlot(masterConfig.current_profile_index);
writeEEPROM();
cliReboot();
}
示例9: controlPWM
//Function that control the specific brightness of the led conected to specific pwmpin.
//the structure of the command is pwmpin:brightness
int controlPWM(String command) {
int index=command.indexOf(":");
String pwmpin=command.substring(0,index);
String val=command.substring(index+1);
int pin=pwmpin.toInt();
int value=val.toInt();
if (value<256&&value>=0){
analogWrite(pin,value);
if (pin==10){
EEPROMData.outputData.pwmoutput[2].pin=pin;
EEPROMData.outputData.pwmoutput[2].value=value;
}
else if (pin==11){
EEPROMData.outputData.pwmoutput[3].pin=pin;
EEPROMData.outputData.pwmoutput[3].value=value;
}
else if (pin>13&&pin<18){
EEPROMData.outputData.pwmoutput[pin-10].pin=pin;
EEPROMData.outputData.pwmoutput[pin-10].value=value;
}
else if (pin<2){
EEPROMData.outputData.pwmoutput[pin].pin=pin;
EEPROMData.outputData.pwmoutput[pin].value=value;
}
writeEEPROM();
return value;
}
else{
return -1;// return -1 if the pin sended on the command is not the PWM output ones
}
}
示例10: osdHardwareInit
void osdHardwareInit(void)
{
LED0_ON;
delay(500);
max7456_hardwareReset();
LED0_OFF;
osdHardwareApplyConfiguration(osdVideoConfig()->videoMode);
max7456_extiConfigure(&max7456LOSExtiConfig, &max7456VSYNCExtiConfig, &max7456HSYNCExtiConfig);
if (osdFontConfig()->fontVersion != FONT_VERSION) {
// before
max7456_showFont();
delay(5000); // give the user a chance to power off before changing
max7456_resetFont();
// after
max7456_showFont();
delay(5000); // give the user a chance to power off after changing
osdFontConfig()->fontVersion = FONT_VERSION;
writeEEPROM();
max7456_clearScreen();
max7456_ensureDisplayClearIsComplete();
}
}
示例11: changeProfile
void changeProfile(uint8_t profileIndex)
{
masterConfig.current_profile_index = profileIndex;
writeEEPROM();
readEEPROM();
blinkLedAndSoundBeeper(2, 40, profileIndex + 1);
}
示例12: vscp_setControlByte
///////////////////////////////////////////////////////////////////////////////
// setVSCPControlByte
//
void vscp_setControlByte( uint08_t ctrl )
{
if (GetResource(RESOURCE_EE_ID) == E_OK)
{
writeEEPROM( VSCP_EEPROM_CONTROL, ctrl );
ReleaseResource(RESOURCE_EE_ID);
}
}
示例13: vscp_setSegmentCRC
///////////////////////////////////////////////////////////////////////////////
// setSegmentCRC
//
void vscp_setSegmentCRC( uint08_t crc )
{
if (GetResource(RESOURCE_EE_ID) == E_OK)
{
writeEEPROM( VSCP_EEPROM_SEGMENT_CRC, crc );
ReleaseResource(RESOURCE_EE_ID);
}
}
示例14: vscp_setManufacturerId
///////////////////////////////////////////////////////////////////////////////
// setVSCPManufacturerId
//
// Set Manufacturer id and subid to EEPROM
//
void vscp_setManufacturerId( uint08_t idx, uint08_t data )
{
if (GetResource(RESOURCE_EE_ID) == E_OK)
{
writeEEPROM( VSCP_EEPROM_REG_MANUFACTUR_ID0 + idx, data );
ReleaseResource(RESOURCE_EE_ID);
}
}
示例15: vscp_setNickname
///////////////////////////////////////////////////////////////////////////////
// setNickname
//
void vscp_setNickname( uint08_t nickname )
{
if (GetResource(RESOURCE_EE_ID) == E_OK)
{
writeEEPROM( VSCP_EEPROM_NICKNAME, nickname );
ReleaseResource(RESOURCE_EE_ID);
}
}