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