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