#include "EepromManager.h"

EepromManager::EepromManager()
{
    this->currentAddressEnding = 4;
    EEPROM.begin(4000);
}

EepromUnit *EepromManager::registerEempromUnit(size_t size)
{
    // create a new Unit at the current address ending
    EepromUnit *newUnit = new EepromUnit(this, this->currentAddressEnding, size);
    // move the new address ending
    this->currentAddressEnding += size;
    return newUnit;
}


// --------------
// - EepromUnit -
// --------------

EepromUnit::EepromUnit(EepromManager *manager, int address, size_t size)
{
    this->manager = manager;
    this->address = address;
    this->size = size;
}