annotate src/tft.inc @ 637:cdff88f5a4a0

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