author | Tero Marttila <terom@fixme.fi> |
Mon, 23 Aug 2010 01:07:45 +0300 | |
changeset 37 | df0bdaf0eb08 |
parent 36 | 06e1e554acbb |
child 38 | f430b507a885 |
permissions | -rw-r--r-- |
31 | 1 |
.nolist |
2 |
.include "m168def.inc" ; Same family as 328P |
|
3 |
.list |
|
4 |
||
5 |
||
6 |
;; Interrupt Vector |
|
7 |
.org 0x00 |
|
8 |
rjmp init |
|
9 |
||
33 | 10 |
.org OC1Aaddr |
11 |
; Timer/Counter1 Compare Output A |
|
12 |
rjmp Timer_OC1A |
|
13 |
||
14 |
.org OC0Aaddr |
|
15 |
; Timer/Counter0 Compare Output A |
|
16 |
rjmp Timer_OC0A |
|
17 |
||
18 |
.org SPIaddr |
|
19 |
rjmp SPI_Interrupt |
|
20 |
||
34
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
21 |
|
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
22 |
cseg0: .org 0x40 |
33 | 23 |
|
31 | 24 |
;; Syntax |
25 |
.include "macros.inc" |
|
26 |
||
27 |
;; SPI |
|
28 |
.include "spi.inc" |
|
29 |
||
33 | 30 |
;; Matrix |
31 |
.include "matrix.inc" |
|
32 |
||
33 |
;; Timer |
|
34 |
.set TIMER0_CB_A = Matrix_ScanCol |
|
35 |
||
36 |
.include "timer.inc" |
|
37 |
||
31 | 38 |
;; Utils |
39 |
.include "delay.inc" |
|
40 |
||
41 |
;; Scan through each pixel |
|
33 | 42 |
Main_ScanRaw: |
31 | 43 |
; init |
44 |
ldi r18, 1 |
|
45 |
ldi r19, 1 |
|
46 |
||
47 |
scan_loop: |
|
48 |
; write out to SPI |
|
49 |
sts spi_outbuf + 0, r18 ; rows |
|
50 |
sts spi_outbuf + 1, r19 ; columns |
|
51 |
||
52 |
rcall SPI_SendRecv |
|
53 |
||
54 |
; delay |
|
55 |
ldi r20, 5 ; ~4M cycles |
|
56 |
rcall VarDelay |
|
57 |
||
33 | 58 |
; cols |
59 |
lsl r19 ; next col |
|
60 |
brcc scan_loop ; refresh if we didn't overflow |
|
61 |
||
62 |
rol r19 ; shift back from C into r21.0 |
|
63 |
||
31 | 64 |
; rows |
33 | 65 |
lsl r18 ; next row |
31 | 66 |
brcc scan_loop ; refresh if we didn't overflow |
67 |
||
68 |
rol r18 ; shift back from C into r20.0 |
|
69 |
||
70 |
; one scan completed |
|
71 |
ret |
|
72 |
||
33 | 73 |
;; Scan with test pattern |
74 |
Main_ScanTest: |
|
75 |
; Generate pattern |
|
76 |
; end of buffer |
|
34
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
77 |
ldi r17, MATRIX_BUF_COLS |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
78 |
ldi XL, low(matrix_colbuf + MATRIX_BUF_COLS) |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
79 |
ldi XH, high(matrix_colbuf + MATRIX_BUF_COLS) |
33 | 80 |
|
81 |
; bit pattern |
|
82 |
ldi r16, 0b11 |
|
83 |
||
84 |
st_loop: |
|
34
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
85 |
; put, pre-decrement |
33 | 86 |
st -X, r16 |
87 |
||
88 |
; flip |
|
89 |
rol r16 |
|
90 |
||
91 |
; loop until zero |
|
92 |
dec r17 |
|
93 |
brne st_loop |
|
94 |
||
34
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
95 |
st_animate: |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
96 |
; Animate |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
97 |
; shift right |
36
06e1e554acbb
Rename Matrix_ShiftRight to ShiftLeft, improve matrix.inc documentation
Tero Marttila <terom@fixme.fi>
parents:
35
diff
changeset
|
98 |
rcall Matrix_ShiftLeft |
34
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
99 |
|
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
100 |
; wait for X/16th of a second |
35
f1ac13235304
Pause refresh during load cycles
Tero Marttila <terom@fixme.fi>
parents:
34
diff
changeset
|
101 |
ldi XH, high(8 * 1024) |
f1ac13235304
Pause refresh during load cycles
Tero Marttila <terom@fixme.fi>
parents:
34
diff
changeset
|
102 |
ldi XL, low(8 * 1024) |
34
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
103 |
|
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
104 |
rcall Timer_Sleep |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
105 |
|
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
106 |
; loop |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
107 |
rjmp st_animate |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
108 |
|
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
109 |
|
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
110 |
;; Display device code memory |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
111 |
Main_ScanCode: |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
112 |
; Code start |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
113 |
ldi ZL, low(cseg0 * 2) ; word addr |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
114 |
ldi ZH, high(cseg0 * 2) ; word addr |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
115 |
|
35
f1ac13235304
Pause refresh during load cycles
Tero Marttila <terom@fixme.fi>
parents:
34
diff
changeset
|
116 |
; Pause refresh |
f1ac13235304
Pause refresh during load cycles
Tero Marttila <terom@fixme.fi>
parents:
34
diff
changeset
|
117 |
cli |
f1ac13235304
Pause refresh during load cycles
Tero Marttila <terom@fixme.fi>
parents:
34
diff
changeset
|
118 |
|
34
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
119 |
; Load initial frame |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
120 |
; to first frame, starting from right edge |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
121 |
ldi r17, 8 |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
122 |
ldi XL, low(matrix_colbuf + 16) |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
123 |
ldi XH, high(matrix_colbuf + 16) |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
124 |
|
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
125 |
sc_load_initial: |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
126 |
; one byte |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
127 |
lpm r16, Z+ |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
128 |
st -X, r16 |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
129 |
|
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
130 |
; loop until zero |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
131 |
dec r17 |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
132 |
brne sc_load_initial |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
133 |
|
36
06e1e554acbb
Rename Matrix_ShiftRight to ShiftLeft, improve matrix.inc documentation
Tero Marttila <terom@fixme.fi>
parents:
35
diff
changeset
|
134 |
; the first ShiftLeft below will jump to the end of the framebuffer |
06e1e554acbb
Rename Matrix_ShiftRight to ShiftLeft, improve matrix.inc documentation
Tero Marttila <terom@fixme.fi>
parents:
35
diff
changeset
|
135 |
|
34
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
136 |
sc_next: |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
137 |
; Show this frame |
36
06e1e554acbb
Rename Matrix_ShiftRight to ShiftLeft, improve matrix.inc documentation
Tero Marttila <terom@fixme.fi>
parents:
35
diff
changeset
|
138 |
rcall Matrix_ShiftLeft |
34
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
139 |
|
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
140 |
; Load next frame |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
141 |
ldi r17, 8 |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
142 |
ldi XL, low(matrix_colbuf + 8) |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
143 |
ldi XH, high(matrix_colbuf + 8) |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
144 |
|
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
145 |
sc_load_next: |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
146 |
; one byte |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
147 |
lpm r16, Z+ |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
148 |
st -X, r16 |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
149 |
|
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
150 |
; loop until zero |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
151 |
dec r17 |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
152 |
brne sc_load_next |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
153 |
|
35
f1ac13235304
Pause refresh during load cycles
Tero Marttila <terom@fixme.fi>
parents:
34
diff
changeset
|
154 |
; Enable refresh |
f1ac13235304
Pause refresh during load cycles
Tero Marttila <terom@fixme.fi>
parents:
34
diff
changeset
|
155 |
sei |
f1ac13235304
Pause refresh during load cycles
Tero Marttila <terom@fixme.fi>
parents:
34
diff
changeset
|
156 |
|
34
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
157 |
; Animate from this -> next frame |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
158 |
ldi r17, 8 ; 8 columns |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
159 |
|
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
160 |
sc_anim: |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
161 |
; wait for X/16th of a second |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
162 |
ldi XH, high(2 * 1024) |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
163 |
ldi XL, low(2 * 1024) |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
164 |
|
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
165 |
rcall Timer_Sleep |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
166 |
|
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
167 |
; shift |
36
06e1e554acbb
Rename Matrix_ShiftRight to ShiftLeft, improve matrix.inc documentation
Tero Marttila <terom@fixme.fi>
parents:
35
diff
changeset
|
168 |
rcall Matrix_ShiftLeft |
34
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
169 |
|
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
170 |
; loop until zero |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
171 |
dec r17 |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
172 |
brne sc_anim |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
173 |
|
35
f1ac13235304
Pause refresh during load cycles
Tero Marttila <terom@fixme.fi>
parents:
34
diff
changeset
|
174 |
; Pause refresh |
f1ac13235304
Pause refresh during load cycles
Tero Marttila <terom@fixme.fi>
parents:
34
diff
changeset
|
175 |
cli |
f1ac13235304
Pause refresh during load cycles
Tero Marttila <terom@fixme.fi>
parents:
34
diff
changeset
|
176 |
|
34
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
177 |
; Move next -> this |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
178 |
ldi r17, 8 |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
179 |
ldi XL, low(matrix_colbuf + 16) |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
180 |
ldi XH, high(matrix_colbuf + 16) |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
181 |
ldi YL, low(matrix_colbuf + 8) |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
182 |
ldi YH, high(matrix_colbuf + 8) |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
183 |
|
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
184 |
sc_move_this: |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
185 |
; one byte |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
186 |
ld r16, -Y |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
187 |
st -X, r16 |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
188 |
|
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
189 |
; loop until zero |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
190 |
dec r17 |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
191 |
brne sc_move_this |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
192 |
|
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
193 |
sbi PIND, PIND7 |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
194 |
|
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
195 |
; Load next frame, and animate |
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
196 |
rjmp sc_next |
33 | 197 |
|
31 | 198 |
Main: |
199 |
init: |
|
200 |
; Stack |
|
201 |
ldi r16, high(RAMEND) |
|
202 |
ldi r17, low(RAMEND) |
|
203 |
out SPH, r16 |
|
204 |
out SPL, r17 |
|
205 |
||
206 |
; Enable interrupts |
|
207 |
sei |
|
208 |
||
33 | 209 |
; DEBUG |
210 |
sbi DDRD, PORTD7 |
|
211 |
cbi PORTD, PORTD7 |
|
212 |
||
213 |
; Timer |
|
214 |
rcall Timer_Init |
|
215 |
||
31 | 216 |
; SPI |
217 |
rcall SPI_Init |
|
33 | 218 |
|
219 |
; Matrix |
|
220 |
rcall Matrix_Init |
|
31 | 221 |
|
222 |
; Run |
|
33 | 223 |
; rcall Main_ScanRaw |
34
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
224 |
; rcall Main_ScanTest |
31 | 225 |
|
34
4646abd073fb
Matrix_Shift, Main_ScanText animation and Main_ScanCode
Tero Marttila <terom@fixme.fi>
parents:
33
diff
changeset
|
226 |
rcall Main_ScanCode |
31 | 227 |
|
228 |
end: |
|
229 |
rjmp end |
|
230 |