comparison code_part1/OSTC_code_asm_part1/menu.asm @ 681:6e456a6398e0

Hardware4 support
author heinrichsweikamp
date Fri, 25 Jan 2013 18:00:49 +0100
parents cda5b45b953f
children 8ffbd5cb4b42
comparison
equal deleted inserted replaced
680:c6220d340684 681:6e456a6398e0
32 bcf deco_mode_changed ; Clear flag (Description is only showed once) 32 bcf deco_mode_changed ; Clear flag (Description is only showed once)
33 bcf LED_blue 33 bcf LED_blue
34 movlw d'1' 34 movlw d'1'
35 movwf menupos 35 movwf menupos
36 menu2: 36 menu2:
37 call PLED_ClearScreen 37 call DISP_ClearScreen
38 call menu_pre_loop_common ; Clear some menu flags, timeout and switches 38 call menu_pre_loop_common ; Clear some menu flags, timeout and switches
39 call PLED_menu_mask 39 call DISP_menu_mask
40 call PLED_menu_cursor 40 call DISP_menu_cursor
41 41
42 menu_loop: 42 menu_loop:
43 call check_switches_menu 43 call check_switches_menu
44 44
45 btfsc menubit2 45 btfsc menubit2
92 dcfsnz menupos,F 92 dcfsnz menupos,F
93 goto restart ; exit... 93 goto restart ; exit...
94 94
95 refresh_cursor: 95 refresh_cursor:
96 clrf timeout_counter2 96 clrf timeout_counter2
97 call PLED_menu_cursor 97 call DISP_menu_cursor
98 call wait_switches ; Waits until switches are released, resets flag if button stays pressed! 98 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
99 return 99 return
100 100
101 more_menu: 101 more_menu:
102 movlw d'1' 102 movlw d'1'
103 movwf menupos 103 movwf menupos
104 more_menu2: 104 more_menu2:
105 bcf leftbind 105 bcf leftbind
106 call PLED_ClearScreen 106 call DISP_ClearScreen
107 more_menu3: 107 more_menu3:
108 call menu_pre_loop_common ; Clear some menu flags, timeout and switches 108 call menu_pre_loop_common ; Clear some menu flags, timeout and switches
109 call PLED_more_menu_mask 109 call DISP_more_menu_mask
110 call PLED_menu_cursor 110 call DISP_menu_cursor
111 more_menu_loop: 111 more_menu_loop:
112 call check_switches_menu 112 call check_switches_menu
113 113
114 ; movlw d'5' ; 5 items in "More Menu" 114 ; movlw d'5' ; 5 items in "More Menu"
115 ; cpfseq menupos 115 ; cpfseq menupos
116 ; bra more_menu_loop2 116 ; bra more_menu_loop2
117 ; movlw d'6' 117 ; movlw d'6'
118 ; movwf menupos 118 ; movwf menupos
119 ; call PLED_menu_cursor 119 ; call DISP_menu_cursor
120 120
121 ;more_menu_loop2: 121 ;more_menu_loop2:
122 btfsc menubit2 122 btfsc menubit2
123 bra do_more_menu ; call submenu 123 bra do_more_menu ; call submenu
124 124
154 bcf deco_mode_changed ; Clear flag 154 bcf deco_mode_changed ; Clear flag
155 movlw d'1' 155 movlw d'1'
156 movwf menupos 156 movwf menupos
157 setup_menu2: 157 setup_menu2:
158 bcf leftbind 158 bcf leftbind
159 call PLED_ClearScreen 159 call DISP_ClearScreen
160 call PLED_setup_menu_mask 160 call DISP_setup_menu_mask
161 setup_menu3a: 161 setup_menu3a:
162 call menu_pre_loop_common ; Clear some menu flags, timeout and switches 162 call menu_pre_loop_common ; Clear some menu flags, timeout and switches
163 call show_decotype 163 call show_decotype
164 call PLED_menu_cursor 164 call DISP_menu_cursor
165 165
166 setup_menu_loop: 166 setup_menu_loop:
167 call check_switches_menu 167 call check_switches_menu
168 168
169 btfsc menubit2 169 btfsc menubit2
253 253
254 exit_setup_menu: 254 exit_setup_menu:
255 btfss deco_mode_changed ; Was the decomode changed in Setup menu? 255 btfss deco_mode_changed ; Was the decomode changed in Setup menu?
256 goto restart ; No, restart to surfacemode 256 goto restart ; No, restart to surfacemode
257 257
258 call PLED_ClearScreen 258 call DISP_ClearScreen
259 259
260 deco_info_screen1: 260 deco_info_screen1:
261 call PLED_topline_box 261 call DISP_topline_box
262 WIN_INVERT .1 ; Init new Wordprocessor 262 WIN_INVERT .1 ; Init new Wordprocessor
263 DISPLAYTEXT .235 ;Decomode changed! 263 DISPLAYTEXT .235 ;Decomode changed!
264 WIN_INVERT .0 ; Init new Wordprocessor 264 WIN_INVERT .0 ; Init new Wordprocessor
265 265
266 read_int_eeprom d'34' ; Read deco data 266 read_int_eeprom d'34' ; Read deco data
290 more_setup_menu: 290 more_setup_menu:
291 movlw d'1' 291 movlw d'1'
292 movwf menupos 292 movwf menupos
293 more_setup_menu2: 293 more_setup_menu2:
294 bcf leftbind 294 bcf leftbind
295 call PLED_ClearScreen 295 call DISP_ClearScreen
296 call PLED_more_setup_menu_mask 296 call DISP_more_setup_menu_mask
297 more_setup_menu3a: 297 more_setup_menu3a:
298 call menu_pre_loop_common ; Clear some menu flags, timeout and switches 298 call menu_pre_loop_common ; Clear some menu flags, timeout and switches
299 call show_debugstate 299 call show_debugstate
300 call show_dateformat 300 call show_dateformat
301 call show_salinity_value 301 call show_salinity_value
302 call PLED_menu_cursor 302 call DISP_menu_cursor
303 call toggle_brightness_show 303 call toggle_brightness_show
304 304
305 more_setup_menu_loop: 305 more_setup_menu_loop:
306 call check_switches_menu 306 call check_switches_menu
307 307
308 ; movlw d'5' ; x-1 menu entries 308 ; movlw d'5' ; x-1 menu entries
309 ; cpfseq menupos 309 ; cpfseq menupos
310 ; bra more_setup_menu_loop2 310 ; bra more_setup_menu_loop2
311 ; movlw d'6' 311 ; movlw d'6'
312 ; movwf menupos 312 ; movwf menupos
313 ; call PLED_menu_cursor 313 ; call DISP_menu_cursor
314 ;more_setup_menu_loop2: 314 ;more_setup_menu_loop2:
315 ; 315 ;
316 btfsc menubit2 316 btfsc menubit2
317 bra do_more_setup_menu ; call submenu 317 bra do_more_setup_menu ; call submenu
318 318
437 437
438 toggle_brightness: 438 toggle_brightness:
439 movlw LOW 0x103 439 movlw LOW 0x103
440 movwf EEADR 440 movwf EEADR
441 movlw HIGH 0x103 441 movlw HIGH 0x103
442 movwf EEADRH ; OLED brightness (=0: Eco, =1: High) 442 movwf EEADRH ; DISPLAY brightness (=0: Eco, =1: High)
443 call read_eeprom ; read byte 443 call read_eeprom ; read byte
444 bcf oled_brightness_high ; Eco mode 444 bcf DISPLAY_brightness_high ; Eco mode
445 movlw .0 445 movlw .0
446 cpfseq EEDATA ; High? 446 cpfseq EEDATA ; High?
447 bsf oled_brightness_high ; Yes! 447 bsf DISPLAY_brightness_high ; Yes!
448 448
449 ; Value loaded, now toggle it... 449 ; Value loaded, now toggle it...
450 btg oled_brightness_high 450 btg DISPLAY_brightness_high
451 451
452 ; ...Display it... 452 ; ...Display it...
453 rcall toggle_brightness_show 453 rcall toggle_brightness_show
454 call PLED_brightness_full ; Set OLED 454 call DISP_brightness_full ; Set DISPLAY
455 455
456 ; ...and write it again to EEPROM 456 ; ...and write it again to EEPROM
457 movlw LOW 0x103 457 movlw LOW 0x103
458 movwf EEADR 458 movwf EEADR
459 movlw HIGH 0x103 459 movlw HIGH 0x103
460 movwf EEADRH ; OLED brightness (=0: Eco, =1: High) 460 movwf EEADRH ; DISPLAY brightness (=0: Eco, =1: High)
461 movlw .0 461 movlw .0
462 btfsc oled_brightness_high 462 btfsc DISPLAY_brightness_high
463 movlw .1 463 movlw .1
464 movwf EEDATA 464 movwf EEDATA
465 call write_eeprom ; write byte 465 call write_eeprom ; write byte
466 clrf EEADRH ; Reset EEADRH 466 clrf EEADRH ; Reset EEADRH
467 467
469 movwf menupos 469 movwf menupos
470 bcf switch_right 470 bcf switch_right
471 bra more_setup_menu3a ; return to menu loop 471 bra more_setup_menu3a ; return to menu loop
472 472
473 toggle_brightness_show: 473 toggle_brightness_show:
474 btfsc oled_brightness_high 474 btfsc DISPLAY_brightness_high
475 bra toggle_brightness_show2 475 bra toggle_brightness_show2
476 DISPLAYTEXTH .312 ; Eco 476 DISPLAYTEXTH .312 ; Eco
477 return 477 return
478 toggle_brightness_show2: 478 toggle_brightness_show2:
479 DISPLAYTEXTH .313 ; High 479 DISPLAYTEXTH .313 ; High