Naze32 clone with Frysky receiver
Vous ne pouvez pas sélectionner plus de 25 sujets
Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
1234567891011121314151617181920212223242526 |
- /*
- * Time-Keeping helper
- */
-
- #include <avr/io.h>
- #include <avr/interrupt.h>
-
- #include "timer.h"
-
- volatile time_t systemTime = 0;
-
- void timerInit(void) {
- TCCR1 |= (1 << CTC1); // CTC Mode
- TCCR1 |= (1 << CS12) | (1 << CS11) | (1 << CS10); // Prescaler: 64
- OCR1A = 250; // Count to 250
- TIMSK |= (1 << OCIE1A); // Enable compare match interrupt
- }
-
- ISR(TIMER1_COMPA_vect) {
- systemTime++; // one millisecond has passed
- }
-
- time_t timerGet(void) {
- return systemTime;
- }
|