Mercurial > public > hwos_code
diff src/tft.inc @ 623:c40025d8e750
3.03 beta released
author | heinrichsweikamp |
---|---|
date | Mon, 03 Jun 2019 14:01:48 +0200 |
parents | ca4556fb60b9 |
children | cd58f7fc86db |
line wrap: on
line diff
--- a/src/tft.inc Wed Apr 10 10:51:07 2019 +0200 +++ b/src/tft.inc Mon Jun 03 14:01:48 2019 +0200 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File tft.inc V2.99c +; File tft.inc combined next generation V3.03.2 ; ; Declaring interfaces to the TFT screen and its Oxxx controler ; @@ -13,36 +13,45 @@ ; TFT public subroutines ;============================================================================= -; Writes two half-pixels at position (win_top,win_leftx2) +;----------------------------------------------------------------------------- +; 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 + ;----------------------------------------------------------------------------- -; Writes one half-pixel at position (win_top,win_leftx2) +; 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 + ;----------------------------------------------------------------------------- -; Draws a frame around current box with current color +; 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 + ;----------------------------------------------------------------------------- - extern TFT_DisplayOff ; Power-off everything (need a boot next) - extern TFT_boot ; Initialize screen hardware - extern TFT_Display_FadeIn ; Smooth lighting - extern TFT_Display_FadeOut ; Smooth darkening + 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_write_16bit_win_left ; with column in PRODL:PRODH extern TFT_box - extern TFT_box_16bit_win_left ; With column in PRODL:PRODH + extern TFT_box_16bit_win_left ; with column in PRODL:PRODH extern TFT_DataWrite_PROD extern TFT_set_color ; extern init_pixel_write @@ -56,6 +65,7 @@ extern TFT_dump_screen_check ENDIF + ;============================================================================= ; Low level macros (for aa_wordprocessor and color_processor) ; @@ -65,112 +75,98 @@ call TFT_CmdWrite endm + ;============================================================================= -; A shortcut for TFT_box and TFT_frame call sequences +; 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 + extern box_std_block, box_black_block, box_color_block ; 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 + ; 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 + ; 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 ; 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 + ; 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 + ; 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_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_HEIGHT macro h - movlw h + +WIN_HEIGHT macro win_hight_input + movlw win_hight_input movff WREG,win_height endm + WIN_LEFT macro win_left_input movlw win_left_input movff WREG,win_leftx2 endm -WIN_WIDTH macro w - movlw w + +WIN_WIDTH macro win_width_input + movlw win_width_input movff WREG,win_width endm + WIN_COLOR macro win_color_input movlw win_color_input call TFT_set_color endm -;;============================================================================= -;; TFT_write_flash_image -;; -;; Inputs : cx, cy : Image center (in 0..160 x 0..240 range) -;; image : flash image header's address -;; Outputs: win_top, win_left, win_height, win_width -;; image copyed on screen. -;; Trashed: PROD, hi, lo -;; -;; extern TFT_write_flash_image -;; extern TFT_write_flash_image_addr -;TFT_WRITE_FLASH_IMAGE macro cx, cy, image -; If LOW(image) != 0 -; Error "Image "image" mis-aligned" -; Endif -; If (UPPER(image) & 0xF0) != 0x30 -; Error "Image "image" not in image flash memory" -; Endif -; If (cx < 0) || (cx > 160) -; Error "Image center's X "cx" not in 0..160 range". -; Endif -; If (cy < 0) || (cy > 240) -; Error "Image center's Y "cy" not in 0..240 range". -; Endif -; ; Once we know image is aligned, we can use the compact (4 bytes) -; ; 12 bit registers to pass the address: -; lfsr FSR2, ((image)>>8) & 0xFFF -; WIN_LEFT cx -; WIN_TOP cy -; call TFT_write_flash_image -; endm - ;============================================================================= ; TFT_write_prom_image +; ; image referenced by a label TFT_WRITE_PROM_IMAGE_BY_LABEL macro image_label @@ -207,23 +203,27 @@ movwf TBLPTRU extern get_colors call get_colors - bsf use_custom_colors ; will suppress read-in of the colors that come with the image + bsf use_custom_colors ; will suppress reading the colors that come with the image endm + ;============================================================================= -; Macro to provide our own interface code +; Macros to provide our own interface code ; + PIXEL_WRITE macro colRegister, rowRegister movff colRegister,win_leftx2 movff rowRegister,win_top call pixel_write endm + ;INIT_PIXEL_WRITE macro colRegister ; movff colRegister,win_leftx2 ; call init_pixel_write ; endm + HALF_PIXEL_WRITE macro rowRegister movff rowRegister,win_top call half_pixel_write