本文整理汇总了C++中STORAGE::write方法的典型用法代码示例。如果您正苦于以下问题:C++ STORAGE::write方法的具体用法?C++ STORAGE::write怎么用?C++ STORAGE::write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类STORAGE
的用法示例。
在下文中一共展示了STORAGE::write方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nvolatToFactoryDefaults
/**
* nvolatToFactoryDefaults
*
* Write default config values in non-volatile memory
*/
void SWAP::nvolatToFactoryDefaults(void)
{
STORAGE nvMem;
// Signature
uint8_t signature[] = {NVOLAT_SIGNATURE_HIGH, NVOLAT_SIGNATURE_LOW};
nvMem.write(signature, DEFAULT_NVOLAT_SECTION, NVOLAT_SIGNATURE, sizeof(signature));
// Frequency channel
uint8_t channel[] = {CCDEF_CHANNR};
nvMem.write(channel, DEFAULT_NVOLAT_SECTION, NVOLAT_FREQ_CHANNEL, sizeof(channel));
// Sync word
uint8_t syncW[] = {CCDEF_SYNC1, CCDEF_SYNC0};
nvMem.write(syncW, DEFAULT_NVOLAT_SECTION, NVOLAT_SYNC_WORD, sizeof(syncW));
// SWAP address (pseudo-random number)
uint16_t random = panstamp.GET_RANDOM();
uint8_t addr[] = {(random >> 8) & 0xFF, random & 0xFF};
nvMem.write(addr, DEFAULT_NVOLAT_SECTION, NVOLAT_DEVICE_ADDR, sizeof(addr));
// TX interval
uint8_t txInt[] = {0xFF, 0};
nvMem.write(txInt, DEFAULT_NVOLAT_SECTION, NVOLAT_TX_INTERVAL, sizeof(txInt));
}
示例2:
uint8_t Encoder<POT,STORAGE, LOG>::saveSettings(STORAGE& storage, int addr) {
uint8_t rvalue = true;
storage.write(addr, 179);
addr++;
JTIncrementalEncoder::saveSettings(storage, this->state.channels.a, addr);
JTIncrementalEncoder::saveSettings(storage, this->state.channels.b, addr);
return rvalue;
}
示例3: setData
/**
* setData
*
* Set register value
*
* @param data New register value
*/
void REGISTER::setData(unsigned char *data)
{
// Update register value
if (setValue != NULL)
setValue(id, data);
// Send SWAP status message
sendSwapStatus();
// Does the value need to be saved in info memory (flash)?
if (eepromAddress >= 0)
{
STORAGE nvMem;
// Write info memory
nvMem.write(value, eepromBank, eepromAddress, length);
}
}
示例4: eepromWriteInt
static inline void eepromWriteInt(STORAGE& storage, int addr, int value) {
uint8_t low = lowByte(value);
uint8_t high = highByte(value);
storage.write(addr++, low);
storage.write(addr, high);
}