Mercurial > public > hwos_code
diff src/tft.inc @ 634:4050675965ea
3.10 stable release
author | heinrichsweikamp |
---|---|
date | Tue, 28 Apr 2020 17:34:31 +0200 |
parents | cd58f7fc86db |
children | 75e90cd0c2c3 |
line wrap: on
line diff
--- a/src/tft.inc Thu Mar 05 15:06:14 2020 +0100 +++ b/src/tft.inc Tue Apr 28 17:34:31 2020 +0200 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File tft.inc combined next generation V3.03.7 +; File tft.inc * combined next generation V3.09.4m ; ; Declaring interfaces to the TFT screen and its Oxxx controler ; @@ -9,165 +9,118 @@ ; HISTORY ; 2011-05-24 : [jDG] Cleanups from initial Matthias code. -;============================================================================= -; TFT public subroutines -;============================================================================= - -;----------------------------------------------------------------------------- -; Write two half-pixels at position (win_top,win_leftx2) -; -; Inputs : win_leftx2, win_top, win_color:2 -; Outputs: (none) -; Trashed: WREG, PROD - - extern pixel_write - - -;----------------------------------------------------------------------------- -; Write one half-pixel at position (win_top,win_leftx2) -; -; Inputs : win_leftx2, win_top, win_color:2 -; Outputs: (none) -; Trashed: WREG, PROD - - extern half_pixel_write - ;----------------------------------------------------------------------------- -; Draw a frame around current box with current color -; Inputs : win_top, win_leftx2, win_height, win_width, win_color1, win_color2 -; Outputs: (none) -; Trashed: WREG, PROD, aa_start:2, aa_end:2, win_leftx2, win_width:1 - - extern TFT_frame - +; public Functions -;----------------------------------------------------------------------------- - extern TFT_DisplayOff ; power-off everything (needs a boot thereafter) - extern TFT_boot ; initialize screen hardware - extern TFT_Display_FadeIn ; smooth lighting up - extern TFT_Display_FadeOut ; smooth darkening down - extern TFT_ClearScreen - extern TFT_box_write - extern TFT_box_write_16bit_win_left ; with column in PRODL:PRODH - extern TFT_box - extern TFT_DataWrite_PROD - extern TFT_set_color -; extern init_pixel_write - extern pixel_write - extern pixel_write_col320 - extern half_vertical_line - extern half_horizontal_line + extern TFT_DisplayOff ; power-off everything (needs a boot thereafter) + extern TFT_boot ; initialize screen hardware + extern TFT_Display_FadeIn ; smooth lighting up + extern TFT_Display_FadeOut ; smooth darkening down + extern TFT_ClearScreen ; clear screen + + extern TFT_box_write ; send TFT window address + extern TFT_set_color ; set output color +; extern pixel_write ; draw two half-pixels at position (win_top,win_leftx2 ) + extern pixel_write_col320 ; draw two half-pixels at position (win_top,PRODH:PRODL) + extern half_vertical_line ; draw a vertical line of half-pixels at (win_top,win_leftx2,win_height) + extern half_horizontal_line ; draw a horizontal line of half-pixels at (win_top,win_leftx2,win_width) IFDEF _screendump - extern TFT_dump_screen - extern TFT_dump_screen_check + extern TFT_dump_screen ; send a screenshot via the serial interface immediately + extern TFT_dump_screen_check ; send a screenshot via the serial interface on command ENDIF -;============================================================================= -; Low level macros (for aa_wordprocessor and color_processor) +;----------------------------------------------------------------------------- +; low Level Macros (for aa_wordprocessor and color_processor) ; + +Index_out macro low_b + movlw low_b extern TFT_CmdWrite -Index_out macro low_b - movlw low_b - call TFT_CmdWrite - endm + call TFT_CmdWrite + endm -;============================================================================= -; shortcuts for TFT_box and TFT_frame call sequences -; - extern box_frame_std, box_frame_common, box_frame_color, box_frame_color16 - extern box_std_block, box_black_block, box_color_block +;----------------------------------------------------------------------------- +; colored Boxes -; Erase a given screen area -; -WIN_BOX_BLACK macro top, bottom, left, right - call box_black_block - db top, (bottom)-(top)+1, left, (right)-(left)+1 - endm +WIN_BOX_BLACK macro top, bottom, left, right ; black box (erase scree area) + extern box_black_block + call box_black_block + db top, (bottom)-(top)+1, left, (right)-(left)+1 + endm +WIN_BOX_STD macro top, bottom, left, right ; white box + extern box_std_block + call box_std_block + db top, (bottom)-(top)+1, left, (right)-(left)+1 + endm -; Fill a given screen area with standard color (white) -; -WIN_BOX_STD macro top, bottom, left, right - call box_std_block - db top, (bottom)-(top)+1, left, (right)-(left)+1 - endm - +WIN_BOX_COLOR macro top, bottom, left, right ; box with color from WREG + extern box_color_block + call box_color_block + db top, (bottom)-(top)+1, left, (right)-(left)+1 + endm -; Fill a given screen area with color from WREG (8 bits rrrgggbb) -; -WIN_BOX_COLOR macro top, bottom, left, right - call box_color_block - db top, (bottom)-(top)+1, left, (right)-(left)+1 - endm +BOX_COLOR macro ; box with color from WREG and pre-set coordinates + extern box_color + call box_color + endm -; Draw a frame in standard color (white) -; -WIN_FRAME_STD macro top, bottom, left, right - call box_frame_std - db top, (bottom)-(top)+1, left, (right)-(left)+1 - endm +BOX macro ; box with pre-set color and coordinates + extern TFT_box + call TFT_box + endm -; Draw a frame with color from WREG (8 bits rrrgggbb) -; -WIN_FRAME_COLOR macro top, bottom, left, right - call box_frame_color - db top, (bottom)-(top)+1, left, (right)-(left)+1 - endm - +;----------------------------------------------------------------------------- +; colored Frames -; Draw a frame with color from win_color (16 bits in TFT format) -; -WIN_FRAME_COLOR16 macro top, bottom, left, right - call box_frame_color16 - db top, (bottom)-(top)+1, left, (right)-(left)+1 - endm - +WIN_FRAME_STD macro top, bottom, left, right ; white frame + extern box_frame_std + call box_frame_std + db top, (bottom)-(top)+1, left, (right)-(left)+1 + endm -WIN_FONT macro win_font_input - movlw win_font_input - movff WREG,win_font - endm - - -WIN_TOP macro win_top_input - movlw win_top_input - movff WREG,win_top - endm +WIN_FRAME_COLOR macro top, bottom, left, right ; frame with color from WREG + extern box_frame_color + call box_frame_color + db top, (bottom)-(top)+1, left, (right)-(left)+1 + endm -WIN_HEIGHT macro win_hight_input - movlw win_hight_input - movff WREG,win_height - endm +;----------------------------------------------------------------------------- +; set individual Coordinates + +WIN_TOP macro win_top_input + movlw win_top_input + movwf win_top + endm -WIN_LEFT macro win_left_input - movlw win_left_input - movff WREG,win_leftx2 - endm +WIN_HEIGHT macro win_hight_input + movlw win_hight_input + movwf win_height + endm -WIN_WIDTH macro win_width_input - movlw win_width_input - movff WREG,win_width - endm +WIN_LEFT macro win_leftx2_input + movlw win_leftx2_input + movwf win_leftx2 + endm -WIN_COLOR macro win_color_input - movlw win_color_input - call TFT_set_color - endm +WIN_WIDTH macro win_width_input + movlw win_width_input + movwf win_width + endm -;============================================================================= -; TFT_write_prom_image + +;----------------------------------------------------------------------------- +; Paint an Image stored in Program Memory, Image referenced by a Label ; - -; image referenced by a label TFT_WRITE_PROM_IMAGE_BY_LABEL macro image_label extern image_label movlw LOW (image_label) @@ -180,7 +133,10 @@ call color_image endm -; image referenced by an address + +;----------------------------------------------------------------------------- +; Paint an Image stored in Program Memory, image referenced by an address +; TFT_WRITE_PROM_IMAGE_BY_ADDR macro image_address movlw LOW (image_address) movwf TBLPTRL @@ -192,7 +148,10 @@ call color_image endm -; custom colors referenced by label + +;----------------------------------------------------------------------------- +; Load a Custom Color Palette (to be call before TFT_WRITE_PROM_IMAGE*) +; TFT_WRITE_PROM_IMAGE_CUST_COLOR macro colors_label movlw LOW (colors_label) movwf TBLPTRL @@ -202,28 +161,34 @@ movwf TBLPTRU extern get_colors call get_colors - bsf use_custom_colors ; will suppress reading the colors that come with the image + bsf use_custom_colors ; suppress the colors that come with the image endm -;============================================================================= -; Macros to provide our own interface code + +;----------------------------------------------------------------------------- +; Pixel Writing Macros ; -PIXEL_WRITE macro colRegister, rowRegister - movff colRegister,win_leftx2 - movff rowRegister,win_top - call pixel_write - endm +PIXEL_WRITE macro colRegister, rowRegister + movff colRegister,win_leftx2 + movff rowRegister,win_top + extern pixel_write + call pixel_write + endm ;INIT_PIXEL_WRITE macro colRegister -; movff colRegister,win_leftx2 -; call init_pixel_write -; endm +; movff colRegister,win_leftx2 +; extern init_pixel_write +; call init_pixel_write +; endm HALF_PIXEL_WRITE macro rowRegister - movff rowRegister,win_top - call half_pixel_write - endm + movff rowRegister,win_top + extern half_pixel_write + call half_pixel_write + endm + +;-----------------------------------------------------------------------------