Proper way to disable the RTC/PIT once enabled? #350
-
I'm sure this is a dumb question, but I'm still in the "smash things together and hope they work" stage of learning to code and github's search function is...yeah. I'm working from the RTC PIT blink sketch example to create a watchdog of sorts, but I can't figure out how to disable the interrupt (or just the entire RTC for that matter, I don't need it otherwise) once I've initiated it. The watchdog will only need to run under certain conditions, and power consumption is a major concern for the project, so I'd like to keep it disabled when not in use. I see in the errata that you can disable it by writing RTC.CTRLA.RTCEN to 0, but then I'm not sure if it can be re-enabled by simply writing it to 1, or if that's even a "proper" way to temporarily disable it. EDIT: A real programmer has set me straight. The following should preserve the other values in RTC.PITCTRLA while clearing the enable bit. I didn't realize this was an AVR/Microchip convention thing, not a C/megaTinyCore thing. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Yeah, that'd be the right approach - note that if you know what you want the value tof the register to be afterwards, you can just straight up set it. And do also note the errata for some of the tinyAVR 0/1-series parts... these have a good deal of errata.
Pretty widespread within the product line it looks like. |
Beta Was this translation helpful? Give feedback.
Yeah, that'd be the right approach - note that if you know what you want the value tof the register to be afterwards, you can just straight up set it. And do also note the errata for some of the tinyAVR 0/1-series parts... these have a good deal of errata.
Pretty widespread within the product line it looks like.