I tried to compile the following code (using Arduino 1.8.16 with an esp8266-12)
extern volatile unsigned long timer0_millis;
unsigned long new_value = 0;
void setup(){
//Setup stuff
}
void loop(){
//Do stuff
//--------
//Change Millis
setMillis(new_value);
}
void setMillis(unsigned long new_millis){
uint8_t oldSREG = SREG;
cli();
timer0_millis = new_millis;
SREG = oldSREG;
}
from an answer to this question, but I get the following error
error: 'SREG' was not declared in this scope
uint8_t oldSREG = SREG;
^
exit status 1
'SREG' was not declared in this scope
I wouldn't necessarily want to use this code for any real purpose, other than as an exercise in learning. What am I missing? What is SREG ?