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