0
|
1 ;=============================================================================
|
|
2 ;
|
634
|
3 ; File tft.inc * combined next generation V3.09.4m
|
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
|
623
|
12
|
0
|
13 ;-----------------------------------------------------------------------------
|
634
|
14 ; public Functions
|
623
|
15
|
634
|
16 extern TFT_DisplayOff ; power-off everything (needs a boot thereafter)
|
|
17 extern TFT_boot ; initialize screen hardware
|
|
18 extern TFT_Display_FadeIn ; smooth lighting up
|
|
19 extern TFT_Display_FadeOut ; smooth darkening down
|
|
20 extern TFT_ClearScreen ; clear screen
|
|
21
|
|
22 extern TFT_box_write ; send TFT window address
|
|
23 extern TFT_set_color ; set output color
|
|
24 ; extern pixel_write ; draw two half-pixels at position (win_top,win_leftx2 )
|
|
25 extern pixel_write_col320 ; draw two half-pixels at position (win_top,PRODH:PRODL)
|
|
26 extern half_vertical_line ; draw a vertical line of half-pixels at (win_top,win_leftx2,win_height)
|
|
27 extern half_horizontal_line ; draw a horizontal line of half-pixels at (win_top,win_leftx2,win_width)
|
604
|
28
|
|
29 IFDEF _screendump
|
634
|
30 extern TFT_dump_screen ; send a screenshot via the serial interface immediately
|
|
31 extern TFT_dump_screen_check ; send a screenshot via the serial interface on command
|
604
|
32 ENDIF
|
0
|
33
|
623
|
34
|
634
|
35 ;-----------------------------------------------------------------------------
|
|
36 ; low Level Macros (for aa_wordprocessor and color_processor)
|
0
|
37 ;
|
634
|
38
|
|
39 Index_out macro low_b
|
|
40 movlw low_b
|
604
|
41 extern TFT_CmdWrite
|
634
|
42 call TFT_CmdWrite
|
|
43 endm
|
0
|
44
|
623
|
45
|
634
|
46 ;-----------------------------------------------------------------------------
|
|
47 ; colored Boxes
|
0
|
48
|
634
|
49 WIN_BOX_BLACK macro top, bottom, left, right ; black box (erase scree area)
|
|
50 extern box_black_block
|
|
51 call box_black_block
|
|
52 db top, (bottom)-(top)+1, left, (right)-(left)+1
|
|
53 endm
|
0
|
54
|
634
|
55 WIN_BOX_STD macro top, bottom, left, right ; white box
|
|
56 extern box_std_block
|
|
57 call box_std_block
|
|
58 db top, (bottom)-(top)+1, left, (right)-(left)+1
|
|
59 endm
|
623
|
60
|
634
|
61 WIN_BOX_COLOR macro top, bottom, left, right ; box with color from WREG
|
|
62 extern box_color_block
|
|
63 call box_color_block
|
|
64 db top, (bottom)-(top)+1, left, (right)-(left)+1
|
|
65 endm
|
623
|
66
|
634
|
67 BOX_COLOR macro ; box with color from WREG and pre-set coordinates
|
|
68 extern box_color
|
|
69 call box_color
|
|
70 endm
|
0
|
71
|
634
|
72 BOX macro ; box with pre-set color and coordinates
|
|
73 extern TFT_box
|
|
74 call TFT_box
|
|
75 endm
|
0
|
76
|
623
|
77
|
634
|
78 ;-----------------------------------------------------------------------------
|
|
79 ; colored Frames
|
623
|
80
|
634
|
81 WIN_FRAME_STD macro top, bottom, left, right ; white frame
|
|
82 extern box_frame_std
|
|
83 call box_frame_std
|
|
84 db top, (bottom)-(top)+1, left, (right)-(left)+1
|
|
85 endm
|
623
|
86
|
634
|
87 WIN_FRAME_COLOR macro top, bottom, left, right ; frame with color from WREG
|
|
88 extern box_frame_color
|
|
89 call box_frame_color
|
|
90 db top, (bottom)-(top)+1, left, (right)-(left)+1
|
|
91 endm
|
0
|
92
|
623
|
93
|
634
|
94 ;-----------------------------------------------------------------------------
|
|
95 ; set individual Coordinates
|
|
96
|
|
97 WIN_TOP macro win_top_input
|
|
98 movlw win_top_input
|
|
99 movwf win_top
|
|
100 endm
|
604
|
101
|
623
|
102
|
634
|
103 WIN_HEIGHT macro win_hight_input
|
|
104 movlw win_hight_input
|
|
105 movwf win_height
|
|
106 endm
|
0
|
107
|
623
|
108
|
634
|
109 WIN_LEFT macro win_leftx2_input
|
|
110 movlw win_leftx2_input
|
|
111 movwf win_leftx2
|
|
112 endm
|
604
|
113
|
623
|
114
|
634
|
115 WIN_WIDTH macro win_width_input
|
|
116 movlw win_width_input
|
|
117 movwf win_width
|
|
118 endm
|
0
|
119
|
634
|
120
|
|
121 ;-----------------------------------------------------------------------------
|
|
122 ; Paint an Image stored in Program Memory, Image referenced by a Label
|
623
|
123 ;
|
604
|
124 TFT_WRITE_PROM_IMAGE_BY_LABEL macro image_label
|
|
125 extern image_label
|
|
126 movlw LOW (image_label)
|
|
127 movwf TBLPTRL
|
|
128 movlw HIGH (image_label)
|
|
129 movwf TBLPTRH
|
|
130 movlw UPPER (image_label)
|
|
131 movwf TBLPTRU
|
|
132 extern color_image
|
|
133 call color_image
|
|
134 endm
|
|
135
|
634
|
136
|
|
137 ;-----------------------------------------------------------------------------
|
|
138 ; Paint an Image stored in Program Memory, image referenced by an address
|
|
139 ;
|
604
|
140 TFT_WRITE_PROM_IMAGE_BY_ADDR macro image_address
|
|
141 movlw LOW (image_address)
|
|
142 movwf TBLPTRL
|
|
143 movlw HIGH (image_address & 0xFFFF)
|
|
144 movwf TBLPTRH
|
|
145 movlw UPPER (image_address)
|
|
146 movwf TBLPTRU
|
|
147 extern color_image
|
|
148 call color_image
|
|
149 endm
|
|
150
|
634
|
151
|
|
152 ;-----------------------------------------------------------------------------
|
|
153 ; Load a Custom Color Palette (to be call before TFT_WRITE_PROM_IMAGE*)
|
|
154 ;
|
604
|
155 TFT_WRITE_PROM_IMAGE_CUST_COLOR macro colors_label
|
|
156 movlw LOW (colors_label)
|
|
157 movwf TBLPTRL
|
|
158 movlw HIGH (colors_label)
|
|
159 movwf TBLPTRH
|
|
160 movlw UPPER (colors_label)
|
|
161 movwf TBLPTRU
|
|
162 extern get_colors
|
|
163 call get_colors
|
634
|
164 bsf use_custom_colors ; suppress the colors that come with the image
|
604
|
165 endm
|
0
|
166
|
623
|
167
|
634
|
168
|
|
169 ;-----------------------------------------------------------------------------
|
|
170 ; Pixel Writing Macros
|
0
|
171 ;
|
623
|
172
|
634
|
173 PIXEL_WRITE macro colRegister, rowRegister
|
|
174 movff colRegister,win_leftx2
|
|
175 movff rowRegister,win_top
|
|
176 extern pixel_write
|
|
177 call pixel_write
|
|
178 endm
|
0
|
179
|
623
|
180
|
604
|
181 ;INIT_PIXEL_WRITE macro colRegister
|
634
|
182 ; movff colRegister,win_leftx2
|
|
183 ; extern init_pixel_write
|
|
184 ; call init_pixel_write
|
|
185 ; endm
|
0
|
186
|
623
|
187
|
604
|
188 HALF_PIXEL_WRITE macro rowRegister
|
634
|
189 movff rowRegister,win_top
|
|
190 extern half_pixel_write
|
|
191 call half_pixel_write
|
|
192 endm
|
|
193
|
|
194 ;-----------------------------------------------------------------------------
|