annotate code_part1/OSTC_code_asm_part1/oled_samsung.asm @ 609:bbf5e1506c39

2.27beta
author heinrichsweikamp
date Sat, 07 Jul 2012 09:09:55 +0200
parents e3ffc6d62a63
children 963383a9b624
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
1 ; OSTC - diving computer code
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
2 ; Copyright (C) 2009 HeinrichsWeikamp GbR
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
3
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
4 ; This program is free software: you can redistribute it and/or modify
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
5 ; it under the terms of the GNU General Public License as published by
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
6 ; the Free Software Foundation, either version 3 of the License, or
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
7 ; (at your option) any later version.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
9 ; This program is distributed in the hope that it will be useful,
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
10 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
11 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
12 ; GNU General Public License for more details.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
13
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
14 ; You should have received a copy of the GNU General Public License
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
15 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
16
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
17
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
18 ; hardware routines for S6E6D6 Samsung OLED Driver IC
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
19 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
20 ; written: 090801
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
21 ; History:
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
22 ; 2009-08-30: [MH] last updated.
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
23 ; 2011-01-07: [jDG] Added flip_screen option
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
24 ; known bugs: pixel-write (loogbok curves) not done yet...
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
25 ; ToDo:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
26
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
27 WIN_FONT macro win_font_input
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
28 movlw win_font_input
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
29 movff WREG,win_font
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
30 endm
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
31
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
32 WIN_TOP macro win_top_input
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
33 movlw win_top_input
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
34 movff WREG,win_top
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
35 endm
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
36
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
37 WIN_LEFT macro win_left_input
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
38 movlw win_left_input
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
39 movff WREG,win_leftx2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
40 endm
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
41
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
42 WIN_INVERT macro win_invert_input
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
43 movlw win_invert_input
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
44 movff WREG,win_invert
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
45 endm
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
46
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
47 WIN_COLOR macro win_color_input
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
48 movlw win_color_input
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
49 call PLED_set_color
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
50 endm
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
51
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
52 ;=============================================================================
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
53
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
54 word_processor: ; word_processor:
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
55 clrf POSTINC2 ; Required, to mark end of string.
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
56 call aa_wordprocessor
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
57 movlb b'00000001' ; Back to Rambank1
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
58 return
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
59
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
60 ;=============================================================================
146
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
61 ; Macro to provides our own interface code.
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
62 ;
146
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
63 PIXEL_WRITE macro colRegister, rowRegister
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
64 movff colRegister,win_leftx2
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
65 movff rowRegister,win_top
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
66 call pixel_write
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
67 endm
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
68
146
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
69 INIT_PIXEL_WROTE macro colRegister
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
70 movff colRegister,win_leftx2
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
71 call init_pixel_write
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
72 endm
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
73
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
74 HALF_PIXEL_WRITE macro rowRegister
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
75 movff rowRegister,win_top
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
76 call half_pixel_write
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
77 endm
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
78
146
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
79 ;-----------------------------------------------------------------------------
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
80 ; Init for half_pixel_write
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
81 ; Set column register on OLED device, and current color.
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
82 ; Inputs: win_leftx2
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
83 ; Outputs: win_color:2
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
84 ; Trashed: WREG, PROD
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
85 init_pixel_write:
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
86 movff win_leftx2,WREG
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
87 mullw 2
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
88 rcall pixel_write_col320 ; Start Address Vertical (.0 - .319)
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
89 goto PLED_standard_color
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
90
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
91 ;-----------------------------------------------------------------------------
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
92 ; Writes two half-pixels at position (win_top,win_leftx2)
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
93 ; Inputs: win_leftx2, win_top, win_color:2
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
94 ; Trashed: WREG, PROD
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
95 pixel_write:
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
96 movff win_leftx2,WREG
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
97 mullw 2
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
98 rcall pixel_write_col320 ; Start Address Vertical (.0 - .319)
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
99 rcall half_pixel_write ; Write this half-one.
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
100
146
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
101 movff win_leftx2,WREG ; Address of next one
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
102 mullw 2
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
103 infsnz PRODL ; +1
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
104 incf PRODH
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
105 rcall pixel_write_col320
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
106 bra half_pixel_write ; Note: Cmd 0x20 is mandatory, because
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
107 ; of the autoincrement going vertical
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
108
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
109 ;---- Do the 16bit 319-X-->X, if needed, and send to OLED ------------
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
110 pixel_write_col320:
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
111 movff win_flags,WREG ; BEWARE: bank0 bit-test
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
112 btfss WREG,0 ; 180° rotation ?
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
113 bra pixel_write_noflip_H
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
114
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
115 movf PRODL,W ; 16bits 319 - PROD --> PROD
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
116 sublw LOW(.319) ; 319-W --> W
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
117 movwf PRODL
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
118 movf PRODH,W
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
119 btfss STATUS,C ; Borrow = /CARRY
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
120 incf WREG
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
121 sublw HIGH(.319)
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
122 movwf PRODH
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
123
146
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
124 pixel_write_noflip_H:
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
125 movlw 0x21 ; Start Address Vertical (.0 - .319)
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
126 rcall PLED_CmdWrite
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
127 bra PLED_DataWrite_PROD
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
128
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
129 ;-----------------------------------------------------------------------------
426
07f5b0baaa57 Adding temperature & ceiling curves
JeanDo
parents: 411
diff changeset
130 ; Writes a vertical line of half-pixel at position (win_top,win_leftx2,win_height).
07f5b0baaa57 Adding temperature & ceiling curves
JeanDo
parents: 411
diff changeset
131 ; Inputs: win_leftx2, win_top, win_height, win_color:2
07f5b0baaa57 Adding temperature & ceiling curves
JeanDo
parents: 411
diff changeset
132 ; Trashed: WREG, PROD, TABLAT, TBLPTRL
07f5b0baaa57 Adding temperature & ceiling curves
JeanDo
parents: 411
diff changeset
133 half_vertical_line:
07f5b0baaa57 Adding temperature & ceiling curves
JeanDo
parents: 411
diff changeset
134 clrf TABLAT ; Loop index.
07f5b0baaa57 Adding temperature & ceiling curves
JeanDo
parents: 411
diff changeset
135
07f5b0baaa57 Adding temperature & ceiling curves
JeanDo
parents: 411
diff changeset
136 half_vertical_line_loop:
452
05ec97e106da Minor changes: Tp? curve in orange. Ceilling stippled area.
JeanDo
parents: 426
diff changeset
137 movff win_leftx2,WREG ; Init X position.
05ec97e106da Minor changes: Tp? curve in orange. Ceilling stippled area.
JeanDo
parents: 426
diff changeset
138 mullw 2
05ec97e106da Minor changes: Tp? curve in orange. Ceilling stippled area.
JeanDo
parents: 426
diff changeset
139 movf TABLAT,W ; Get loop index
05ec97e106da Minor changes: Tp? curve in orange. Ceilling stippled area.
JeanDo
parents: 426
diff changeset
140 andlw 1 ; Just low bit
05ec97e106da Minor changes: Tp? curve in orange. Ceilling stippled area.
JeanDo
parents: 426
diff changeset
141 xorwf PRODL,F ; And use it to jitter current X position
05ec97e106da Minor changes: Tp? curve in orange. Ceilling stippled area.
JeanDo
parents: 426
diff changeset
142 rcall pixel_write_col320 ; Start Address Vertical (.0 - .319)
05ec97e106da Minor changes: Tp? curve in orange. Ceilling stippled area.
JeanDo
parents: 426
diff changeset
143
426
07f5b0baaa57 Adding temperature & ceiling curves
JeanDo
parents: 411
diff changeset
144 movff win_height,WREG ; Index reached height (Bank0 read) ?
07f5b0baaa57 Adding temperature & ceiling curves
JeanDo
parents: 411
diff changeset
145 xorwf TABLAT,W
07f5b0baaa57 Adding temperature & ceiling curves
JeanDo
parents: 411
diff changeset
146 btfsc STATUS,Z ; Equals ?
07f5b0baaa57 Adding temperature & ceiling curves
JeanDo
parents: 411
diff changeset
147 return ; Yes: done.
07f5b0baaa57 Adding temperature & ceiling curves
JeanDo
parents: 411
diff changeset
148 movff win_top,WREG ; Y = top + index (Bank0 read)
07f5b0baaa57 Adding temperature & ceiling curves
JeanDo
parents: 411
diff changeset
149 addwf TABLAT,W
07f5b0baaa57 Adding temperature & ceiling curves
JeanDo
parents: 411
diff changeset
150 rcall half_pixel_write_1
07f5b0baaa57 Adding temperature & ceiling curves
JeanDo
parents: 411
diff changeset
151 incf TABLAT,F ; index++
07f5b0baaa57 Adding temperature & ceiling curves
JeanDo
parents: 411
diff changeset
152 bra half_vertical_line_loop
07f5b0baaa57 Adding temperature & ceiling curves
JeanDo
parents: 411
diff changeset
153
07f5b0baaa57 Adding temperature & ceiling curves
JeanDo
parents: 411
diff changeset
154 ;-----------------------------------------------------------------------------
146
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
155 ; Writes one half-pixel at position (win_top,win_leftx2).
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
156 ; Inputs: win_leftx2, win_top, win_color:2
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
157 ; Trashed: WREG, PROD
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
158 half_pixel_write:
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
159 movff win_top,WREG ; d'0' ... d'239'
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
160
426
07f5b0baaa57 Adding temperature & ceiling curves
JeanDo
parents: 411
diff changeset
161 ; Variant with Y position in WREG.
07f5b0baaa57 Adding temperature & ceiling curves
JeanDo
parents: 411
diff changeset
162 half_pixel_write_1:
146
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
163 movff win_flags,PRODL ; BEWARE: bank0 bit-test
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
164 btfsc PRODL,0 ; 180° rotation ?
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
165 sublw .239 ; 239-Y --> Y
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
166
146
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
167 mullw 1 ; Copy row to PRODH:L
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
168 movlw 0x20 ; Horizontal Address START:END
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
169 rcall PLED_CmdWrite
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
170 rcall PLED_DataWrite_PROD
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
171
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
172 movlw 0x22 ; Start Writing Data to GRAM
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
173 rcall PLED_CmdWrite
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
174 bsf oled_rs ; Data!
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
175 movff win_color1, PORTD
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
176 bcf oled_rw
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
177 bsf oled_rw ; Upper
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
178 movff win_color2, PORTD
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
179 bcf oled_rw
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
180 bsf oled_rw ; Lower
c09b0be2e1e6 PIXEL_WRITE macros.
JeanDo
parents: 142
diff changeset
181 return
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
182
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
183 ; -----------------------------
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
184 ; PLED Display Off
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
185 ; -----------------------------
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
186 PLED_DisplayOff:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
187 clrf PORTD
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
188 bcf oled_hv
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
189 bcf oled_vdd
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
190 bcf oled_cs
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
191 bcf oled_e_nwr
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
192 bcf oled_rw
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
193 bcf oled_nreset
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
194 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
195
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
196 ;=============================================================================
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
197 ; Fast macros to write to OLED display.
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
198 ; Adding a call/return adds 3 words and a pipeline flush, hence make it
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
199 ; nearly twice slower...
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
200 ;
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
201 ; Input : commande as macro parameter.
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
202 ; Output : NONE
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
203 ; Trash : WREG
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
204 ;
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
205 AA_CMD_WRITE macro cmd
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
206 movlw cmd
576
ab2686087bce faster font display, code cleaning
heinrichsweikamp
parents: 499
diff changeset
207 ; rcall PLED_CmdWrite ; slow but saves a lot of bytes in flash
ab2686087bce faster font display, code cleaning
heinrichsweikamp
parents: 499
diff changeset
208 ; /* Fast writing
ab2686087bce faster font display, code cleaning
heinrichsweikamp
parents: 499
diff changeset
209 bcf oled_rs ; Cmd mode
ab2686087bce faster font display, code cleaning
heinrichsweikamp
parents: 499
diff changeset
210 movwf PORTD,A
ab2686087bce faster font display, code cleaning
heinrichsweikamp
parents: 499
diff changeset
211 bcf oled_rw ; Tick the clock
ab2686087bce faster font display, code cleaning
heinrichsweikamp
parents: 499
diff changeset
212 bsf oled_rw
ab2686087bce faster font display, code cleaning
heinrichsweikamp
parents: 499
diff changeset
213 ; Fast writing */
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
214 endm
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
215 ;
330
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents: 167
diff changeset
216 ; Input : data as macro parameter.
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents: 167
diff changeset
217 ; Output : NONE
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents: 167
diff changeset
218 ; Trash : WREG
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents: 167
diff changeset
219 ;
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents: 167
diff changeset
220 AA_DATA_WRITE macro data
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents: 167
diff changeset
221 movlw data
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents: 167
diff changeset
222 rcall PLED_DataWrite
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents: 167
diff changeset
223 endm
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents: 167
diff changeset
224 ;
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
225 ; Input : PRODH:L as 16bits data.
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
226 ; Output : NONE
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
227 ; Trash : NONE
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
228 ;
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
229 AA_DATA_WRITE_PROD macro
576
ab2686087bce faster font display, code cleaning
heinrichsweikamp
parents: 499
diff changeset
230 ; rcall PLED_DataWrite_PROD ; slow but saves a lot of bytes in flash
ab2686087bce faster font display, code cleaning
heinrichsweikamp
parents: 499
diff changeset
231 ; /* Fast writing
ab2686087bce faster font display, code cleaning
heinrichsweikamp
parents: 499
diff changeset
232 bsf oled_rs ; Data mode
ab2686087bce faster font display, code cleaning
heinrichsweikamp
parents: 499
diff changeset
233 movff PRODH,PORTD ; NOTE: OLED is BIGENDIAN!
ab2686087bce faster font display, code cleaning
heinrichsweikamp
parents: 499
diff changeset
234 bcf oled_rw ; Tick the clock
ab2686087bce faster font display, code cleaning
heinrichsweikamp
parents: 499
diff changeset
235 bsf oled_rw
ab2686087bce faster font display, code cleaning
heinrichsweikamp
parents: 499
diff changeset
236 movff PRODL,PORTD
ab2686087bce faster font display, code cleaning
heinrichsweikamp
parents: 499
diff changeset
237 bcf oled_rw ; Tick the clock
ab2686087bce faster font display, code cleaning
heinrichsweikamp
parents: 499
diff changeset
238 bsf oled_rw
ab2686087bce faster font display, code cleaning
heinrichsweikamp
parents: 499
diff changeset
239 ; Fast writing */
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
240 endm
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
241
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
242 ;=============================================================================
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
243 ; Output OLED Window Address commands.
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
244 ; Inputs : win_top, win_leftx2, win_height, aa_width.
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
245 ; Output : PortD commands.
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
246 ; Trashed: PROD
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
247 ;
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
248 PLED_box_write:
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
249 movff win_leftx2,WREG ; Compute left = 2*leftx2 --> PROD
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
250 mullw 2
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
251
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
252 movff win_flags,WREG ; BEWARE: bank0 bit-test
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
253 btfsc WREG,0 ; 180° rotation ?
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
254 bra PLED_box_flip_H ; YES:
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
255
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
256 ;---- Normal horizontal window ---------------------------------------
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
257 ; Output 0x35 left,
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
258 ; 0x36 right == left + width - 1.
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
259 AA_CMD_WRITE 0x35 ; this is the left border
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
260 AA_DATA_WRITE_PROD ; Output left
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
261 AA_CMD_WRITE 0x21 ; Also the horizontal first pix coord.
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
262 AA_DATA_WRITE_PROD
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
263
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
264 movf aa_width+0,W,ACCESS ; right = left + width - 1
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
265 addwf PRODL,F
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
266 movf aa_width+1,W,ACCESS
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
267 addwfc PRODH,F
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
268 decf PRODL,F,A ; decrement result
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
269 btfss STATUS,C
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
270 decf PRODH,F,A
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
271
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
272 AA_CMD_WRITE 0x36 ; Write and the right border
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
273 AA_DATA_WRITE_PROD
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
274
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
275 bra PLED_box_noflip_H
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
276
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
277 ;---- Flipped horizontal window --------------------------------------
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
278 PLED_box_flip_H:
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
279 ; Output 0x36 flipped(left) = 319-left
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
280 ; 0x35 flipped(right) = 319-right = 320 - left - width
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
281 movf PRODL,W ; 16bits 319 - PROD --> PROD
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
282 sublw LOW(.319) ; 319-W --> W
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
283 movwf PRODL
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
284 movf PRODH,W
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
285 btfss STATUS,C ; Borrow = /CARRY
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
286 incf WREG
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
287 sublw HIGH(.319)
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
288 movwf PRODH
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
289 AA_CMD_WRITE 0x36 ; this is the left border
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
290 AA_DATA_WRITE_PROD ; Output left
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
291 AA_CMD_WRITE 0x21
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
292 AA_DATA_WRITE_PROD
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
293
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
294 movf aa_width+0,W ; 16bits PROD - width --> PROD
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
295 subwf PRODL,F ; PRODL - WREG --> PRODL
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
296 movf aa_width+1,W
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
297 subwfb PRODH,F
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
298 infsnz PRODL ; PROD+1 --> PROD
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
299 incf PRODH
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
300 AA_CMD_WRITE 0x35 ; this is the left border
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
301 AA_DATA_WRITE_PROD ; Output left
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
302
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
303 PLED_box_noflip_H:
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
304 movff win_flags,WREG ; BEWARE: bank0 bit-test
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
305 btfsc WREG,0 ; 180° rotation ?
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
306 bra PLED_box_flip_V
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
307
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
308 ;---- Normal vertical window -----------------------------------------
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
309 ; Output 0x37 (top) (bottom)
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
310 movff win_top,PRODH ; top --> PRODH (first byte)
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
311 movff win_height,WREG
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
312 addwf PRODH,W
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
313 decf WREG
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
314 movwf PRODL ; top+height-1 --> PRODL (second byte)
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
315
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
316 AA_CMD_WRITE 0x37
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
317 AA_DATA_WRITE_PROD
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
318
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
319 movff PRODH,PRODL
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
320 clrf PRODH ; Start pixel V coord == top.
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
321 AA_CMD_WRITE 0x20
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
322 AA_DATA_WRITE_PROD
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
323
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
324 return
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
325
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
326 ;---- Flipped vertical window ----------------------------------------
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
327 ; Output 0x37 flipped(bottom) = 239-bottom = 240 - top - height
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
328 ; flipped(top) = 239-top
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
329 PLED_box_flip_V:
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
330 movff win_top,PRODL
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
331 movff win_height,WREG
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
332 addwf PRODL,W
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
333 sublw .240 ; 240 - top - height
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
334 movwf PRODH ; First byte
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
335
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
336 movf PRODL,W
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
337 sublw .239 ; 249-top
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
338 movwf PRODL ; --> second byte.
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
339
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
340 AA_CMD_WRITE 0x37
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
341 AA_DATA_WRITE_PROD
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
342
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
343 clrf PRODH ; Start pixel V coord.
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
344 AA_CMD_WRITE 0x20
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
345 AA_DATA_WRITE_PROD
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
346
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
347 return
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
348
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
349 ;=============================================================================
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
350 ; PLED_frame : draw a frame around current box with current color.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
351 ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
352 ; Outputs: (none)
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
353 ; Trashed: WREG, PROD, aa_start:2, aa_end:2, win_leftx2, win_width:1
167
cb055a7d75f3 + Use overlay local vars.
JeanDo
parents: 150
diff changeset
354 global PLED_frame
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
355 PLED_frame:
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
356 movff win_top,aa_start+0 ; Backup everything.
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
357 movff win_height,aa_start+1
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
358 movff win_leftx2,aa_end+0
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
359 movff win_width,aa_end+1
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
360
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
361 ;---- TOP line -----------------------------------------------------------
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
362 movlw 1 ; row ~ height=1
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
363 movff WREG,win_height
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
364 rcall PLED_box
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
365
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
366 ;---- BOTTOM line --------------------------------------------------------
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
367 movff aa_start+0,PRODL ; Get back top,
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
368 movff aa_start+1,WREG ; and height
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
369 addwf PRODL,W ; top+height
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
370 decf WREG ; top+height-1
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
371 movff WREG,win_top ; top+height-1 --> top
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
372 rcall PLED_box
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
373
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
374 ;---- LEFT column --------------------------------------------------------
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
375 movff aa_start+0,win_top ; Restore top/height.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
376 movff aa_start+1,win_height
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
377 movlw 1 ; column ~ width=1
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
378 movff WREG,win_width
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
379 rcall PLED_box
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
380
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
381 ;---- RIGHT column -------------------------------------------------------
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
382 movff aa_end+0,WREG
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
383 movff aa_end+1,PRODL
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
384 addwf PRODL,W
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
385 decf WREG
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
386 movff WREG,win_leftx2
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
387 bra PLED_box
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
388
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
389 ;=============================================================================
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
390 ; PLED_box : fills current box with current color.
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
391 ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
392 ; Outputs: (none)
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
393 ; Trashed: WREG, PROD
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
394
167
cb055a7d75f3 + Use overlay local vars.
JeanDo
parents: 150
diff changeset
395 global PLED_box
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
396 PLED_box:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
397 ;---- Define Window ------------------------------------------------------
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
398 movff win_width,WREG
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
399 bcf STATUS,C
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
400 rlcf WREG
150
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
401 movwf aa_width+0
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
402 movlw 0
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
403 rlcf WREG
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
404 movwf aa_width+1
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
405 rcall PLED_box_write
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
406
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
407 ;---- Fill Window --------------------------------------------------------
150
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
408 movlw 0x22 ; Start Writing Data to GRAM
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
409 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
410
150
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
411 clrf PRODH ; Column counter.
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
412 bsf oled_rs ; Data!
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
413
150
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
414 PLED_box2: ; Loop height times
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
415 movff win_height,PRODL
150
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
416
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
417 PLED_box3: ; loop width times
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
418 movff win_color1,PORTD
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
419 bcf oled_rw
150
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
420 bsf oled_rw ; Upper
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
421 movff win_color2,PORTD
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
422 bcf oled_rw
150
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
423 bsf oled_rw ; Lower
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
424
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
425 movff win_color1,PORTD
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
426 bcf oled_rw
150
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
427 bsf oled_rw ; Upper
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
428 movff win_color2,PORTD
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
429 bcf oled_rw
150
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
430 bsf oled_rw ; Lower
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
431
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
432 decfsz PRODL,F ; row loop finished ?
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
433 bra PLED_box3 ; No: continue.
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
434
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
435 incf PRODH,F ; column count ++
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
436
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
437 movff win_bargraph,WREG ; current column == bargraph ?
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
438 cpfseq PRODH
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
439 bra PLED_box4 ; No: just loop.
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
440
150
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
441 clrf WREG ; Yes: switch to black
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
442 movff WREG,win_color1
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
443 movff WREG,win_color2
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
444 PLED_box4:
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
445 movff win_width,WREG
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
446 cpfseq PRODH
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
447 bra PLED_box2
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
448
150
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
449 movlw 0x00 ; NOP, to stop window mode
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
450 rcall PLED_CmdWrite
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
451
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
452 setf WREG ; Reset bargraph mode...
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
453 movff WREG,win_bargraph
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
454 return
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
455
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
456 ;=============================================================================
129
06c4899ddb4b Custom views in dive mode configrable (New CF50-CF53)
Heinrichsweikamp
parents: 123
diff changeset
457 ; PLED_ClearScreen: An optimized version of PLEX_box, for full screen black.
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
458 ; Trashed: WREG, PROD
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
459
167
cb055a7d75f3 + Use overlay local vars.
JeanDo
parents: 150
diff changeset
460 global PLED_ClearScreen
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
461 PLED_ClearScreen:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
462 movlw 0x35 ; VerticalStartAddress HIGH:LOW
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
463 rcall PLED_CmdWrite
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
464 mullw 0
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
465 rcall PLED_DataWrite_PROD
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
466
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
467 movlw 0x36 ; VerticalEndAddress HIGH:LOW
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
468 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
469 movlw 0x01
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
470 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
471 movlw 0x3F
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
472 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
473
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
474 movlw 0x37 ; HorizontalAddress START:END
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
475 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
476 movlw 0x00
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
477 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
478 movlw 0xEF
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
479 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
480
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
481 movlw 0x20 ; Start Address Horizontal (.0 - .239)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
482 rcall PLED_CmdWrite
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
483 rcall PLED_DataWrite_PROD
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
484
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
485 movlw 0x21 ; Start Address Vertical (.0 - .319)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
486 rcall PLED_CmdWrite
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
487 rcall PLED_DataWrite_PROD
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
488
150
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
489 movlw 0x22 ; Start Writing Data to GRAM
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
490 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
491
83
3e351e25f5d1 adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents: 81
diff changeset
492 ; See Page 101 of OLED Driver IC Datasheet how to handle rs/rw clocks
150
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
493 bsf oled_rs ; Data!
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
494
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
495 movlw .160
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
496 movwf PRODH
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
497 PLED_ClearScreen2:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
498 movlw .240
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
499 movwf PRODL
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
500 PLED_ClearScreen3:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
501
150
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
502 clrf PORTD ; Need to generate trace here too.
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
503 bcf oled_rw
150
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
504 bsf oled_rw ; Upper
81
31fa973a70fd Kludges to emulate inexisting devices when debugged with the MPLAB software SIMulator.
JeanDo
parents: 3
diff changeset
505
150
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
506 clrf PORTD ; Need to generate trace here too.
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
507 bcf oled_rw
150
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
508 bsf oled_rw ; Lower
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
509
150
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
510 clrf PORTD ; Need to generate trace here too.
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
511 bcf oled_rw
150
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
512 bsf oled_rw ; Upper
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
513
150
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
514 clrf PORTD ; Need to generate trace here too.
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
515 bcf oled_rw
150
fc699a7460e6 Fix desat graph:
JeanDo
parents: 146
diff changeset
516 bsf oled_rw ; Lower
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
517
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
518 decfsz PRODL,F
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
519 bra PLED_ClearScreen3
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
520 decfsz PRODH,F
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
521 bra PLED_ClearScreen2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
522
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
523 movlw 0x00 ; NOP, to stop Address Update Counter
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
524 bra PLED_CmdWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
525
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
526 ; -----------------------------
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
527 ; PLED Write Cmd via W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
528 ; -----------------------------
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
529 PLED_CmdWrite:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
530 bcf oled_rs ; Command!
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
531 movwf PORTD ; Move Data to PORTD
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
532 bcf oled_rw
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
533 bsf oled_rw
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
534 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
535
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
536 ; -----------------------------
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
537 ; PLED Write Display Data via W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
538 ; -----------------------------
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
539 PLED_DataWrite:
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
540 bsf oled_rs ; Data!
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
541 movwf PORTD ; Move Data to PORTD
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
542 bcf oled_rw
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
543 bsf oled_rw
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
544 return
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
545
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
546 ; -----------------------------
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
547 ; PLED Data Cmd via W
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
548 ; -----------------------------
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
549 PLED_DataWrite_PROD:
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
550 bsf oled_rs ; Data!
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
551 movff PRODH,PORTD ; Move high byte to PORTD (OLED is bigendian)
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
552 bcf oled_rw
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
553 bsf oled_rw
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
554 movff PRODL,PORTD ; Move low byte to PORTD
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
555 bcf oled_rw
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
556 bsf oled_rw
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
557 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
558
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
559 ; -----------------------------
330
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents: 167
diff changeset
560 ; PLED Read data into WREG
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents: 167
diff changeset
561 ; -----------------------------
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents: 167
diff changeset
562 ; NOTE: you should "setf TRISD" before calling this function,
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents: 167
diff changeset
563 ; to make PortD an input port...
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents: 167
diff changeset
564 PLED_DataRead:
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents: 167
diff changeset
565 bsf oled_rs ; Data register.
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents: 167
diff changeset
566 bcf oled_e_nwr ; Read enable.
475
472bccc39aeb some nops for read command
heinrichsweikamp
parents: 452
diff changeset
567 nop
472bccc39aeb some nops for read command
heinrichsweikamp
parents: 452
diff changeset
568 nop
472bccc39aeb some nops for read command
heinrichsweikamp
parents: 452
diff changeset
569 nop
472bccc39aeb some nops for read command
heinrichsweikamp
parents: 452
diff changeset
570 nop
330
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents: 167
diff changeset
571 movf PORTD,W ; Read byte.
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents: 167
diff changeset
572 bsf oled_e_nwr ; release bus.
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents: 167
diff changeset
573 return
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents: 167
diff changeset
574
447390289f47 NEW screen_dump serial command (l)
JeanDo
parents: 167
diff changeset
575 ; -----------------------------
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
576 ; PLED boot
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
577 ; -----------------------------
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
578 PLED_boot:
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
579 bcf oled_hv
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
580 WAITMS d'32'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
581 bsf oled_vdd
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
582 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
583 bcf oled_cs
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
584 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
585 bsf oled_nreset
3
3cf8af30b36e v1.51 beta
heinrichsweikamp
parents: 2
diff changeset
586 ; WAITMS d'10' ; Quick wake-up
3cf8af30b36e v1.51 beta
heinrichsweikamp
parents: 2
diff changeset
587 WAITMS d'250' ; Standard wake-up
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
588 bsf oled_e_nwr
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
589 nop
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
590 bcf oled_nreset
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
591 WAIT10US d'2'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
592 bsf oled_nreset
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
593 WAITMS d'10'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
594
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
595 movlw 0x24 ; 80-System 8-Bit Mode
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
596 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
597
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
598 movlw 0x02 ; RGB Interface Control (S6E63D6 Datasheet page 42)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
599 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
600 movlw 0x00 ; X X X X X X X RM
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
601 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
602 movlw 0x00 ; DM X RIM1 RIM0 VSPL HSPL EPL DPL
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
603 rcall PLED_DataWrite ; System Interface: RIM is ignored, Internal Clock
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
604
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
605 movlw 0x03 ; Entry Mode (S6E63D6 Datasheet page 46)
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
606 rcall PLED_CmdWrite
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
607 movlw 0x00 ; CLS MDT1 MDT0 BGR X X X SS 65k Color
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
608 rcall PLED_DataWrite
142
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
609
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
610 ; Change direction for block-writes of pixels
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
611 lfsr FSR0,win_flags
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
612 btfss INDF0,0 ; BANK-SAFE bit test.
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
613 movlw b'00110000' ; [normal] X X I/D1 I/D0 X X X AM
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
614 btfsc INDF0,0
8b75ba28d641 Screen-flipping custom function.
JeanDo
parents: 130
diff changeset
615 movlw b'00000000' ; [flipped] X X I/D1 I/D0 X X X AM
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
616 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
617
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
618 movlw 0x18
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
619 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
620 movlw 0x00
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
621 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
622 movlw 0x28
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
623 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
624
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
625 movlw 0xF8
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
626 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
627 movlw 0x00
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
628 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
629 movlw 0x0F
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
630 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
631
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
632 movlw 0xF9
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
633 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
634 movlw 0x00
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
635 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
636 movlw 0x0F
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
637 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
638
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
639 movlw 0x10
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
640 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
641 movlw 0x00
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
642 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
643 movlw 0x00
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
644 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
645
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
646 ; Now Gamma settings...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
647 rcall PLED_brightness_full
2
d11ef8dc4b2c Bugfix: PC simulator
heinrichsweikamp
parents: 0
diff changeset
648 ;rcall PLED_brightness_low
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
649 ; End Gamma Settings
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
650
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
651 rcall PLED_ClearScreen
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
652
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
653 bsf oled_hv
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
654 WAITMS d'32'
411
e6e1b89b7c3e BUGFIX: CNS was not cleared with a "Reset Deco"
heinrichsweikamp
parents: 331
diff changeset
655 bsf oled_hv
e6e1b89b7c3e BUGFIX: CNS was not cleared with a "Reset Deco"
heinrichsweikamp
parents: 331
diff changeset
656 WAITMS d'32'
e6e1b89b7c3e BUGFIX: CNS was not cleared with a "Reset Deco"
heinrichsweikamp
parents: 331
diff changeset
657 bsf oled_hv
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
658
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
659 movlw 0x05
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
660 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
661 movlw 0x00
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
662 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
663 movlw 0x01
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
664 rcall PLED_DataWrite ; Display ON
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
665 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
666
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
667
499
2ac77db9c150 Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents: 483
diff changeset
668 PLED_brightness_full: ; Choose between Eco and High...
2ac77db9c150 Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents: 483
diff changeset
669 btfsc oled_brightness_high ; OLED brightness (=0: Eco, =1: High)
2ac77db9c150 Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents: 483
diff changeset
670 bra PLED_brightness_full_high
483
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
671 ; Mid
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
672 movlw 0x70
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
673 rcall PLED_CmdWrite
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
674 movlw 0x1B
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
675 rcall PLED_DataWrite
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
676 movlw 0x80
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
677 rcall PLED_DataWrite
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
678 movlw 0x71
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
679 rcall PLED_CmdWrite
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
680 movlw 0x1F
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
681 rcall PLED_DataWrite
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
682 movlw 0x00
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
683 rcall PLED_DataWrite
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
684 movlw 0x72
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
685 rcall PLED_CmdWrite
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
686 movlw 0x22
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
687 rcall PLED_DataWrite
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
688 movlw 0x00
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
689 rcall PLED_DataWrite
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
690
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
691 movlw 0x73
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
692 rcall PLED_CmdWrite
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
693 movlw 0x17
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
694 rcall PLED_DataWrite
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
695 movlw 0x11
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
696 rcall PLED_DataWrite
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
697 movlw 0x74
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
698 rcall PLED_CmdWrite
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
699 movlw 0x1A
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
700 rcall PLED_DataWrite
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
701 movlw 0x0E
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
702 rcall PLED_DataWrite
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
703
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
704 movlw 0x75
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
705 rcall PLED_CmdWrite
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
706 movlw 0x1D
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
707 rcall PLED_DataWrite
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
708 movlw 0x15
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
709 rcall PLED_DataWrite
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
710 movlw 0x76
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
711 rcall PLED_CmdWrite
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
712 movlw 0x18
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
713 rcall PLED_DataWrite
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
714 movlw 0x11
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
715 rcall PLED_DataWrite
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
716
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
717 movlw 0x77
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
718 rcall PLED_CmdWrite
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
719 movlw 0x1E
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
720 rcall PLED_DataWrite
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
721 movlw 0x18
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
722 rcall PLED_DataWrite
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
723 movlw 0x78
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
724 rcall PLED_CmdWrite
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
725 movlw 0x1D
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
726 rcall PLED_DataWrite
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
727 movlw 0x11
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
728 rcall PLED_DataWrite
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
729 return
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
730
499
2ac77db9c150 Added OLED brightness setting, texts 280, 312 and 313 need update
heinrichsweikamp
parents: 483
diff changeset
731 PLED_brightness_full_high:
483
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
732 ; Full
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
733 movlw 0x70
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
734 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
735 movlw 0x1F
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
736 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
737 movlw 0x00
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
738 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
739 movlw 0x71
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
740 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
741 movlw 0x23
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
742 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
743 movlw 0x80
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
744 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
745 movlw 0x72
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
746 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
747 movlw 0x2A
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
748 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
749 movlw 0x80
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
750 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
751
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
752 movlw 0x73
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
753 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
754 movlw 0x15
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
755 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
756 movlw 0x11
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
757 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
758 movlw 0x74
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
759 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
760 movlw 0x1C
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
761 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
762 movlw 0x11
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
763 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
764
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
765 movlw 0x75
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
766 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
767 movlw 0x1B
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
768 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
769 movlw 0x15
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
770 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
771 movlw 0x76
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
772 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
773 movlw 0x1A
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
774 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
775 movlw 0x15
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
776 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
777
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
778 movlw 0x77
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
779 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
780 movlw 0x1C
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
781 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
782 movlw 0x18
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
783 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
784 movlw 0x78
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
785 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
786 movlw 0x21
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
787 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
788 movlw 0x15
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
789 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
790 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
791
483
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
792
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
793 PLED_brightness_low:
483
0635fbb2fcf5 Tweaking gamma values
heinrichsweikamp
parents: 475
diff changeset
794 ;Low
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
795 movlw 0x70
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
796 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
797 movlw 0x14
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
798 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
799 movlw 0x00
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
800 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
801 movlw 0x71
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
802 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
803 movlw 0x17
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
804 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
805 movlw 0x00
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
806 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
807 movlw 0x72
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
808 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
809 movlw 0x15
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
810 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
811 movlw 0x80
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
812 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
813
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
814 movlw 0x73
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
815 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
816 movlw 0x15
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
817 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
818 movlw 0x11
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
819 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
820 movlw 0x74
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
821 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
822 movlw 0x14
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
823 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
824 movlw 0x0B
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
825 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
826
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
827 movlw 0x75
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
828 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
829 movlw 0x1B
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
830 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
831 movlw 0x15
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
832 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
833 movlw 0x76
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
834 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
835 movlw 0x13
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
836 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
837 movlw 0x0E
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
838 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
839
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
840 movlw 0x77
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
841 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
842 movlw 0x1C
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
843 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
844 movlw 0x18
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
845 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
846 movlw 0x78
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
847 rcall PLED_CmdWrite
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
848 movlw 0x15
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
849 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
850 movlw 0x0E
123
6a94f96e9cea The big cleanup, again.
JeanDo
parents: 83
diff changeset
851 rcall PLED_DataWrite
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
852
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
853 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
854
577
e3ffc6d62a63 minor clean
heinrichsweikamp
parents: 576
diff changeset
855 PLED_set_color:;Converts 8Bit RGB b'RRRGGGBB' into 16Bit RGB b'RRRRRGGG GGGBBBBB'
0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
856 movwf oled1_temp ; Get 8Bit RGB b'RRRGGGBB'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
857 movff oled1_temp, oled2_temp ; Copy
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
858
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
859 ; Mask Bit 7,6,5,4,3,2
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
860 movlw b'00000011'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
861 andwf oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
862
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
863 movlw b'00000000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
864 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
865 movlw b'01010000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
866 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
867 movlw b'10100000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
868 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
869 movlw b'11111000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
870 movwf oled3_temp ; Blue done.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
871
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
872 movff oled1_temp, oled2_temp ; Copy
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
873 ; Mask Bit 7,6,5,1,0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
874 movlw b'00011100'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
875 andwf oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
876 rrncf oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
877 rrncf oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
878
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
879 movlw b'00000000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
880 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
881 movlw b'00000100'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
882 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
883 movlw b'00001000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
884 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
885 movlw b'00001100'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
886 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
887 movlw b'00010000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
888 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
889 movlw b'00010100'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
890 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
891 movlw b'00100000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
892 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
893 movlw b'00111111'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
894 movwf oled4_temp
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
895
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
896 rrcf oled4_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
897 rrcf oled3_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
898
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
899 rrcf oled4_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
900 rrcf oled3_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
901
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
902 rrcf oled4_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
903 rrcf oled3_temp,F ; oled3_temp (b'GGGBBBBB') done.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
904
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
905 movff oled1_temp, oled2_temp ; Copy
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
906 clrf oled1_temp
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
907
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
908 rrcf oled4_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
909 rrcf oled1_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
910
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
911 rrcf oled4_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
912 rrcf oled1_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
913
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
914 rrcf oled4_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
915 rrcf oled1_temp,F ; Green done.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
916
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
917 ; Mask Bit 4,3,2,1,0
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
918 movlw b'11100000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
919 andwf oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
920
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
921 rrncf oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
922 rrncf oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
923 rrncf oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
924 rrncf oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
925 rrncf oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
926
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
927 movlw b'00000000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
928 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
929 movlw b'00000100'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
930 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
931 movlw b'00001000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
932 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
933 movlw b'00001100'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
934 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
935 movlw b'00010000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
936 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
937 movlw b'00010100'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
938 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
939 movlw b'00100000'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
940 dcfsnz oled2_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
941 movlw b'00111111'
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
942 movwf oled4_temp
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
943
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
944 rrcf oled4_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
945 rrcf oled1_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
946
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
947 rrcf oled4_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
948 rrcf oled1_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
949
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
950 rrcf oled4_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
951 rrcf oled1_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
952
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
953 rrcf oled4_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
954 rrcf oled1_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
955
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
956 rrcf oled4_temp,F
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
957 rrcf oled1_temp,F ; Red done.
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
958
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
959 movff oled1_temp,win_color1
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
960 movff oled3_temp,win_color2 ; Set Bank0 Color registers...
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
961 return
96a35aeda5f2 Initial setup
heinrichsweikamp
parents:
diff changeset
962