Part Number: MSP430FR5969
Hello. I am working on sensor firmware where the state for the sensor logic is encapsulated in a C++ "Sensor" class. I would like the state of the class to be persistent across power cycles but initialized on program load. I'm aware that in C this can be done with the PERSISTENT pragma if the class was replaced with a struct and I initialize it manually in the declaration and omit a sensor_init() function call in the program. With C++ however I am concerned that the constructor for the class will run and reinitialize the class every time the MCU resets. In C I can manually omit the call to the init function, in C++ I am not sure how replicate this. Is there a way I can get my desired behavior using a C++ class or is the only option to do it the C way?