Chat freely about anything...

User avatar
By androidfanboy
#73913 Hey guys,

I'm using the RTC memory but it's not running as expected. Here's my initialization above setup():

Code: Select allextern "C" {
#include "user_interface.h"
}

typedef struct {
  boolean var1 = false;
  uint8_t var2 = 0;
  uint8_t var3 = 0;
} rtcStore;

rtcStore RTCvals;


and here's the line of code that doesn't run (it will print "FAILED!"):

Code: Select allif (!system_rtc_mem_write(65, &RTCvals.var2, 4)) Serial.println("FAILED!");


Funny thing is that I'm pretty sure it worked before with the same commands... However, if I store all the contents of RTCvals then it works using this line:

Code: Select allsystem_rtc_mem_write(64, &RTCvals, sizeof(RTCvals));


Anyway, what's the right way of storing the contents of only one variable to a certain block in RTC mem? I know RTC mem starts at 64 and is stored in blocks of 4 bytes but I'm also fairly certain that 65 should be the next block of 4 bytes. Why isn't it working? Again, I also thought this used to work before. I'm using Arduino IDE 1.8.5 if that helps any.

Thanks!