#include #include // Arduino constants static constexpr uint8_t i2c_buff_size = 32; static constexpr uint8_t serial_buff_size = 64; // EEPROM constants static constexpr int page_count = 512; static constexpr int page_size = 128; static constexpr int i2c_buff_per_page = page_size / i2c_buff_size; static constexpr uint8_t eeprom_addr = 0b1010000; uint8_t pageData[page_size] = {}; uint16_t pageAddr = 0; // Send a two bytes address via I²C which selects an address within the EEPROM. void write_addr(uint16_t addr) { Wire.write((uint8_t)(addr >> 8)); Wire.write((uint8_t)addr); } // When the receiver sums on its side, it can just add this sum and check that is 0. uint16_t sum_complement(const uint8_t data[page_size]) { uint16_t sum = 0; for (int i = 0; i