本文整理汇总了C++中STORAGE类的典型用法代码示例。如果您正苦于以下问题:C++ STORAGE类的具体用法?C++ STORAGE怎么用?C++ STORAGE使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了STORAGE类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
/**
* init
*
* Initialize register
*/
void REGISTER::init(void)
{
// Does the value need to be read from EEPROM?
if (eepromAddress >= 0)
{
STORAGE nvMem;
// Read from info memory
nvMem.read(value, eepromBank, eepromAddress, length);
}
}
示例2: setValue
/**
* 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);
}
}
示例3:
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;
}
示例4: main
int main(int argc, char **argv) {
STORAGE store;
SOLVE_BASE *solve;
EOS_BASE *equation_of_state;
MPI_Init(&argc,&argv);
MPI_Comm_size(MPI_COMM_WORLD,&store.NumOfCpu);
MPI_Comm_rank(MPI_COMM_WORLD,&store.id);
// MPI::Init ( argc, argv );
//
// store.id = MPI::COMM_WORLD.Get_rank ( );
//
// store.NumOfCpu = MPI::COMM_WORLD.Get_size ( );
istringstream line;
if (argv[1][1] == 'i')
{
string input(argv[2]);
store.PN = 1;
store.PM = 1;
store.PL = 1;
store.Initialization(input);
}
else
{
if (argv[2][0] == '3')
{
//store.PN = argv[4][0] - 48;
//store.PM = argv[5][0] - 48;
//store.PL = argv[6][0] - 48;
string input = argv[4];
line.clear();
line.str(input);
line>>store.PN;
line.clear();
input = argv[5];
line.clear();
line.str(input);
line>>store.PM;
line.clear();
store.PL = argv[6][0] - 48;
input=argv[8];
store.Initialization(input);
}
else if (argv[2][0] == '2')
示例5: 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));
}
示例6: init
/**
* init
*
* Initialize SWAP registers and stack
*/
void SWAP::init(void)
{
uint8_t i;
STORAGE nvMem;
// Read signature from info/eeprom memory
uint8_t signature[2];
nvMem.read(signature, DEFAULT_NVOLAT_SECTION, NVOLAT_SIGNATURE, sizeof(signature));
// Correct signature in non-volatile memory?
if ((signature[0] != NVOLAT_SIGNATURE_HIGH) || (signature[1] != NVOLAT_SIGNATURE_LOW))
nvolatToFactoryDefaults(); // Copy default settings in non-volatile memory
// Intialize registers
for(i=0 ; i<regTableSize ; i++)
regTable[i]->init();
// Config radio settings
panstamp.radio.devAddress = devAddress & 0xFF;
panstamp.radio.setCCregs();
// Attach RF ISR
panstamp.attachInterrupt(pacKetReceived);
}
示例7: 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);
}
示例8: eepromReadInt
static inline int eepromReadInt(STORAGE& storage, int addr) {
uint8_t low = storage.read(addr++);
uint8_t high = storage.read(addr);
return word(high, low);
}
示例9: at
//-----------------------------------------------------------------
//!
//! \brief get value at i
//!
//! Return the value of element i. This method
//! performs index checking.
//! \throws index_error if i exceeds array size
//! \param i linear index of element
//! \return value at i
//!
value_type at(size_t i) const
{
try
{
return _data.at(i);
}
catch(std::out_of_range &)
{
std::stringstream ss;
ss<<"Index "<<i<<" is out of range ("<<size()<<")!";
throw index_error(EXCEPTION_RECORD,ss.str());
}
}
示例10: rend
//-----------------------------------------------------------------
//!
//! \brief return const reverse iterator to 0-1 element
//!
const_reverse_iterator rend() const { return _data.rend(); }
示例11: rbegin
//-----------------------------------------------------------------
//!
//! \brief return reverse iterator to last element
//!
reverse_iterator rbegin() { return _data.rbegin(); }
示例12: begin
//-----------------------------------------------------------------
//!
//! \brief const-iterator to first element
//!
//! Returns a const-iterator to the first element in the array.
//! \return iterator to first element
//!
const_iterator begin() const { return _data.begin(); }
示例13: end
//-----------------------------------------------------------------
//!
//! \brief const-iterator to last element
//!
//! Returns a const-iterator to the last element in the array.
//!
//! \return iterator to last element
//!
const_iterator end() const { return _data.end(); }
示例14:
//-----------------------------------------------------------------
//!
//! \brief return const pointer
//!
//! Return a const pointer to the data stored in the array.
//!
//! \return pointer to data
//!
const value_type *data() const
{
return _data.data();
}
示例15: back
//-----------------------------------------------------------------
//!
//! \brief value of last element
//!
//! Return the value of the last element in the linear view of
//! the array.
//!
//! \return value of last element
//!
value_type back() const { return _data.back(); }