Exemplo n.º 1
0
/**
 * 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);
  }
}
Exemplo n.º 2
0
uint8_t Encoder<POT,STORAGE, LOG>::loadSettings(STORAGE& storage, int addr) {
  uint8_t rvalue = true;
  // load settings from EEPROM
  if( 179 == storage.read(addr) ) {
    // Okay, we've written here before, w00t!
    addr++;
    JTIncrementalEncoder::loadSettings(storage, this->state.channels.a, addr);
    JTIncrementalEncoder::loadSettings(storage, this->state.channels.b, addr);
  } else {
    rvalue = false;
  }
  return rvalue;
}
Exemplo n.º 3
0
/**
 * 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);
}
Exemplo n.º 4
0
static inline int eepromReadInt(STORAGE& storage, int addr) {
  uint8_t low = storage.read(addr++);
  uint8_t high = storage.read(addr);
  return word(high, low);
}