Mercurial > public > hwos_code
comparison src/start.asm @ 449:850c1f3c4824
minor
author | heinrichsweikamp |
---|---|
date | Wed, 31 Aug 2016 14:24:29 +0200 |
parents | 77259baf89e2 |
children | b4417044a042 |
comparison
equal
deleted
inserted
replaced
448:aadfe9f2edaf | 449:850c1f3c4824 |
---|---|
50 cpfseq FSR0H ; Bank 14 done? | 50 cpfseq FSR0H ; Bank 14 done? |
51 bra clear_rambank ; clear... | 51 bra clear_rambank ; clear... |
52 | 52 |
53 call init_ostc | 53 call init_ostc |
54 | 54 |
55 ; Get button type from Bootloader-Info | |
56 bsf analog_switches | |
57 movlw 0x7C | |
58 movwf TBLPTRL | |
59 movlw 0xF7 | |
60 movwf TBLPTRH | |
61 movlw 0x01 | |
62 movwf TBLPTRU | |
63 TBLRD*+ ; Reads 0x07 for analog buttons | |
64 movlw 0x07 | |
65 cpfseq TABLAT | |
66 bcf analog_switches | |
67 | |
55 ; Air pressure compensation after reset | 68 ; Air pressure compensation after reset |
56 call get_calibration_data ; Get calibration data from pressure sensor | 69 call get_calibration_data ; Get calibration data from pressure sensor |
57 banksel common ; get_calibration_data uses isr_backup | 70 banksel common ; get_calibration_data uses isr_backup |
58 bcf no_sensor_int ; normal sensor interrupt mode | 71 bcf no_sensor_int ; normal sensor interrupt mode |
59 | 72 |
143 global power_on_return | 156 global power_on_return |
144 power_on_return: | 157 power_on_return: |
145 bsf RCON,POR ; Set bit for next detection | 158 bsf RCON,POR ; Set bit for next detection |
146 | 159 |
147 call lt2942_get_status ; Check for gauge IC | 160 call lt2942_get_status ; Check for gauge IC |
148 btfss rechargeable ; cR or 2 hardware? | 161 btfss battery_gauge_available ; cR or 2 hardware? |
149 bra power_on_return2 ; no | 162 bra power_on_return2 ; no |
150 | 163 |
151 movlw .30 | 164 movlw .30 |
152 movff WREG,opt_cR_button_right | 165 movff WREG,opt_cR_button_right |
153 movff WREG,opt_cR_button_left ; Reset on power-on reset | 166 movff WREG,opt_cR_button_left ; Reset on power-on reset |
264 clrf flag8 | 277 clrf flag8 |
265 clrf flag9 | 278 clrf flag9 |
266 clrf flag10 | 279 clrf flag10 |
267 ; Do not clear flag11 (Sensor calibration and charger status) | 280 ; Do not clear flag11 (Sensor calibration and charger status) |
268 clrf flag12 | 281 clrf flag12 |
269 clrf flag13 | 282 ; ; Do not clear flag13 (Important hardware flags) |
270 clrf hardware_flag ; hardware descriptor flag | 283 clrf hardware_flag ; hardware descriptor flag |
271 bsf tft_is_dimming ; TFT is dimming up (soon), ignore ambient sensor! | 284 bsf tft_is_dimming ; TFT is dimming up (soon), ignore ambient sensor! |
272 | 285 |
273 ; configure hardware_flag byte | 286 ; configure hardware_flag byte |
274 | 287 |
275 bsf ambient_sensor ; Set flag | 288 bsf ambient_sensor ; Set flag |
276 bsf optical_input ; Set flag | 289 bsf optical_input ; Set flag |
277 | 290 |
278 call lt2942_get_status ; Check for gauge IC | 291 call lt2942_get_status ; Check for gauge IC |
279 btfss rechargeable ; cR/2 hardware? | 292 btfss battery_gauge_available ; cR/2 hardware? |
280 bra restart2 ; No | 293 bra restart2 ; No |
281 | 294 |
282 call lt2942_init ; Yes, init battery gauge IC | 295 call lt2942_init ; Yes, init battery gauge IC |
283 bcf optical_input ; Clear flag | 296 bcf optical_input ; Clear flag |
284 | 297 |
305 bsf ble_available ; ble available | 318 bsf ble_available ; ble available |
306 restart3: | 319 restart3: |
307 bsf PORTE,0 ; Stop comms | 320 bsf PORTE,0 ; Stop comms |
308 btfsc ble_available ; ble available? | 321 btfsc ble_available ; ble available? |
309 bra restart4 ; Yes, can't be a cR | 322 bra restart4 ; Yes, can't be a cR |
310 btfss rechargeable ; Rechargeable | 323 btfss battery_gauge_available ; Rechargeable |
311 bra restart4 ; No, can't be a cR | 324 bra restart4 ; No, can't be a cR |
312 bsf analog_o2_input ; Set flag for analog | 325 bsf analog_o2_input ; Set flag for analog |
313 restart4: | 326 restart4: |
314 ; The hardware_flag is now: | 327 ; The hardware_flag is now: |
315 ; 3: 0x0A | 328 ; 3: 0x0A |
329 btfss neg_flag ; Result negative (Ambient>880mbar)? | 342 btfss neg_flag ; Result negative (Ambient>880mbar)? |
330 bsf high_altitude_mode ; No, Set Flag! | 343 bsf high_altitude_mode ; No, Set Flag! |
331 | 344 |
332 btfss analog_o2_input | 345 btfss analog_o2_input |
333 bsf TRISB,3 | 346 bsf TRISB,3 |
334 btfss rechargeable | 347 btfss battery_gauge_available |
335 bsf TRISG,0 | 348 bsf TRISG,0 |
336 call ext_flash_disable_protection ; Disable write protection for external flash | 349 call ext_flash_disable_protection ; Disable write protection for external flash |
337 | 350 |
338 bsf flip_screen ; Flip 180° | 351 bsf flip_screen ; Flip 180° |
339 TSTOSS opt_flip_screen ; =1: Flip the screen | 352 TSTOSS opt_flip_screen ; =1: Flip the screen |