Skip to content

Commit d3b4d2a

Browse files
committed
micros checkpoint
1 parent 73a64cb commit d3b4d2a

File tree

1 file changed

+3
-28
lines changed

1 file changed

+3
-28
lines changed

src/millis.S

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
; (c) Ralph Doncaster 2020
22
; ArduinoShrink
33

4-
; all used io registers are < 0x3F
5-
;#define __SFR_OFFSET 0
6-
#include <avr/io.h>
4+
; #include <avr/io.h>
75

86
;struct {
97
; uint32_t t0_ovfl;
108
; uint8_t ovfl_pad;
119
;} t0_millis;
1210

13-
; micros not supported
14-
.global micros
15-
micros:
11+
; ensure timer ISR is brought in by linker
12+
.global t0_ovfl_inc
1613

1714
.global millis
1815
millis:
@@ -26,25 +23,3 @@ millis:
2623
cp r0, r22 ; has millis changed?
2724
brne millis
2825
ret
29-
30-
.global TIMER0_OVF_vect
31-
TIMER0_OVF_vect:
32-
push r16
33-
in r16, SREG-0x20
34-
push r16
35-
push ZL
36-
ldi ZL, lo8(t0_millis)
37-
push ZH
38-
ldi ZH, hi8(t0_millis)
39-
millis_inc:
40-
ld r16, Z
41-
subi r16, -1
42-
st Z+, r16
43-
brcc millis_inc
44-
pop ZH
45-
pop ZL
46-
pop r16
47-
out SREG-0x20, r16
48-
pop r16
49-
reti
50-

0 commit comments

Comments
 (0)