Mercurial > public > hwos_code
changeset 648:aeca5717d9eb
3.17 / 10.72 release
author | heinrichs weikamp |
---|---|
date | Fri, 04 Mar 2022 08:29:36 +0100 |
parents | 357341239438 |
children | ef2ed7e3a895 |
files | src/aa_wordprocessor.asm src/color_processor.asm src/configuration.inc src/eeprom_rs232.asm src/eeprom_rs232.inc src/hwos.asm src/hwos.inc src/menu_tree.asm src/start.asm src/text_english.inc src/text_french.inc src/text_german.inc src/text_italian.inc src/text_multilang.asm src/tft.asm |
diffstat | 15 files changed, 236 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/src/aa_wordprocessor.asm Thu Oct 14 12:04:12 2021 +0200 +++ b/src/aa_wordprocessor.asm Fri Mar 04 08:29:36 2022 +0100 @@ -432,6 +432,10 @@ btfsc screen_type3 ; display 3 ? bra aa_decode_3_display3 ; YES + ; Screen 1 or 0 + btfsc less_io_cpu ; less I/O CPU? + bra aa_decode_3_display0and1_less_io ; YES + movff PRODH,PORTA ; move high byte to PORTA movff PRODL,PORTH ; move low byte to PORTH aa_decode_3_display0and1: @@ -441,6 +445,17 @@ bra aa_decode_3_display0and1; NO - loop bra aa_decode_3_done ; YES - done +aa_decode_3_display0and1_less_io: + movff PRODH,PORTA ; move high byte to PORTA + bcf tft_nwr ; tick + bsf tft_nwr ; ... + movff PRODL,PORTA ; move low byte to PORTA + bcf tft_nwr ; tick + bsf tft_nwr ; ... + decfsz aa_bitlen,F ; decrement length counter, became zero? + bra aa_decode_3_display0and1_less_io; NO - loop + bra aa_decode_3_done ; YES - done + aa_decode_3_display2: movff win_color5,PORTH ; move high byte to PORTH (display is big endian) bcf tft_nwr ; tick
--- a/src/color_processor.asm Thu Oct 14 12:04:12 2021 +0200 +++ b/src/color_processor.asm Fri Mar 04 08:29:36 2022 +0100 @@ -158,7 +158,11 @@ bra color_image_display2 ; YES btfsc screen_type3 ; display type 3 ? bra color_image_display3 ; YES - + + ; Screen 1 + btfsc less_io_cpu ; less I/O CPU? + bra color_image_pixel1_loop_less_io ; YES + movff PRODH,PORTA ; NO - move color high byte to PORTA movff PRODL,PORTH ; - move color low byte to PORTH @@ -171,6 +175,19 @@ bra color_image_pixel1_loop ; loop if not zero bra color_image_pixel_com ; all pixels transmitted +color_image_pixel1_loop_less_io: + movff PRODH,PORTA ; NO - move color high byte to PORTA + bcf tft_nwr ; toggle write signal + bsf tft_nwr ; ... + movff PRODL,PORTA ; - move color low byte to PORTH + bcf tft_nwr ; toggle write signal + bsf tft_nwr ; ... + decfsz pixel_count+0 ; decrement pixel counter, low byte + bra color_image_pixel1_loop_less_io ; loop if not zero + decfsz pixel_count+1 ; decrement pixel counter, high byte + bra color_image_pixel1_loop_less_io ; loop if not zero + bra color_image_pixel_com ; all pixels transmitted + color_image_display2: call convert_for_display2 ; convert 16 bit RGB b'RRRRRGGG GGGBBBBB' ; into 24 bit RGB b'RRRRRR00 GGGGGG00 BBBBBB00'
--- a/src/configuration.inc Thu Oct 14 12:04:12 2021 +0200 +++ b/src/configuration.inc Fri Mar 04 08:29:36 2022 +0100 @@ -24,7 +24,7 @@ #endif #define fw_version_major 0x03 -#define fw_version_minor 0x10 +#define fw_version_minor 0x11 #define fw_version_beta 0x00 @@ -42,11 +42,11 @@ ; #endif -#define firmware_creation_year 0x15 -#define firmware_creation_month 0x0A -#define firmware_creation_day 0x0E +#define firmware_creation_year 0x16 +#define firmware_creation_month 0x01 +#define firmware_creation_day 0x15 -#define firmware_expire_year 0x17 +#define firmware_expire_year 0x18 #define firmware_expire_month 0x0A #define firmware_expire_day 0x0E
--- a/src/eeprom_rs232.asm Thu Oct 14 12:04:12 2021 +0200 +++ b/src/eeprom_rs232.asm Fri Mar 04 08:29:36 2022 +0100 @@ -491,4 +491,67 @@ ;----------------------------------------------------------------------------- +;----------------------------------------------------------------------------- +; Add new services and characteristics to new BLE (type 2) module +;----------------------------------------------------------------------------- + global ble2_configure +ble2_configure: + rcall enable_rs232 + bcf NCTS ; Clear to send + call wait_1s + call wait_1s + bcf PORTB,6 + bsf PORTB,6 ; rising edge -> Command mode + + ; point to config table + movlw LOW ble_AT1 + movwf TBLPTRL + movlw HIGH ble_AT1 + movwf TBLPTRH + movlw UPPER ble_AT1 + movwf TBLPTRU + rcall ble_init_loop + + rcall disable_rs232 + bcf PORTB,6 ; keep low for min. current consumption + return ; done. + +ble_init_loop: + TBLRD*+ + movlw 0xFF ; end + cpfseq TABLAT + bra ble_init_loop1 ; not end + ; quit (return) + return ; done. +ble_init_loop1: + movlw 0xFE ; WAIT 20ms + cpfseq TABLAT + bra ble_init_loop2 ; not wait 20ms + WAITMS d'20' + bra ble_init_loop +ble_init_loop2: + movlw 0xFD ; WAIT 1s + cpfseq TABLAT + bra ble_init_loop3 ; not wait 1s + call wait_1s + bra ble_init_loop +ble_init_loop3: + movf TABLAT,W + SERIAL_CC_SEND WREG + bra ble_init_loop + +ble_AT1: ; config table + ; 0xFF at the end + ; 0xFE: 20ms delay + ; 0xFD: 1s delay + ; .13: cr character + db 0xFD,0xFD ; Wait 2 seconds + db "AT+UDSC=0,0",.13,0xFE,0xFE ; Disable SPP Server on ID0 (and wait 40ms) + db "AT+UDSC=0,3",.13,0xFE,0xFE ; SPP Server on ID0 (and wait 40ms) + db "AT+UDSC=1,0",.13,0xFE,0xFE ; Disable SPS Server on ID1 (and wait 40ms) + db "AT+UDSC=1,6",.13,0xFE,0xFE ; SPS Server on ID1 (and wait 40ms) + db "AT&W",.13,0xFE ; write settings into eeprom (and wait 20ms) + db "AT+CPWROFF",.13,0xFD,0xFD,0xFF ; save and reboot (and wait 2 seconds) + + END
--- a/src/eeprom_rs232.inc Thu Oct 14 12:04:12 2021 +0200 +++ b/src/eeprom_rs232.inc Fri Mar 04 08:29:36 2022 +0100 @@ -337,6 +337,7 @@ extern enable_rs232 extern disable_rs232 extern rs232_wait_tx + extern ble2_configure ENDIF ; INSIDE_EEPROM_RS232
--- a/src/hwos.asm Thu Oct 14 12:04:12 2021 +0200 +++ b/src/hwos.asm Fri Mar 04 08:29:36 2022 +0100 @@ -463,8 +463,10 @@ global power_up_switches power_up_switches: bsf power_sw1 ; switch on power supply for switch 1 - btfss power_sw1 ; power established? - bra $-4 ; NO - wait + + ; power_sw1 not available in less pin CPU, do not use +; btfss power_sw1 ; power established? +; bra $-4 ; NO - wait bsf power_sw2 ; switch on power supply for switch 2 btfss power_sw2 ; power established? @@ -618,7 +620,9 @@ movwf TBLPTRH ; ... movlw 0x3F ; ... movwf TBLPTRU ; ... - TBLRD*+ ; read DEVID1 byte + TBLRD*+ ; read DEVID1 byte + btfss TABLAT,6 + bsf less_io_cpu ; Less I/O CPU found movlw b'00011111' ; load mask for silicon version andwf TABLAT,W ; apply mask and store result in WREG return ; done
--- a/src/hwos.inc Thu Oct 14 12:04:12 2021 +0200 +++ b/src/hwos.inc Fri Mar 04 08:29:36 2022 +0100 @@ -473,7 +473,7 @@ #DEFINE ext_input_optical HW_descriptor,3 ; =1: OSTC has optical input #DEFINE ble_available HW_descriptor,4 ; =1: OSTC has an BT module #DEFINE ostc_rx_present HW_descriptor,5 ; =1: OSTC has RX module -#DEFINE lv_core HW_descriptor,6 ; =1: OSTC has low-voltage core (2.7V) +#DEFINE lv_core HW_descriptor,6 ; =1: OSTC has low-voltage core (2.7V) #DEFINE flash_block_write HW_descriptor,7 ; =1: OSTC has FLASH with block-write capability ;---- Hardware - OSTC Model Variants (stored in access RAM, NOT cleared in restart) @@ -488,7 +488,7 @@ ;---- Hardware - OSTC Model Variants2 (stored in access RAM, NOT cleared in restart) #DEFINE press_sensor_type HW_variants2,0 ; =1: pressure sensor MS5837, =0: Pressure sensor MS5541 -; HW_variants2,1 ; --- unused +#DEFINE less_io_cpu HW_variants2,1 ; =1: OSTC has a CPU with less I/O pins ; HW_variants2,2 ; --- unused ; HW_variants2,3 ; --- unused ; HW_variants2,4 ; --- unused
--- a/src/menu_tree.asm Thu Oct 14 12:04:12 2021 +0200 +++ b/src/menu_tree.asm Fri Mar 04 08:29:36 2022 +0100 @@ -1313,15 +1313,18 @@ STRCAT_TEXT tHardware ; print text call I2C_init_compass ; start compass to get compass configuration movf HW_descriptor,W ; copy hardware descriptor to WREG - output_hex ; print as hex + output_hex ; print as hex movf HW_variants,W ; copy hardware variants to WREG - output_hex ; print as hex - PUTC "-" ; print a separator - movlw FW_CONF ; get firmware configuration - output_hex ; print as hex + output_hex ; print as hex + PUTC "-" ; print a separator + movlw FW_CONF ; get firmware configuration + output_hex ; print as hex call get_cpu_version ; get CPU version - output_hex ; print as hex - return ; done + output_hex ; print as hex + btfss less_io_cpu ; =1: OSTC has a CPU with less I/O pins + return ; Done. + PUTC "*" + return ; Less I/O CPU done. ;----------------------------------------------------------------------------- @@ -1858,13 +1861,14 @@ ; Settings Menu - 3rd Layer - System Settings - Reset Menus ; do_menu_reset: - MENU_BEGIN tResetMenu, .6 + MENU_BEGIN tResetMenu, .7 MENU_CALL tBack, do_return_menu_syssets_more MENU_CALL tReboot, do_menu_reset_reboot ; confirm MENU_CALL tResetDeco, do_menu_reset_deco ; confirm MENU_CALL tResetSettings, do_menu_reset_settings ; confirm MENU_CALL tResetLogbook, do_menu_reset_logbook ; confirm MENU_CALL tResetBattery, do_menu_reset_battery ; confirm + MENU_CALL tResetBLE2, do_menu_reset_ble2 ; Configure the new BLE module MENU_END @@ -2062,6 +2066,14 @@ MENU_CALL tAbort, do_return_menu_syssets_more_more MENU_CALL tYes, do_new_battery_select MENU_END + +;----------------------------------------------------------------------------- +; Settings Menu - 4th Layer - System Settings - Reset - Reset BLE2 +; +do_menu_reset_ble2: + call TFT_ClearScreen ; clear screen to show start of activity + call ble2_configure + goto surfloop ; restart into surface mode ;-----------------------------------------------------------------------------
--- a/src/start.asm Thu Oct 14 12:04:12 2021 +0200 +++ b/src/start.asm Fri Mar 04 08:29:36 2022 +0100 @@ -44,6 +44,7 @@ extern oFirmwareMajor extern oFirmwareMinor extern oPressureAdjust + extern get_cpu_version IFDEF _ccr_pscr extern option_cleanup_oCCRMode_pSCR @@ -120,6 +121,9 @@ ; initialize hardware (ports, timers) and start interrupts call init_ostc ; also selects bank common and sets CPU to normal speed + + ; get CPU type and set less_io_cpu bit + call get_cpu_version ; flag that later restart origins from a cold start bsf cold_start @@ -160,7 +164,7 @@ ; initialize pressure sensor calibration call I2C_probe_pressure_sensor ; Probe the type of sensor, set/clear press_sensor_type call get_calibration_data ; get calibration data from pressure sensor - + call TFT_DisplayOff ; turn off display bsf LEDr ; turn on red LED @@ -379,6 +383,8 @@ bsf lightsen_power ; power-up ambient light sensor again restart2: + btfsc less_io_cpu ; Less I/O CPU found? + bsf ble_available ; Yes, must have BLE (old or new) IFNDEF _hwos_sport btfsc vusb_in ; USB power detected? bra restart3 ; YES - no BT then
--- a/src/text_english.inc Thu Oct 14 12:04:12 2021 +0200 +++ b/src/text_english.inc Fri Mar 04 08:29:36 2022 +0100 @@ -556,6 +556,7 @@ TCODE tResetDeco, "Reset Deco" ; Reset Deco TCODE tResetBattery, "Reset Battery" ; Reset Battery TCODE tResetLogbook, "Reset Logbook" ; Reset Logbook + TCODE tResetBLE2, "Reset Bluetooth" ; Reset Bluetooth IFDEF _firmware_recovery TCODE tRebootCurFirmware, "Reboot current FW" ; Reboot current Firmware
--- a/src/text_french.inc Thu Oct 14 12:04:12 2021 +0200 +++ b/src/text_french.inc Fri Mar 04 08:29:36 2022 +0100 @@ -556,6 +556,7 @@ TCODE tResetDeco, "RaZ Déco" ; Reset Deco TCODE tResetBattery, "RaZ Batterie" ; Reset Battery TCODE tResetLogbook, "RaZ Carnet" ; Reset Logbook + TCODE tResetBLE2, "RaZ Bluetooth" ; Reset Bluetooth IFDEF _firmware_recovery TCODE tRebootCurFirmware, "Reboot current FW" ; Reboot current Firmware
--- a/src/text_german.inc Thu Oct 14 12:04:12 2021 +0200 +++ b/src/text_german.inc Fri Mar 04 08:29:36 2022 +0100 @@ -556,6 +556,7 @@ TCODE tResetDeco, "Reset Deko" ; Reset Deco TCODE tResetBattery, "neue Batterie" ; Reset Battery TCODE tResetLogbook, "Logbuch löschen" ; Reset Logbook + TCODE tResetBLE2, "Reset Bluetooth" ; Reset Bluetooth IFDEF _firmware_recovery TCODE tRebootCurFirmware, "Reboot aktuelle FW" ; Reboot current Firmware
--- a/src/text_italian.inc Thu Oct 14 12:04:12 2021 +0200 +++ b/src/text_italian.inc Fri Mar 04 08:29:36 2022 +0100 @@ -556,6 +556,7 @@ TCODE tResetDeco, "Azzera Deco" ; Reset Deco TCODE tResetBattery, "Azzera Batteria" ; Reset Battery TCODE tResetLogbook, "Azzera Logbook" ; Reset Logbook + TCODE tResetBLE2, "Azzera Bluetooth" ; Reset Bluetooth IFDEF _firmware_recovery TCODE tRebootCurFirmware, "Reboot current FW" ; Reboot current Firmware
--- a/src/text_multilang.asm Thu Oct 14 12:04:12 2021 +0200 +++ b/src/text_multilang.asm Fri Mar 04 08:29:36 2022 +0100 @@ -21,11 +21,11 @@ ; fast hack **ONLY** for **CHANGING** languages ( en / de / fr / it ) -#undefine _language_1 -#define _language_1 fr +;#undefine _language_1 +;#define _language_1 fr -#undefine _language_2 -#define _language_2 it +;#undefine _language_2 +;#define _language_2 it ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--- a/src/tft.asm Thu Oct 14 12:04:12 2021 +0200 +++ b/src/tft.asm Fri Mar 04 08:29:36 2022 +0100 @@ -94,7 +94,11 @@ RD_H ; not read RS_H ; data NCS_L ; not CS - clrf PORTH ; data lower + + btfsc less_io_cpu ; less I/O CPU? + clrf PORTA ; YES, data lower + btfss less_io_cpu ; less I/O CPU? + clrf PORTH ; NO, data lower movlw d'10' movwf tft_temp3 @@ -107,6 +111,15 @@ TFT_ClearScreen4: WR_L WR_H ; tick + btfss less_io_cpu ; less I/O CPU? + bra TFT_ClearScreen5 ; NO + WR_L + WR_H ; tick + WR_L + WR_H ; tick + WR_L + WR_H ; tick +TFT_ClearScreen5: decfsz tft_temp1,F bra TFT_ClearScreen4 bsf INTCON,GIE @@ -339,7 +352,8 @@ movwf TBLPTRH movlw UPPER display0_config_table movwf TBLPTRU - bcf screen_type1 + btfss less_io_cpu ; less I/O CPU? + bcf screen_type1 ; NO TFT_boot_com: rcall display0_init_loop @@ -483,6 +497,8 @@ ; bra TFT_CmdWrite_screen2 clrf PORTA ; upper bcf INTCON,GIE + btfsc less_io_cpu ; less I/O CPU? + bra TFT_CmdWrite_less_io ; YES movwf PORTH ; lower WR_L WR_H ; tick @@ -494,12 +510,23 @@ ; WR_H ; tick ; return; +TFT_CmdWrite_less_io: + WR_L + WR_H ; tick + movwf PORTA ; lower + WR_L + WR_H ; tick + bsf INTCON,GIE + return + global TFT_DataWrite TFT_DataWrite: RS_H ; data ; btfsc screen_type2 ; bra TFT_DataWrite_screen2 bcf INTCON,GIE + btfsc less_io_cpu ; less I/O CPU? + bra TFT_DataWrite_less_io ; YES movwf PORTH ; lower WR_L WR_H ; tick @@ -510,6 +537,14 @@ ; WR_L ; WR_H ; tick ; return +TFT_DataWrite_less_io: + WR_L + WR_H ; tick + movwf PORTA ; lower + WR_L + WR_H ; tick + bsf INTCON,GIE + return ;----------------------------------------------------------------------------- @@ -751,13 +786,24 @@ Index_out 0x22 ; frame memory data write start RS_H ; data bcf INTCON,GIE - movff win_color1,PORTA ; upper - movff win_color2,PORTH ; lower + movff win_color1,PORTA ; upper + btfsc less_io_cpu ; less I/O CPU? + bra half_pixel_write_1_display1_l_io ; YES + movff win_color2,PORTH ; lower WR_L - WR_H ; tick + WR_H ; tick bsf INTCON,GIE return +half_pixel_write_1_display1_l_io: + WR_L + WR_H ; tick + movff win_color2,PORTA ; lower + WR_L + WR_H ; tick + bsf INTCON,GIE + return + half_pixel_write_1_display2: mullw 1 ; copy row to PRODL (PRODH=0) ; Row address start @@ -880,12 +926,23 @@ bra TFT_DataWrite_PROD_display2 ; YES bcf INTCON,GIE ; NO - movff PRODH,PORTA ; - move high byte to PORTA + btfsc less_io_cpu ; less I/O CPU? + bra TFT_DataWrite_PROD_less_io ; YES movff PRODL,PORTH ; - move low byte to PORTH WR_L ; - tick WR_H ; - tack bsf INTCON,GIE ; - return ; - done +TFT_DataWrite_PROD_less_io: + WR_L + WR_H ; tick + movff PRODL,PORTA ; - move low byte to PORTH + WR_L ; - tick + WR_H ; - tack + bsf INTCON,GIE ; - + return ; - done + TFT_DataWrite_PROD_display2: movff PRODH,PORTH ; move high byte to PORTH (display 2 is big endian) WR_L ; tick @@ -1228,6 +1285,8 @@ TFT_box3: ; loop width times bcf INTCON,GIE movff win_color1,PORTA ; upper + btfsc less_io_cpu ; less I/O CPU? + bra TFT_box3_less_io ; YES movff win_color2,PORTH ; lower WR_L ; tick WR_H ; ... @@ -1255,6 +1314,30 @@ setf win_bargraph return +TFT_box3_less_io: + WR_L ; tick + WR_H ; ... + movff win_color2,PORTA ; lower + WR_L ; tick + WR_H ; ... + movff win_color1,PORTA ; upper + WR_L ; tick + WR_H ; ... + movff win_color2,PORTA ; lower + WR_L ; tick + WR_H ; ... + bsf INTCON,GIE + decfsz PRODL,F ; row loop finished ? + bra TFT_box3 ; NO - continue + + incf PRODH,F ; column count ++ + movf win_bargraph,W ; get width of active bargraph part + cpfseq PRODH ; current column == end of active bargraph ? + bra TFT_box4 ; NO - just loop + clrf win_color1 ; YES - switch to black + clrf win_color2 ; - ... + bra TFT_box4 ; NO - just loop + TFT_box_display2: ; Screen 2 movff win_color1,PRODH @@ -1440,7 +1523,8 @@ rrcf tft_temp4,F rrcf tft_temp1,W ; red done - movwf win_color1 ; set color registers + ; tft_temp1 (b'RRRRRGGG') done + movwf win_color1 ; set color registers... return