0
|
1 ;=============================================================================
|
|
2 ;
|
623
|
3 ; File tft.inc combined next generation V3.03.2
|
0
|
4 ;
|
|
5 ; Declaring interfaces to the TFT screen and its Oxxx controler
|
|
6 ;
|
|
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
|
|
8 ;=============================================================================
|
|
9 ; HISTORY
|
|
10 ; 2011-05-24 : [jDG] Cleanups from initial Matthias code.
|
|
11
|
|
12 ;=============================================================================
|
|
13 ; TFT public subroutines
|
|
14 ;=============================================================================
|
|
15
|
623
|
16 ;-----------------------------------------------------------------------------
|
|
17 ; Write two half-pixels at position (win_top,win_leftx2)
|
|
18 ;
|
604
|
19 ; Inputs : win_leftx2, win_top, win_color:2
|
|
20 ; Outputs: (none)
|
0
|
21 ; Trashed: WREG, PROD
|
623
|
22
|
604
|
23 extern pixel_write
|
0
|
24
|
623
|
25
|
0
|
26 ;-----------------------------------------------------------------------------
|
623
|
27 ; Write one half-pixel at position (win_top,win_leftx2)
|
|
28 ;
|
604
|
29 ; Inputs : win_leftx2, win_top, win_color:2
|
|
30 ; Outputs: (none)
|
0
|
31 ; Trashed: WREG, PROD
|
623
|
32
|
604
|
33 extern half_pixel_write
|
0
|
34
|
623
|
35
|
0
|
36 ;-----------------------------------------------------------------------------
|
623
|
37 ; Draw a frame around current box with current color
|
604
|
38 ; Inputs : win_top, win_leftx2, win_height, win_width, win_color1, win_color2
|
0
|
39 ; Outputs: (none)
|
|
40 ; Trashed: WREG, PROD, aa_start:2, aa_end:2, win_leftx2, win_width:1
|
623
|
41
|
604
|
42 extern TFT_frame
|
0
|
43
|
623
|
44
|
0
|
45 ;-----------------------------------------------------------------------------
|
623
|
46 extern TFT_DisplayOff ; power-off everything (needs a boot thereafter)
|
|
47 extern TFT_boot ; initialize screen hardware
|
|
48 extern TFT_Display_FadeIn ; smooth lighting up
|
|
49 extern TFT_Display_FadeOut ; smooth darkening down
|
604
|
50 extern TFT_ClearScreen
|
|
51 extern TFT_box_write
|
623
|
52 extern TFT_box_write_16bit_win_left ; with column in PRODL:PRODH
|
604
|
53 extern TFT_box
|
623
|
54 extern TFT_box_16bit_win_left ; with column in PRODL:PRODH
|
604
|
55 extern TFT_DataWrite_PROD
|
|
56 extern TFT_set_color
|
434
|
57 ; extern init_pixel_write
|
0
|
58 extern pixel_write
|
|
59 extern pixel_write_col320
|
|
60 extern half_vertical_line
|
604
|
61 extern half_horizontal_line
|
|
62
|
|
63 IFDEF _screendump
|
|
64 extern TFT_dump_screen
|
|
65 extern TFT_dump_screen_check
|
|
66 ENDIF
|
0
|
67
|
623
|
68
|
0
|
69 ;=============================================================================
|
604
|
70 ; Low level macros (for aa_wordprocessor and color_processor)
|
0
|
71 ;
|
604
|
72 extern TFT_CmdWrite
|
|
73 Index_out macro low_b
|
|
74 movlw low_b
|
|
75 call TFT_CmdWrite
|
|
76 endm
|
0
|
77
|
623
|
78
|
0
|
79 ;=============================================================================
|
623
|
80 ; shortcuts for TFT_box and TFT_frame call sequences
|
0
|
81 ;
|
604
|
82 extern box_frame_std, box_frame_common, box_frame_color, box_frame_color16
|
623
|
83 extern box_std_block, box_black_block, box_color_block
|
0
|
84
|
604
|
85 ; Erase a given screen area
|
623
|
86 ;
|
604
|
87 WIN_BOX_BLACK macro top, bottom, left, right
|
|
88 call box_black_block
|
|
89 db top, (bottom)-(top)+1, left, (right)-(left)+1
|
|
90 endm
|
0
|
91
|
623
|
92
|
604
|
93 ; Fill a given screen area with standard color (white)
|
623
|
94 ;
|
604
|
95 WIN_BOX_STD macro top, bottom, left, right
|
|
96 call box_std_block
|
|
97 db top, (bottom)-(top)+1, left, (right)-(left)+1
|
|
98 endm
|
0
|
99
|
623
|
100
|
604
|
101 ; Fill a given screen area with color from WREG (8 bits rrrgggbb)
|
623
|
102 ;
|
604
|
103 WIN_BOX_COLOR macro top, bottom, left, right
|
|
104 call box_color_block
|
|
105 db top, (bottom)-(top)+1, left, (right)-(left)+1
|
|
106 endm
|
0
|
107
|
604
|
108 ; Draw a frame in standard color (white)
|
623
|
109 ;
|
604
|
110 WIN_FRAME_STD macro top, bottom, left, right
|
|
111 call box_frame_std
|
|
112 db top, (bottom)-(top)+1, left, (right)-(left)+1
|
|
113 endm
|
0
|
114
|
623
|
115
|
604
|
116 ; Draw a frame with color from WREG (8 bits rrrgggbb)
|
623
|
117 ;
|
604
|
118 WIN_FRAME_COLOR macro top, bottom, left, right
|
|
119 call box_frame_color
|
|
120 db top, (bottom)-(top)+1, left, (right)-(left)+1
|
|
121 endm
|
0
|
122
|
623
|
123
|
604
|
124 ; Draw a frame with color from win_color (16 bits in TFT format)
|
623
|
125 ;
|
604
|
126 WIN_FRAME_COLOR16 macro top, bottom, left, right
|
|
127 call box_frame_color16
|
|
128 db top, (bottom)-(top)+1, left, (right)-(left)+1
|
|
129 endm
|
0
|
130
|
623
|
131
|
604
|
132 WIN_FONT macro win_font_input
|
|
133 movlw win_font_input
|
|
134 movff WREG,win_font
|
|
135 endm
|
|
136
|
623
|
137
|
604
|
138 WIN_TOP macro win_top_input
|
|
139 movlw win_top_input
|
|
140 movff WREG,win_top
|
|
141 endm
|
0
|
142
|
623
|
143
|
|
144 WIN_HEIGHT macro win_hight_input
|
|
145 movlw win_hight_input
|
604
|
146 movff WREG,win_height
|
|
147 endm
|
|
148
|
623
|
149
|
604
|
150 WIN_LEFT macro win_left_input
|
|
151 movlw win_left_input
|
|
152 movff WREG,win_leftx2
|
|
153 endm
|
0
|
154
|
623
|
155
|
|
156 WIN_WIDTH macro win_width_input
|
|
157 movlw win_width_input
|
604
|
158 movff WREG,win_width
|
|
159 endm
|
|
160
|
623
|
161
|
604
|
162 WIN_COLOR macro win_color_input
|
|
163 movlw win_color_input
|
|
164 call TFT_set_color
|
|
165 endm
|
0
|
166
|
|
167 ;=============================================================================
|
|
168 ; TFT_write_prom_image
|
623
|
169 ;
|
604
|
170
|
|
171 ; image referenced by a label
|
|
172 TFT_WRITE_PROM_IMAGE_BY_LABEL macro image_label
|
|
173 extern image_label
|
|
174 movlw LOW (image_label)
|
|
175 movwf TBLPTRL
|
|
176 movlw HIGH (image_label)
|
|
177 movwf TBLPTRH
|
|
178 movlw UPPER (image_label)
|
|
179 movwf TBLPTRU
|
|
180 extern color_image
|
|
181 call color_image
|
|
182 endm
|
|
183
|
|
184 ; image referenced by an address
|
|
185 TFT_WRITE_PROM_IMAGE_BY_ADDR macro image_address
|
|
186 movlw LOW (image_address)
|
|
187 movwf TBLPTRL
|
|
188 movlw HIGH (image_address & 0xFFFF)
|
|
189 movwf TBLPTRH
|
|
190 movlw UPPER (image_address)
|
|
191 movwf TBLPTRU
|
|
192 extern color_image
|
|
193 call color_image
|
|
194 endm
|
|
195
|
|
196 ; custom colors referenced by label
|
|
197 TFT_WRITE_PROM_IMAGE_CUST_COLOR macro colors_label
|
|
198 movlw LOW (colors_label)
|
|
199 movwf TBLPTRL
|
|
200 movlw HIGH (colors_label)
|
|
201 movwf TBLPTRH
|
|
202 movlw UPPER (colors_label)
|
|
203 movwf TBLPTRU
|
|
204 extern get_colors
|
|
205 call get_colors
|
623
|
206 bsf use_custom_colors ; will suppress reading the colors that come with the image
|
604
|
207 endm
|
0
|
208
|
623
|
209
|
0
|
210 ;=============================================================================
|
623
|
211 ; Macros to provide our own interface code
|
0
|
212 ;
|
623
|
213
|
604
|
214 PIXEL_WRITE macro colRegister, rowRegister
|
|
215 movff colRegister,win_leftx2
|
|
216 movff rowRegister,win_top
|
|
217 call pixel_write
|
|
218 endm
|
0
|
219
|
623
|
220
|
604
|
221 ;INIT_PIXEL_WRITE macro colRegister
|
|
222 ; movff colRegister,win_leftx2
|
|
223 ; call init_pixel_write
|
|
224 ; endm
|
0
|
225
|
623
|
226
|
604
|
227 HALF_PIXEL_WRITE macro rowRegister
|
|
228 movff rowRegister,win_top
|
|
229 call half_pixel_write
|
|
230 endm
|