sosandroid / FRAM_MB85RC_I2C

Arduino library for I2C FRAM - Fujitsu MB85RC & Cypress FM24, CY15B
Other
56 stars 21 forks source link

Storing a String or DateTime type in FRAM #25

Closed pawisoon closed 3 years ago

pawisoon commented 4 years ago

Hi! Is it possible to store Strings or DateTime type(from Arduino RTClib) in FRAM? Can someone share a code snippet that does that? I tried to edit "store anything" example, but adding a String type variable to a struct: typedef struct MYDATA_t { bool data_0; float data_1; long data_2; int data_3; byte data_4; String log; };

Is causing compilation error: FRAM_I2C_store_anything:38:14: error: use of deleted function 'MYDATA4I2C_t::MYDATA4I2C_t()' MYDATA4I2C_t mydata; //data to be written in memory ^ /var/folders/5h/7rxp3rmn5351zh6r8cxhz1sr0000gn/T/arduino_modified_sketch_254966/FRAM_I2C_store_anything.ino:33:15: note: 'MYDATA4I2C_t::MYDATA4I2C_t()' is implicitly deleted because the default definition would be ill-formed: typedef union MYDATA4I2C_t { ^ FRAM_I2C_store_anything:34:11: error: union member 'MYDATA4I2C_t::datastruct' with non-trivial 'MYDATA_t::MYDATA_t()' MYDATA_t datastruct; ^ FRAM_I2C_store_anything:39:14: error: use of deleted function 'MYDATA4I2C_t::MYDATA4I2C_t()' MYDATA4I2C_t readdata; //data read from memory ^ /var/folders/5h/7rxp3rmn5351zh6r8cxhz1sr0000gn/T/arduino_modified_sketch_254966/FRAM_I2C_store_anything.ino: In function 'void __static_initialization_and_destruction_0(int, int)': FRAM_I2C_store_anything:39:14: error: use of deleted function 'MYDATA4I2C_t::~MYDATA4I2C_t()' /var/folders/5h/7rxp3rmn5351zh6r8cxhz1sr0000gn/T/arduino_modified_sketch_254966/FRAM_I2C_store_anything.ino:33:15: note: 'MYDATA4I2C_t::~MYDATA4I2C_t()' is implicitly deleted because the default definition would be ill-formed: typedef union MYDATA4I2C_t { ^ FRAM_I2C_store_anything:34:11: error: union member 'MYDATA4I2C_t::datastruct' with non-trivial 'MYDATA_t::~MYDATA_t()' MYDATA_t datastruct; ^ FRAM_I2C_store_anything:38:14: error: use of deleted function 'MYDATA4I2C_t::~MYDATA4I2C_t()' MYDATA4I2C_t mydata; //data to be written in memory ^ exit status 1 use of deleted function 'MYDATA4I2C_t::MYDATA4I2C_t()'

sosandroid commented 4 years ago

Does the example work without modification ?