Mercurial > public > hwos_code
comparison src/tft.asm @ 608:d866684249bd
work on 2.99 stable
author | heinrichsweikamp |
---|---|
date | Mon, 07 Jan 2019 21:13:43 +0100 |
parents | ca4556fb60b9 |
children | c40025d8e750 |
comparison
equal
deleted
inserted
replaced
607:c5151a490d88 | 608:d866684249bd |
---|---|
187 ; rcall TFT_set_color | 187 ; rcall TFT_set_color |
188 ; goto TFT_box | 188 ; goto TFT_box |
189 ; | 189 ; |
190 ;;============================================================================= | 190 ;;============================================================================= |
191 | 191 |
192 global TFT_CmdWrite | |
193 TFT_CmdWrite: | |
194 RS_L ; command | |
195 clrf PORTA ; upper | |
196 bcf INTCON,GIE | |
197 movwf PORTH ; lower | |
198 WR_L | |
199 WR_H ; tick | |
200 bsf INTCON,GIE | |
201 return | |
202 | |
203 global TFT_DataWrite | |
204 TFT_DataWrite: | |
205 RS_H ; data | |
206 bcf INTCON,GIE | |
207 movwf PORTH ; lower | |
208 WR_L | |
209 WR_H ; tick | |
210 bsf INTCON,GIE | |
211 return | |
212 | |
213 ;============================================================================= | |
214 | 192 |
215 global TFT_ClearScreen | 193 global TFT_ClearScreen |
216 TFT_ClearScreen: | 194 TFT_ClearScreen: |
195 btfsc screen_type2 | |
196 bra TFT_ClearScreen_display2 | |
217 Index_out 0x50 ; window horizontal start address | 197 Index_out 0x50 ; window horizontal start address |
218 Parameter_out 0x00, 0x00 ; 0-239 | 198 Parameter_out 0x00, 0x00 ; 0-239 |
219 Index_out 0x51 ; window horizontal end address | 199 Index_out 0x51 ; window horizontal end address |
220 Parameter_out 0x00, 0xEF ; 0-239 | 200 Parameter_out 0x00, 0xEF ; 0-239 |
221 Index_out 0x52 ; window vertical start address | 201 Index_out 0x52 ; window vertical start address |
254 bra TFT_ClearScreen2 | 234 bra TFT_ClearScreen2 |
255 | 235 |
256 movlw 0x00 ; NOP, to stop window mode | 236 movlw 0x00 ; NOP, to stop window mode |
257 bra TFT_CmdWrite ; and return | 237 bra TFT_CmdWrite ; and return |
258 | 238 |
239 TFT_ClearScreen_display2: | |
240 ; Column Address start | |
241 movlw 0x02 | |
242 rcall TFT_CmdWrite | |
243 movlw 0x00 | |
244 rcall TFT_DataWrite | |
245 movlw 0x03 | |
246 rcall TFT_CmdWrite | |
247 movlw 0x00 | |
248 rcall TFT_DataWrite | |
249 | |
250 ; Column Address end | |
251 movlw 0x04 | |
252 rcall TFT_CmdWrite | |
253 movlw 0x00 | |
254 rcall TFT_DataWrite | |
255 movlw 0x05 | |
256 rcall TFT_CmdWrite | |
257 movlw 0xEF | |
258 rcall TFT_DataWrite | |
259 | |
260 ; Row address start | |
261 movlw 0x06 | |
262 rcall TFT_CmdWrite | |
263 movlw 0x00 | |
264 rcall TFT_DataWrite | |
265 movlw 0x07 | |
266 rcall TFT_CmdWrite | |
267 movlw 0x00 | |
268 rcall TFT_DataWrite | |
269 | |
270 ; Row address end | |
271 movlw 0x08 | |
272 rcall TFT_CmdWrite | |
273 movlw 0x01 | |
274 rcall TFT_DataWrite | |
275 movlw 0x09 | |
276 rcall TFT_CmdWrite | |
277 movlw 0x3F | |
278 rcall TFT_DataWrite | |
279 | |
280 movlw 0x22 ; Start Writing Data to GRAM | |
281 rcall TFT_CmdWrite | |
282 | |
283 bsf tft_rs ; Data! | |
284 | |
285 movlw .160 | |
286 movwf PRODH | |
287 clrf PORTH | |
288 TFT_ClearScreen2_display2: | |
289 movlw .240 | |
290 movwf PRODL | |
291 TFT_ClearScreen3_display2: | |
292 bcf tft_nwr | |
293 bsf tft_nwr ; Upper | |
294 bcf tft_nwr | |
295 bsf tft_nwr ; High | |
296 bcf tft_nwr | |
297 bsf tft_nwr ; Lower | |
298 bcf tft_nwr | |
299 bsf tft_nwr ; Upper | |
300 bcf tft_nwr | |
301 bsf tft_nwr ; High | |
302 bcf tft_nwr | |
303 bsf tft_nwr ; Lower | |
304 decfsz PRODL,F | |
305 bra TFT_ClearScreen3_display2 | |
306 decfsz PRODH,F | |
307 bra TFT_ClearScreen2_display2 | |
308 return | |
259 | 309 |
260 ;============================================================================= | 310 ;============================================================================= |
261 | 311 |
262 global TFT_DisplayOff | 312 global TFT_DisplayOff |
263 TFT_DisplayOff: | 313 TFT_DisplayOff: |
264 clrf CCPR1L ; PWM OFF | 314 clrf CCP1CON ; stop PWM |
315 bcf PORTC,2 ; Pull PWM out to GND | |
265 clrf PORTA | 316 clrf PORTA |
266 clrf PORTH | 317 clrf PORTH |
267 RD_L ; LOW | 318 RD_L ; LOW |
268 nop | 319 RS_L ; LOW |
269 RS_L ; LOW | 320 bcf tft_nwr |
270 bcf tft_nwr | 321 bcf tft_cs |
271 nop | 322 bcf tft_nreset |
272 bcf tft_cs | 323 bsf tft_power ; inverted... |
273 nop | 324 bcf lightsen_power ; power-down light sensor |
274 bcf tft_nreset | |
275 WAITMS d'1' | |
276 bsf tft_power ; inverted... | |
277 bcf lightsen_power ; power-down light sensor | |
278 return | 325 return |
279 | 326 |
280 ; ----------------------------- | 327 ; ----------------------------- |
281 ; TFT boot | 328 ; TFT boot |
282 ; ----------------------------- | 329 ; ----------------------------- |
283 | 330 |
284 global TFT_boot | 331 global TFT_boot |
285 TFT_boot: | 332 TFT_boot: |
333 clrf CCP1CON ; stop PWM | |
334 bcf PORTC,2 ; Pull PWM out to GND | |
286 clrf PORTA | 335 clrf PORTA |
287 clrf PORTH | 336 clrf PORTH |
288 RD_L ; LOW | 337 RD_L ; LOW |
289 bcf tft_nwr | 338 bcf tft_nwr |
290 nop | 339 nop |
309 bsf lightsen_power ; supply power to light sensor | 358 bsf lightsen_power ; supply power to light sensor |
310 | 359 |
311 ; Data Transfer Synchronization | 360 ; Data Transfer Synchronization |
312 Parameter_out 0x00, 0x00 | 361 Parameter_out 0x00, 0x00 |
313 Parameter_out 0x00, 0x00 | 362 Parameter_out 0x00, 0x00 |
363 | |
364 btfsc screen_type2 ; Display 2 | |
365 bra TFT_boot_screen2 | |
314 | 366 |
315 ; Get screentype from Bootloader-Info | 367 ; Get screentype from Bootloader-Info |
316 movlw 0x7B | 368 movlw 0x7B |
317 movwf TBLPTRL | 369 movwf TBLPTRL |
318 movlw 0xF7 | 370 movlw 0xF7 |
415 TBLRD*+ ; get config1 | 467 TBLRD*+ ; get config1 |
416 movf TABLAT,W | 468 movf TABLAT,W |
417 rcall TFT_DataWrite ; write config | 469 rcall TFT_DataWrite ; write config |
418 bra display0_init_loop ; loop | 470 bra display0_init_loop ; loop |
419 | 471 |
472 TFT_boot_screen2: | |
473 bsf tft_nwr ; release bus. | |
474 rcall display1_init ; Init sequence | |
475 | |
476 btfss flip_screen ; 180° rotation ? | |
477 bra TFT_ClearScreen ; No, done. Clearscreen and return | |
478 ; flip the GRAM | |
479 Index_out 0x16 | |
480 movlw 0x48 ; Flip image in the GRAM (Very elegant with display2...) | |
481 rcall TFT_DataWrite ; Write config | |
482 bra TFT_ClearScreen ; Clearscreen and return | |
483 | |
484 | |
485 display1_init: | |
486 movlw LOW 0x1F8BC | |
487 movwf TBLPTRL | |
488 movlw HIGH 0x1F8BC | |
489 movwf TBLPTRH | |
490 movlw UPPER 0x1F8BC | |
491 movwf TBLPTRU | |
492 display1_init_loop: | |
493 TBLRD*+ | |
494 movlw 0xFF | |
495 cpfseq TABLAT | |
496 bra display1_config_write ; Write Config pair to Display | |
497 ; Delay ms or quit (return) | |
498 TBLRD*+ | |
499 tstfsz TABLAT ; End of config? | |
500 bra $+4 ; No | |
501 return ; Done. | |
502 movf TABLAT,W | |
503 call WAITMSX ; Wait WREG milliseconds | |
504 bra display1_init_loop ; Loop | |
505 | |
506 display1_config_write: ; With command in WREG | |
507 movf TABLAT,W | |
508 rcall TFT_CmdWrite ; Write command | |
509 TBLRD*+ ; Get config | |
510 movf TABLAT,W | |
511 rcall TFT_DataWrite ; Write config | |
512 bra display1_init_loop ; Loop | |
513 | |
420 | 514 |
421 ;============================================================================= | 515 ;============================================================================= |
516 | |
517 global TFT_CmdWrite | |
518 TFT_CmdWrite: | |
519 RS_L ; command | |
520 btfsc screen_type2 | |
521 bra TFT_CmdWrite_screen2 | |
522 clrf PORTA ; upper | |
523 bcf INTCON,GIE | |
524 movwf PORTH ; lower | |
525 WR_L | |
526 WR_H ; tick | |
527 bsf INTCON,GIE | |
528 return | |
529 TFT_CmdWrite_screen2: | |
530 movwf PORTH ; Lower | |
531 WR_L | |
532 WR_H ; Tick | |
533 return; | |
534 | |
535 global TFT_DataWrite | |
536 TFT_DataWrite: | |
537 RS_H ; data | |
538 btfsc screen_type2 | |
539 bra TFT_DataWrite_screen2 | |
540 bcf INTCON,GIE | |
541 movwf PORTH ; lower | |
542 WR_L | |
543 WR_H ; tick | |
544 bsf INTCON,GIE | |
545 return | |
546 TFT_DataWrite_screen2: | |
547 movwf PORTH ; Lower | |
548 WR_L | |
549 WR_H ; Tick | |
550 return | |
551 | |
552 ;============================================================================= | |
553 | |
422 ; Smooth lighting-up of the display: | 554 ; Smooth lighting-up of the display: |
423 ; | 555 ; |
424 ; Trashes: WREG, PRODL | 556 ; Trashes: WREG, PRODL |
425 ; Typical usage: | 557 ; Typical usage: |
426 ; clrf CCPR1L ; backlight off | 558 ; clrf CCPR1L ; backlight off |
532 bra half_pixel_write ; note: Cmd 0x20 is mandatory, because | 664 bra half_pixel_write ; note: Cmd 0x20 is mandatory, because |
533 ; of the auto-increment going vertical | 665 ; of the auto-increment going vertical |
534 | 666 |
535 global pixel_write_col320 | 667 global pixel_write_col320 |
536 pixel_write_col320: | 668 pixel_write_col320: |
669 btfsc screen_type2 ; display2? | |
670 bra pixel_write_col320_d2 ; Yes | |
537 btfsc screen_type ; display1? | 671 btfsc screen_type ; display1? |
538 bra pixel_write_col320_d1 ; YES | 672 bra pixel_write_col320_d1 ; YES |
539 ; Display0 | 673 ; Display0 |
540 btfss flip_screen ; 180° rotation? | 674 btfss flip_screen ; 180° rotation? |
541 bra pixel_write_noflip_H ; NO | 675 bra pixel_write_noflip_H ; NO |
555 | 689 |
556 pixel_write_noflip_H: | 690 pixel_write_noflip_H: |
557 Index_out 0x21 ; frame memory vertical address | 691 Index_out 0x21 ; frame memory vertical address |
558 bra TFT_DataWrite_PROD ; and return... | 692 bra TFT_DataWrite_PROD ; and return... |
559 | 693 |
694 pixel_write_col320_d2: | |
695 movlw 0x06 | |
696 rcall TFT_CmdWrite | |
697 movf PRODH,W | |
698 rcall TFT_DataWrite | |
699 movlw 0x07 | |
700 rcall TFT_CmdWrite | |
701 movf PRODL,W | |
702 rcall TFT_DataWrite | |
703 | |
704 incf PRODL,F | |
705 movlw .0 | |
706 addwfc PRODH,F ;+1 | |
707 | |
708 movlw 0x08 | |
709 rcall TFT_CmdWrite | |
710 movf PRODH,W | |
711 rcall TFT_DataWrite | |
712 movlw 0x09 | |
713 rcall TFT_CmdWrite | |
714 movf PRODL,W | |
715 bra TFT_DataWrite ; And return... | |
716 | |
560 ;----------------------------------------------------------------------------- | 717 ;----------------------------------------------------------------------------- |
561 ; Writes one half-pixel at position (win_top,win_leftx2). | 718 ; Writes one half-pixel at position (win_top,win_leftx2). |
562 ; Inputs: win_leftx2, win_top, win_color:2 | 719 ; Inputs: win_leftx2, win_top, win_color:2 |
563 ; Trashed: WREG, PROD | 720 ; Trashed: WREG, PROD |
564 | 721 |
565 global half_pixel_write | 722 global half_pixel_write |
566 half_pixel_write: | 723 half_pixel_write: |
567 movf win_top,W ; d'0' ... d'239' | 724 movf win_top,W ; d'0' ... d'239' |
568 ; Variant with Y position in WREG. | 725 ; Variant with Y position in WREG. |
569 half_pixel_write_1: | 726 half_pixel_write_1: |
727 btfsc screen_type2 | |
728 bra half_pixel_write_1_display1 ; Yes. | |
729 | |
570 btfss flip_screen ; 180° rotation? | 730 btfss flip_screen ; 180° rotation? |
571 sublw .239 ; 239-Y --> Y | 731 sublw .239 ; 239-Y --> Y |
572 mullw .1 ; copy row to PRODL (PRODH=0) | 732 mullw .1 ; copy row to PRODL (PRODH=0) |
573 Index_out 0x20 ; frame memory horizontal address | 733 Index_out 0x20 ; frame memory horizontal address |
574 rcall TFT_DataWrite_PROD | 734 rcall TFT_DataWrite_PROD |
580 movff win_color2,PORTH ; lower | 740 movff win_color2,PORTH ; lower |
581 WR_L | 741 WR_L |
582 WR_H ; tick | 742 WR_H ; tick |
583 bsf INTCON,GIE | 743 bsf INTCON,GIE |
584 return | 744 return |
745 | |
746 half_pixel_write_1_display1: | |
747 mullw 1 ; Copy row to PRODL (PRODH=0) | |
748 ; Row address start | |
749 movlw 0x02 | |
750 rcall TFT_CmdWrite | |
751 movlw .0 | |
752 rcall TFT_DataWrite | |
753 movlw 0x03 | |
754 rcall TFT_CmdWrite | |
755 movf PRODL,W | |
756 rcall TFT_DataWrite | |
757 | |
758 incf PRODL,F | |
759 | |
760 movlw 0x04 | |
761 rcall TFT_CmdWrite | |
762 movlw .0 | |
763 rcall TFT_DataWrite | |
764 movlw 0x05 | |
765 rcall TFT_CmdWrite | |
766 movf PRODL,W | |
767 rcall TFT_DataWrite | |
768 | |
769 movff win_color1,PRODH | |
770 movff win_color2,PRODL | |
771 rcall convert_for_display2 | |
772 | |
773 movlw 0x22 ; Start Writing Data to GRAM | |
774 rcall TFT_CmdWrite | |
775 RS_H ; Data | |
776 movff win_color5, PORTH | |
777 WR_L | |
778 WR_H ; Tick | |
779 movff win_color4, PORTH | |
780 WR_L | |
781 WR_H ; Tick | |
782 movff win_color3, PORTH | |
783 WR_L | |
784 WR_H ; Tick | |
785 return | |
585 | 786 |
586 ;----------------------------------------------------------------------------- | 787 ;----------------------------------------------------------------------------- |
587 ; Writes a vertical line of half-pixel at position (win_top,win_leftx2,win_height). | 788 ; Writes a vertical line of half-pixel at position (win_top,win_leftx2,win_height). |
588 ; Inputs: win_leftx2, win_top, win_height, win_color:2 | 789 ; Inputs: win_leftx2, win_top, win_height, win_color:2 |
589 ; Trashed: WREG, PROD, TABLAT, TBLPTRL | 790 ; Trashed: WREG, PROD, TABLAT, TBLPTRL |
639 | 840 |
640 global TFT_DataWrite_PROD | 841 global TFT_DataWrite_PROD |
641 TFT_DataWrite_PROD: | 842 TFT_DataWrite_PROD: |
642 ; RD_H ; keep high | 843 ; RD_H ; keep high |
643 RS_H ; data | 844 RS_H ; data |
845 btfsc screen_type2 | |
846 bra TFT_DataWrite_PROD_display2 | |
644 bcf INTCON,GIE | 847 bcf INTCON,GIE |
645 movff PRODH,PORTA ; move high byte to PORTA | 848 movff PRODH,PORTA ; move high byte to PORTA |
646 movff PRODL,PORTH ; move low byte to PORTH | 849 movff PRODL,PORTH ; move low byte to PORTH |
647 WR_L | 850 WR_L |
648 WR_H ; tick | 851 WR_H ; tick |
649 bsf INTCON,GIE | 852 bsf INTCON,GIE |
853 return | |
854 | |
855 TFT_DataWrite_PROD_display2: | |
856 movff PRODH,PORTH ; Move high byte to PORTH (DISPLAY is bigendian) | |
857 WR_L | |
858 WR_H | |
859 movff PRODL,PORTH ; Move low byte to PORTH | |
860 WR_L | |
861 WR_H | |
862 movff win_color3,PORTH ; Move low(est) byte to PORTH | |
863 WR_L | |
864 WR_H | |
650 return | 865 return |
651 | 866 |
652 TFT_DataRead_PROD: | 867 TFT_DataRead_PROD: |
653 Index_out 0x22 ; frame memory data read start | 868 Index_out 0x22 ; frame memory data read start |
654 TFT_CmdRead_PROD: | 869 TFT_CmdRead_PROD: |
685 global TFT_box_write | 900 global TFT_box_write |
686 TFT_box_write: | 901 TFT_box_write: |
687 movf win_leftx2,W ; compute left = 2 * leftx2 --> PROD | 902 movf win_leftx2,W ; compute left = 2 * leftx2 --> PROD |
688 mullw 2 | 903 mullw 2 |
689 | 904 |
905 btfsc screen_type2 | |
906 bra TFT_box_write_display2 | |
907 | |
690 global TFT_box_write_16bit_win_left | 908 global TFT_box_write_16bit_win_left |
691 TFT_box_write_16bit_win_left: ; Wwth column in PRODL:PRODH | 909 TFT_box_write_16bit_win_left: ; Wwth column in PRODL:PRODH |
692 btfsc screen_type ; display1? | 910 btfsc screen_type ; display1? |
693 bra TFT_box_write_16bit_win_left_d1 ; YES | 911 bra TFT_box_write_16bit_win_left_d1 ; YES |
694 ; Display0 | 912 ; Display0 |
789 | 1007 |
790 Index_out 0x20 ; frame memory horizontal address | 1008 Index_out 0x20 ; frame memory horizontal address |
791 movf PRODL,W | 1009 movf PRODL,W |
792 bra TFT_DataWrite ; lower (and tick) and return | 1010 bra TFT_DataWrite ; lower (and tick) and return |
793 | 1011 |
1012 TFT_box_write_display2: | |
1013 movlw 0x06 | |
1014 rcall TFT_CmdWrite | |
1015 movf PRODH,W | |
1016 rcall TFT_DataWrite | |
1017 movlw 0x07 | |
1018 rcall TFT_CmdWrite | |
1019 movf PRODL,W | |
1020 rcall TFT_DataWrite | |
1021 | |
1022 movf win_width+0,W ; right = left + width - 1 | |
1023 addwf PRODL,F | |
1024 movf win_width+1,W | |
1025 addwfc PRODH,F | |
1026 decf PRODL,F,A ; decrement result | |
1027 btfss STATUS,C | |
1028 decf PRODH,F,A | |
1029 | |
1030 movlw 0x08 | |
1031 rcall TFT_CmdWrite | |
1032 movf PRODH,W | |
1033 rcall TFT_DataWrite | |
1034 movlw 0x09 | |
1035 rcall TFT_CmdWrite | |
1036 movf PRODL,W | |
1037 rcall TFT_DataWrite | |
1038 | |
1039 ;---- Normal vertical window ----------------------------------------- | |
1040 ; Output (top) (bottom) | |
1041 movff win_top,PRODH ; top --> PRODH (first byte) | |
1042 movff win_height,WREG | |
1043 addwf PRODH,W | |
1044 decf WREG | |
1045 movwf PRODL ; top+height-1 --> PRODL (second byte) | |
1046 | |
1047 movlw 0x02 | |
1048 rcall TFT_CmdWrite | |
1049 movlw 0x00 | |
1050 rcall TFT_DataWrite | |
1051 movlw 0x03 | |
1052 rcall TFT_CmdWrite | |
1053 movf PRODH,W | |
1054 rcall TFT_DataWrite | |
1055 | |
1056 movlw 0x04 | |
1057 rcall TFT_CmdWrite | |
1058 movlw 0x00 | |
1059 rcall TFT_DataWrite | |
1060 movlw 0x05 | |
1061 rcall TFT_CmdWrite | |
1062 movf PRODL,W | |
1063 bra TFT_DataWrite ; and return | |
1064 | |
794 | 1065 |
795 ;============================================================================= | 1066 ;============================================================================= |
796 ; TFT_frame : draw a frame around current box with current color | 1067 ; TFT_frame : draw a frame around current box with current color |
797 ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2 | 1068 ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2 |
798 ; Outputs: (none) | 1069 ; Outputs: (none) |
844 ; Outputs: (none) | 1115 ; Outputs: (none) |
845 ; Trashed: WREG, PROD | 1116 ; Trashed: WREG, PROD |
846 | 1117 |
847 global TFT_box | 1118 global TFT_box |
848 TFT_box: | 1119 TFT_box: |
1120 btfsc screen_type2 | |
1121 bra TFT_box_display2 | |
849 ;---- Define Window ------------------------------------------------------ | 1122 ;---- Define Window ------------------------------------------------------ |
850 bcf STATUS,C | 1123 bcf STATUS,C |
851 rlcf win_width+0,F | 1124 rlcf win_width+0,F |
852 rlcf win_width+1,F ; x2 | 1125 rlcf win_width+1,F ; x2 |
853 rcall TFT_box_write ; setup box | 1126 rcall TFT_box_write ; setup box |
898 rcall TFT_CmdWrite | 1171 rcall TFT_CmdWrite |
899 | 1172 |
900 ; reset bargraph mode... | 1173 ; reset bargraph mode... |
901 setf win_bargraph | 1174 setf win_bargraph |
902 return | 1175 return |
1176 TFT_box_display2: | |
1177 ;---- Define Window ------------------------------------------------------ | |
1178 bcf STATUS,C | |
1179 rlcf win_width+0,F | |
1180 rlcf win_width+1,F ; x2 | |
1181 rcall TFT_box_write ; Setup box | |
1182 | |
1183 bcf STATUS,C | |
1184 rrcf win_width+1,F ; width /= 2 | |
1185 rrcf win_width+0,F | |
1186 | |
1187 movff win_color1,PRODH | |
1188 movff win_color2,PRODL | |
1189 rcall convert_for_display2 | |
1190 ;---- Fill Window -------------------------------------------------------- | |
1191 Index_out 0x22 ; Frame Memory Data Write start | |
1192 | |
1193 clrf PRODH ; Column counter. | |
1194 RS_H ; Data | |
1195 | |
1196 TFT_box2_display2: ; Loop height times | |
1197 movff win_height,PRODL | |
1198 | |
1199 TFT_box3_display2: ; loop width times | |
1200 movff win_color5,PORTH | |
1201 bcf tft_nwr | |
1202 bsf tft_nwr ; Upper | |
1203 movff win_color4,PORTH | |
1204 bcf tft_nwr | |
1205 bsf tft_nwr ; High | |
1206 movff win_color3,PORTH | |
1207 bcf tft_nwr | |
1208 bsf tft_nwr ; Lower | |
1209 | |
1210 movff win_color5,PORTH | |
1211 bcf tft_nwr | |
1212 bsf tft_nwr ; Upper | |
1213 movff win_color4,PORTH | |
1214 bcf tft_nwr | |
1215 bsf tft_nwr ; High | |
1216 movff win_color3,PORTH | |
1217 bcf tft_nwr | |
1218 bsf tft_nwr ; Lower | |
1219 decfsz PRODL,F ; row loop finished ? | |
1220 bra TFT_box3_display2 ; No: continue. | |
1221 | |
1222 incf PRODH,F ; column count ++ | |
1223 | |
1224 movf win_bargraph,W ; current column == bargraph ? | |
1225 cpfseq PRODH | |
1226 bra TFT_box4_display2 ; No: just loop. | |
1227 | |
1228 ; Yes: switch to black | |
1229 clrf win_color5 | |
1230 clrf win_color4 | |
1231 clrf win_color3 | |
1232 TFT_box4_display2: | |
1233 movf win_width+0,W | |
1234 cpfseq PRODH | |
1235 bra TFT_box2_display2 | |
1236 | |
1237 ; Reset bargraph mode... | |
1238 setf win_bargraph | |
1239 return | |
1240 | |
903 | 1241 |
904 ;============================================================================= | 1242 ;============================================================================= |
905 ; Converts 8 bit RGB b'RRRGGGBB' into 16 bit RGB b'RRRRRGGGGGGBBBBB' | 1243 ; Converts 8 bit RGB b'RRRGGGBB' into 16 bit RGB b'RRRRRGGGGGGBBBBB' |
906 | 1244 |
907 global TFT_set_color | 1245 global TFT_set_color |
1009 | 1347 |
1010 rrcf tft_temp4,F | 1348 rrcf tft_temp4,F |
1011 rrcf tft_temp1,W ; red done | 1349 rrcf tft_temp1,W ; red done |
1012 movwf win_color1 ; set color registers | 1350 movwf win_color1 ; set color registers |
1013 return | 1351 return |
1352 | |
1353 global convert_for_display2 | |
1354 convert_for_display2: ; Convert 16Bit RGB b'RRRRRGGG GGGBBBBB' into 24Bit RGB b'RRRRRR00 GGGGGG00 BBBBBB00' | |
1355 ; PRODH PRODL win_color5 win_color4 win_color3 | |
1356 ; Red | |
1357 movff PRODH,win_color5 ; = RRRRRGGG | |
1358 bcf win_color5,2 ; = RRRRR0GG | |
1359 btfsc win_color5,7 | |
1360 bsf win_color5,2 ; = RRRRR1GG ; Lower two bits ignored from screen! | |
1361 ; Blue | |
1362 movff PRODL,win_color3 | |
1363 rrcf win_color3,F ; = UGGGBBBB (And the LSB-Blue in Carry) | |
1364 swapf win_color3,F ; = BBBBUGGG | |
1365 bcf win_color3,3 ; = BBBB0GGG | |
1366 btfsc STATUS,C | |
1367 bsf win_color3,3 ; = BBBB1GGG | |
1368 bcf win_color3,2 ; = BBBBB0GG | |
1369 btfsc win_color3,7 | |
1370 bsf win_color3,2 ; = BBBBB1GG | |
1371 ; Green | |
1372 rrcf PRODH,F | |
1373 rrcf PRODL,F | |
1374 rrcf PRODH,F | |
1375 rrcf PRODL,F | |
1376 rrcf PRODH,F | |
1377 rrcf PRODL,F ; = GGGGGGBB ; Lower two bits ignored from screen! | |
1378 movff PRODL,win_color4 | |
1379 return | |
1380 | |
1014 | 1381 |
1015 ;============================================================================= | 1382 ;============================================================================= |
1016 ; Dump screen contents to the UART | 1383 ; Dump screen contents to the UART |
1017 | 1384 |
1018 IFDEF _screendump | 1385 IFDEF _screendump |