How to RTC_PIT #322
-
I've found this example code from Microchip and am in the process of "porting" it. As a relevant newcomer I have a couple of dumbo questions. If we look at: /* Disable oscillator: */
temp = CLKCTRL.XOSC32KCTRLA;
temp &= ~CLKCTRL_ENABLE_bm;
/* Writing to protected register */
ccp_write_io((void*)&CLKCTRL.XOSC32KCTRLA, temp); would this be: /* Disable oscillator: */
temp = CLKCTRL.XOSC32KCTRLA;
temp &= ~CLKCTRL_ENABLE_bm;
/* Writing to protected register */
_PROTECTED_WRITE(CLKCTRL.XOSC32KCTRLA, temp); and could it be refactored to _PROTECTED_WRITE(CLKCTRL.XOSC32KCTRLA, ~CLKCTRL_ENABLE_bm); ? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
Not exactly sure what the question is, but I'm using this code to set up the PIT to trigger every 1ms:
This is how I'm defining the ISR for the PIT:
The code was mostly generated by START, but works great in my Arduino project for a attiny412. Side note: I was originally using TCA0 for this purpose, but found a need for PWM. The RTC seems a perfect fit for my use case. |
Beta Was this translation helpful? Give feedback.
-
I've put together a small repo for others attempting the same: https://github.com/amadeuspzs/attiny1614-rtc |
Beta Was this translation helpful? Give feedback.
I've put together a small repo for others attempting the same: https://github.com/amadeuspzs/attiny1614-rtc