Skip to content

Commit

Permalink
Adding C equivalent of millis ISR as a comment as requested
Browse files Browse the repository at this point in the history
  • Loading branch information
MX682X committed Sep 17, 2022
1 parent 583ccba commit 468aac4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions megaavr/cores/megatinycore/wiring.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,16 @@ inline unsigned long microsecondsToClockCycles(unsigned long microseconds) {
:: "x" (&timer_millis), // we are changing the value of this, so to be strictly correct, this must be declared input output - though in this case it doesn't matter
[PTCLR] "m" (_timer->INTFLAGS)
); // grrr, sublime highlights this as invalid syntax because it gets confused by the ifdef's and odd syntax on inline asm
/* ISR in C:
ISR (TCBx_INT_vect) { // x depends on user configuration
#if (F_CPU > 2000000)
timer_millis += 1;
#else
timer_millis += 2;
#endif
_timer->INTFLAGS = TCB_CAPT_bm; // reset Interrupt flag of TCBx
}
*/
#else
#if defined(MILLIS_USE_TIMERRTC)
// if RTC is used as timer, we only increment the overflow count
Expand Down

0 comments on commit 468aac4

Please sign in to comment.