### Eemanager API Functions in C++ Source: https://github.com/gyverlibs/eemanager/blob/main/README_EN.md Lists the main functions provided by the Eemanager library for managing EEPROM data. Includes functions for starting operation, updating data, checking status, and getting block information. ```C++ // Start work, read data in a variable. // accepts the address of the start of storage of the date and key // returns: // 0 - the key coincided, the data is read from EPROM // 1 - the key did not coincide (the first launch), the data are recorded in EPROM // 2 - error, there is not enough space in Eprom Uint8_t Begin (Uint16_T Addr, Uint8_t Key); VOID settimeout (uint16_t tout = 5000);// change the timaut VOID updatenow ();// update data to her industry now VOID update ();// postpone the update and reset the timer Bool Tick ();// Tiker of updates VOID Reset ();// Reset the launch key.When rebooting (or calls is the Begin), standard data will be recorded uint16_t datasize ();// get data size Uint16_T BLOCKSIZE ();// Get the size of the entire block (data + key) uint16_t keyaddr ();// get the key address (coincides with the transferred to Begin ()) uint16_t Startaddr ();// get the address of the first byte of data in the block (equal to address in Begin () + 1) Uint16_T Endaddr ();// get the address of the last byte in the block uint16_t nEXTADDDR ();// Get the first free address for the next block ``` -------------------------------- ### EEManager Member Functions (C++) Source: https://github.com/gyverlibs/eemanager/blob/main/README.md Public methods of the EEManager class for managing EEPROM data. Includes functions for starting the manager, setting timeout, triggering updates (immediate or delayed), stopping updates, running the update ticker, resetting the key, and getting size/address information. ```C++ // Начать работу, прочитать данные в переменную. // Принимает адрес начала хранения даты и ключ // Возвращает: // 0 - ключ совпал, данные прочитаны из епром // 1 - ключ не совпал (первый запуск), данные записаны в епром // 2 - ошибка, в епроме не хватает места uint8_t begin(uint16_t addr, uint8_t key); void setTimeout(uint16_t tout = 5000); // сменить таймаут void updateNow(); // обновить данные в еепром сейчас void update(); // отложить обновление и сбросить таймер void stop(); // отменить отложенное обновление bool tick(); // тикер обновления void reset(); // сбросить ключ запуска. При перезагрузке (или вызове begin) запишутся стандартные данные uint16_t dataSize(); // получить размер данных uint16_t blockSize(); // получить размер всего блока (данные + ключ) uint16_t keyAddr(); // получить адрес ключа (совпадает с переданным в begin()) uint16_t startAddr(); // получить адрес первого байта данных в блоке (равен адресу в begin() + 1) uint16_t endAddr(); // получить адрес последнего байта в блоке uint16_t nextAddr(); // получить первый свободный адрес для следующего блока ``` -------------------------------- ### Initializing Eemanager in C++ Source: https://github.com/gyverlibs/eemanager/blob/main/README_EN.md Demonstrates how to create an Eemanager instance, passing the variable to be managed. Shows options for setting a custom update timeout during initialization. ```C++ // We transfer our variable of any type (in fact its address) - structure, array, anything Eemanager Memory (Data); // You can set the update timout, by the silence.5 seconds (5000ms) Eemanager Memory (Data, 1000); ``` -------------------------------- ### Using Eemanager Library for EEPROM Data Management (CPP) Source: https://github.com/gyverlibs/eemanager/blob/main/README_EN.md Demonstrates initializing the eemanager library with a custom data structure (Struct Data), reading data from EEPROM on startup using memory.begin(), modifying data in the structure, and scheduling an asynchronous update to EEPROM using memory.update(). It also shows how to read the raw EEPROM content and reset the data block. ```CPP // Data storage structure Struct Data { Char Val = 'H'; Chard [15] = "Ello Kitty!"; }; Data Data;// variable with which we work in the program #include // Connect Liba Eemanager Memory (Data);// We transmit our variable (in fact its address) // You can set the update timout, by the silence.5 seconds (5000ms) // Eemanager Memory (Data, 1000); VOID setup () { Serial.Begin (9600); // For ESP8266 Do not forget to call eEPROM.BEGIN (size)! /* We launch the manager, transmit: - starting address in memory for recording date - storage key (0 .. 255) or symbol */ byte stat = memory.begin (0, 'b'); /* Return codes: 0 - the key coincided, the data is read from EPROM 1 - the key did not coincide (the first launch), the data is recorded in EPROM 2 - error, in Eprom there is not enough space */ Serial.println (stat); // Determine the entire contents of the memory unit, including the key for (uint16_t I = Memory.startaddr (); i = 10000) { Memory.Reset (); Serial.println ("reset"); for (;;); } DELAY (1000);// Chilim } ``` -------------------------------- ### Initializing EEManager (C++) Source: https://github.com/gyverlibs/eemanager/blob/main/README.md These are the constructors for the EEManager class. The first takes a reference to the data variable, and the second takes a pointer to the data and its size. Both accept an optional timeout for delayed writes. ```C++ EEManager(T& data, uint16_t tout = 5000); EEManager(void* data, uint16_t size, uint16_t tout = 5000); ``` -------------------------------- ### EEBLOCK Utility Macro in C++ Source: https://github.com/gyverlibs/eemanager/blob/main/README_EN.md Describes the EEBLOCK macro, which calculates the total size required for a data block in EEPROM, including the data size plus one byte for the first-launch key. ```C++ EEBLOCK (DATA);// returns the size of the specified data Data (any type) +1 to the key (for calculating the addresses of the blocks in memory) ``` -------------------------------- ### EEBlock Macro/Function (C++) Source: https://github.com/gyverlibs/eemanager/blob/main/README.md A utility macro or function to calculate the total block size needed in EEPROM for a given data variable, including one byte for the key. Useful for determining addresses for subsequent data blocks. ```C++ EEBlock(data); // возвращает размер указанных данных data (любой тип) +1 на ключ (для вычисления адресов блоков в памяти) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.