12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- #include "SysCall.h"
- #if 0
- #include <avr/interrupt.h>
- volatile uint16_t timer2 = 0;
- ISR(TIMER2_COMPA_vect) {
- timer2++;
- }
- SdMillis_t SysCall::curTimeMS() {
- if (TIMSK2 != (1 << OCIE2A)) {
-
- ASSR &= ~(1 << AS2);
-
- TCCR2A = (1 << WGM21);
-
- TCCR2B = (1 << CS22);
-
- #if F_CPU/64000 > 250
- #error F_CPU too large.
- #endif
- OCR2A = F_CPU/64000UL - 1;
-
- TIMSK2 = (1 << OCIE2A);
- }
- cli();
- uint16_t rtn = timer2;
- sei();
- return rtn;
- }
- #endif
|