Mercurial > public > hwos_code
changeset 449:850c1f3c4824
minor
author | heinrichsweikamp |
---|---|
date | Wed, 31 Aug 2016 14:24:29 +0200 |
parents | aadfe9f2edaf |
children | 791a25c4aab4 |
files | src/i2c.asm src/start.asm |
diffstat | 2 files changed, 33 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/i2c.asm Tue Aug 30 17:26:21 2016 +0200 +++ b/src/i2c.asm Wed Aug 31 14:24:29 2016 +0200 @@ -777,7 +777,7 @@ clrf batt_percent ; Set to zero btfsc neg_flag ; result negative? - return ; Yes, done. + bra lt2942_set_to_zero_percent ; Yes, keep LT2942 at zero percent and return ; > Zero, set batt_percent properly movff sub_c+0,xA+0 @@ -788,6 +788,19 @@ movff xC+0,batt_percent return +lt2942_set_to_zero_percent: + clrf i2c_temp + movlw 0x02 ; Point to accumulated charge registers + rcall I2C_TX_GAUGE + movff battery_offset+1,SSP1BUF + rcall WaitMSSP + rcall I2C_WaitforACK + movff battery_offset+0,SSP1BUF + rcall WaitMSSP + rcall I2C_WaitforACK + bsf SSP1CON2,PEN ; Stop condition + bra WaitMSSP; (and return) + global lt2942_charge_done lt2942_charge_done: ; Reset accumulating registers to 0xFFFF clrf i2c_temp
--- a/src/start.asm Tue Aug 30 17:26:21 2016 +0200 +++ b/src/start.asm Wed Aug 31 14:24:29 2016 +0200 @@ -52,6 +52,19 @@ call init_ostc + ; Get button type from Bootloader-Info + bsf analog_switches + movlw 0x7C + movwf TBLPTRL + movlw 0xF7 + movwf TBLPTRH + movlw 0x01 + movwf TBLPTRU + TBLRD*+ ; Reads 0x07 for analog buttons + movlw 0x07 + cpfseq TABLAT + bcf analog_switches + ; Air pressure compensation after reset call get_calibration_data ; Get calibration data from pressure sensor banksel common ; get_calibration_data uses isr_backup @@ -145,7 +158,7 @@ bsf RCON,POR ; Set bit for next detection call lt2942_get_status ; Check for gauge IC - btfss rechargeable ; cR or 2 hardware? + btfss battery_gauge_available ; cR or 2 hardware? bra power_on_return2 ; no movlw .30 @@ -266,9 +279,9 @@ clrf flag10 ; Do not clear flag11 (Sensor calibration and charger status) clrf flag12 - clrf flag13 +; ; Do not clear flag13 (Important hardware flags) clrf hardware_flag ; hardware descriptor flag - bsf tft_is_dimming ; TFT is dimming up (soon), ignore ambient sensor! + bsf tft_is_dimming ; TFT is dimming up (soon), ignore ambient sensor! ; configure hardware_flag byte @@ -276,7 +289,7 @@ bsf optical_input ; Set flag call lt2942_get_status ; Check for gauge IC - btfss rechargeable ; cR/2 hardware? + btfss battery_gauge_available ; cR/2 hardware? bra restart2 ; No call lt2942_init ; Yes, init battery gauge IC @@ -307,7 +320,7 @@ bsf PORTE,0 ; Stop comms btfsc ble_available ; ble available? bra restart4 ; Yes, can't be a cR - btfss rechargeable ; Rechargeable + btfss battery_gauge_available ; Rechargeable bra restart4 ; No, can't be a cR bsf analog_o2_input ; Set flag for analog restart4: @@ -331,7 +344,7 @@ btfss analog_o2_input bsf TRISB,3 - btfss rechargeable + btfss battery_gauge_available bsf TRISG,0 call ext_flash_disable_protection ; Disable write protection for external flash