12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
-
- #include <stdlib.h>
- #include <stdint.h>
- #include <avr/io.h>
- #include <avr/interrupt.h>
- #include "time.h"
-
-
-
-
-
-
-
- volatile uint64_t systemTime = 0;
-
- void initSystemTimer() {
- TCCR0 |= (1 << WGM01) | (1 << CS01) | (1 << CS00);
- OCR0 = 250;
- TIMSK |= (1 << OCIE0);
- }
-
- ISR(TIMER0_COMP_vect) {
- systemTime++;
- }
-
- uint64_t getSystemTime() {
- return systemTime;
- }
|