47 #define TIMER0_PRESCALING 64
48 #define TOLERATED_DEVIATION_PPT 5
50 #define EXPECTED_TIMER0_INCREMENT ((F_CPU / (1000 * TIMER0_PRESCALING)) & 0xff)
51 #define TOLERATED_DEVIATION (TOLERATED_DEVIATION_PPT * F_CPU / (1000000 * TIMER0_PRESCALING))
57 lds YH, lastTimer0Value ;[3]
58 sts lastTimer0Value, YL ;[5]
59 sub YL, YH ;[7] time passed since last frame
64 in YH, OSCCAL ;[6] assembler modle uses __SFR_OFFSET == 0
68 subi YH, 1 ;[12] clock rate was too high
69 ; brcs tuningOverflow ; optionally check
for overflow
70 rjmp osctuneDone ;[13]
73 brpl osctuneDone ;[14]
not too low
74 inc YH ;[15] clock rate was too low
75 ; breq tuningOverflow ; optionally check
for overflow
78 sts OSCCAL, YH ;[12-13] store tuned value
80 out OSCCAL, YH ;[12-13] store tuned value
87 #define USB_SOF_HOOK tuneOsccal
string out
Definition: rf-id-control.py:34
#define macro
Definition: usbportability.h:133
#define max(a, b)
Definition: Arduino.h:83
#define endm
Definition: usbportability.h:134
#define TOLERATED_DEVIATION
Definition: osctune.h:51
#define EXPECTED_TIMER0_INCREMENT
Definition: osctune.h:50
#define not
Definition: iso646.h:35