comparison src/start.asm @ 640:8c1f1f334275

3.13 release
author heinrichsweikamp
date Thu, 29 Oct 2020 09:29:15 +0100
parents 4050675965ea
children 7d8a4c60ec1a
comparison
equal deleted inserted replaced
639:0ff82370991d 640:8c1f1f334275
1 ;============================================================================= 1 ;=============================================================================
2 ; 2 ;
3 ; File start.asm * combined next generation V3.09.5 3 ; File start.asm * combined next generation V3.11.1
4 ; 4 ;
5 ; Startup subroutines 5 ; Startup subroutines
6 ; 6 ;
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
8 ;============================================================================= 8 ;=============================================================================
317 ; for safety purpose only 317 ; for safety purpose only
318 banksel common ; select bank common 318 banksel common ; select bank common
319 clrf STKPTR ; clear return addresses stack 319 clrf STKPTR ; clear return addresses stack
320 call request_speed_normal ; request CPU speed change to normal speed 320 call request_speed_normal ; request CPU speed change to normal speed
321 321
322 ; switch off backlight
323 clrf CCP1CON ; stop PWM
324 bcf PORTC,2 ; pull PWM out to GND
325 bsf tft_is_dimming ; ignore ambient sensor 322 bsf tft_is_dimming ; ignore ambient sensor
326 323
327 ; clear flag groups 324 ; clear flag groups
328 clrf HW_descriptor ; hardware - OSTC model descriptor 325 clrf HW_descriptor ; hardware - OSTC model descriptor
329 clrf HW_flags_state1 ; hardware - states 326 clrf HW_flags_state1 ; hardware - states
382 btfss battery_gauge_available ; NO - rechargeable? 379 btfss battery_gauge_available ; NO - rechargeable?
383 bra restart4 ; NO - can't be a cR 380 bra restart4 ; NO - can't be a cR
384 bsf ext_input_s8_ana ; YES - it's a cR, S8/analog sensor input available 381 bsf ext_input_s8_ana ; YES - it's a cR, S8/analog sensor input available
385 382
386 restart4: 383 restart4:
387 bsf lv_core ; default to low voltage core 384 ; Do the check for BLE-cR
385 IFDEF _external_sensor
386 bsf mcp_power ; power-up instrumentation amp (used by S8 and analog input)
387 banksel BAUDCON2 ; select bank for IO register access
388 movlw b'00000000' ; speed generator configuration: BRG16=0, normal for S8
389 movwf BAUDCON2 ; ...
390 movlw b'00100000' ; TX configuration: BRGH=0, SYNC=0
391 movwf TXSTA2 ; ...
392 movlw .25 ; speed configuration: SPBRGH:SPBRG = .25 : 9615 BAUD @ 16 MHz
393 movwf SPBRG2 ; ...
394 movlw b'10010000' ; RX configuration
395 movwf RCSTA2 ; ...
396 banksel common ; back to bank common
397 call get_analog_inputs
398 movff sensor1_mv+1,lo
399 movlw .58 ; ~ >1,500V
400 cpfslt lo ; >58 on the high byte -> confident that there is cR circuity
401 bsf ext_input_s8_ana ; YES - it's a cR, S8/analog sensor input available
402 call disable_ir_s8_analog ; power-down circuity again
403 ENDIF
404 bsf lv_core ; default to low voltage core
388 movlw 0x80 ; point to 0x1F780 405 movlw 0x80 ; point to 0x1F780
389 movwf TBLPTRL ; ... 406 movwf TBLPTRL ; ...
390 movlw 0xF7 ; ... 407 movlw 0xF7 ; ...
391 movwf TBLPTRH ; ... 408 movwf TBLPTRH ; ...
392 movlw 0x01 ; ... 409 movlw 0x01 ; ...
404 bcf lv_core ; NO - no low voltage core then 421 bcf lv_core ; NO - no low voltage core then
405 422
406 ; OSTC sport 2019 hardware does not have an optical input 423 ; OSTC sport 2019 hardware does not have an optical input
407 btfsc lv_core ; low voltage core? 424 btfsc lv_core ; low voltage core?
408 bcf ext_input_optical ; YES - no optical input available 425 bcf ext_input_optical ; YES - no optical input available
426 btfsc lv_core ; low voltage core?
427 bcf ext_input_s8_ana ; YES - can't be a cR, S8/analog sensor input disabled
409 428
410 ; check FLASH for block-write capability 429 ; check FLASH for block-write capability
411 bsf flash_block_write ; default to block-write capability available 430 bsf flash_block_write ; default to block-write capability available
412 call ext_flash_read_jedec ; read JEDEC IDs 431 call ext_flash_read_jedec ; read JEDEC IDs
413 movlw 0x26 ; device type 26h supports block-write 432 movlw 0x26 ; device type 26h supports block-write
479 498
480 ENDIF ; _rx_functions 499 ENDIF ; _rx_functions
481 500
482 501
483 restart5: 502 restart5:
503 ; configure button_hold_down_allowed flag
504 btfsc lv_core
505 bsf button_hold_down_allowed,A ; OSTC sport mod. 2019
506 btfsc ext_input_optical
507 bsf button_hold_down_allowed,A ; OSTC3/old sport
508
484 ; manage hardware 509 ; manage hardware
485 btfss ext_input_s8_ana ; OSTC with S8/analog input? 510 btfss ext_input_s8_ana ; OSTC with S8/analog input?
486 bsf TRISB,3 ; NO - shut down power supply for S8 bulkhead 511 bsf TRISB,3 ; NO - shut down power supply for S8 bulkhead
487 512
488 btfss battery_gauge_available ; OSTC with gauge IC? 513 btfss battery_gauge_available ; OSTC with gauge IC?
517 call deco_calc_dive_interval_1min ; - calculate tissues for 1 minute at surface conditions (C-code) 542 call deco_calc_dive_interval_1min ; - calculate tissues for 1 minute at surface conditions (C-code)
518 call deco_calc_desaturation_time ; - calculate desaturation and no-fly/no-altitude time (C-code) 543 call deco_calc_desaturation_time ; - calculate desaturation and no-fly/no-altitude time (C-code)
519 banksel common ; - back to bank common 544 banksel common ; - back to bank common
520 545
521 restart6: 546 restart6:
522 call TFT_load_std_color_pallet ; load standard color pallet 547 btfsc ext_input_s8_ana ; analog sensor input available?
548 bra restart7 ; Yes, continue
549 ; no sensors, reconfigure TRIS and ANSEL bits for AN8
550 bcf TRISF,3
551 banksel 0xF16 ; addresses F16h ... F5Fh are not part of the access RAM
552 bcf ANCON1,0 ; ANSEL1: AN8 -> no analog input
553 banksel common ; back to bank common
554
555 restart7:
523 btfsc divemode ; shall enter dive mode? 556 btfsc divemode ; shall enter dive mode?
524 goto diveloop ; YES - enter dive mode 557 goto diveloop ; YES - enter dive mode
525 btfsc RCON,POR ; NO - was this a power-on reset? 558 btfsc RCON,POR ; NO - was this a power-on reset?
526 goto surfloop ; NO - enter surface mode 559 goto surfloop ; NO - enter surface mode
527 bsf RCON,POR ; YES - acknowledge detection and re-arm detector 560 bsf RCON,POR ; YES - acknowledge detection and re-arm detector