comparison src/eeprom_rs232.asm @ 654:75e90cd0c2c3

hwOS sport 10.77 release
author heinrichsweikamp
date Thu, 14 Mar 2024 16:56:46 +0100
parents bc214815deb2
children 8af5aefbcdaf
comparison
equal deleted inserted replaced
653:8bcd138ab744 654:75e90cd0c2c3
2 ; 2 ;
3 ; File eeprom_rs232.asm * combined next generation V3.09.4n 3 ; File eeprom_rs232.asm * combined next generation V3.09.4n
4 ; 4 ;
5 ; Internal EEPROM, RS232 5 ; Internal EEPROM, RS232
6 ; 6 ;
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. 7 ; Copyright (c) 2011, JD Gascuel, heinrichs weikamp gmbh, all right reserved.
8 ;============================================================================= 8 ;=============================================================================
9 ; HISTORY 9 ; HISTORY
10 ; 2011-08-06 : [mH] moving from OSTC code 10 ; 2011-08-06 : [mH] moving from OSTC code
11 11
12 #include "hwos.inc" 12 #include "hwos.inc"
158 eeprom_battery_gauge_read: 158 eeprom_battery_gauge_read:
159 ; retrieve battery gauge from EEPROM 0x07-0x0C 159 ; retrieve battery gauge from EEPROM 0x07-0x0C
160 bsf block_battery_gauge ; suspend ISR from accessing the battery gauge 160 bsf block_battery_gauge ; suspend ISR from accessing the battery gauge
161 EEPROM_CC_READ eeprom_battery_type, battery_type ; 1 byte read from EEPROM 161 EEPROM_CC_READ eeprom_battery_type, battery_type ; 1 byte read from EEPROM
162 EEPROM_RR_READ eeprom_battery_gauge,battery_gauge,.6 ; 6 byte read from EEPROM 162 EEPROM_RR_READ eeprom_battery_gauge,battery_gauge,.6 ; 6 byte read from EEPROM
163 EEPROM_RR_READ eeprom_charge_cycles,charge_cycles,.2 ; 2 byte read from EEPROM
163 bcf block_battery_gauge ; allow ISR to access the battery gauge again 164 bcf block_battery_gauge ; allow ISR to access the battery gauge again
164 return ; done 165 return ; done
165 166
166 global eeprom_battery_gauge_write 167 global eeprom_battery_gauge_write
167 eeprom_battery_gauge_write: 168 eeprom_battery_gauge_write:
168 bsf block_battery_gauge ; suspend ISR from accessing the battery gauge 169 bsf block_battery_gauge ; suspend ISR from accessing the battery gauge
169 EEPROM_CC_WRITE battery_type, eeprom_battery_type ; 1 byte write to EEPROM 170 EEPROM_CC_WRITE battery_type, eeprom_battery_type ; 1 byte write to EEPROM
170 update_battery_gauge: 171 update_battery_gauge:
171 EEPROM_RR_WRITE battery_gauge,eeprom_battery_gauge,.6 ; 6 byte write to EEPROM 172 EEPROM_RR_WRITE battery_gauge,eeprom_battery_gauge,.6 ; 6 byte write to EEPROM
173 EEPROM_RR_WRITE charge_cycles,eeprom_charge_cycles,.2 ; 2 byte write to EEPROM
172 bcf block_battery_gauge ; allow ISR to access the battery gauge again 174 bcf block_battery_gauge ; allow ISR to access the battery gauge again
173 return ; done 175 return ; done
174 176
175 177
176 ;----------------------------------------------------------------------------- 178 ;-----------------------------------------------------------------------------
364 call request_speed_normal ; request CPU speed change to normal speed 366 call request_speed_normal ; request CPU speed change to normal speed
365 enable_rs232_1: 367 enable_rs232_1:
366 btfss speed_is_normal ; speed = normal? 368 btfss speed_is_normal ; speed = normal?
367 bra enable_rs232_1 ; NO - loop waiting for ISR to have adjusted the speed 369 bra enable_rs232_1 ; NO - loop waiting for ISR to have adjusted the speed
368 bsf TRISC,7 370 bsf TRISC,7
369 bcf PORTE,0 ; YES - switch port to comm 371 bcf ble_npower ; YES - switch port to comm
370 bsf PORTJ,2 ; - /Reset (required for very old OSTC sport) 372 bsf PORTJ,2 ; - /Reset (required for very old OSTC sport)
371 movlw b'00100100' ; - TX configuration: TX enabled, async, high speed 373 movlw b'00100100' ; - TX configuration: TX enabled, async, high speed
372 movwf TXSTA1 ; - ... 374 movwf TXSTA1 ; - ...
373 movlw b'10010000' ; - RX configuration: port enabled, RX enabled 375 movlw b'10010000' ; - RX configuration: port enabled, RX enabled
374 movwf RCSTA1 ; - ... 376 movwf RCSTA1 ; - ...
400 global disable_rs232 402 global disable_rs232
401 disable_rs232: 403 disable_rs232:
402 clrf RCSTA1 ; disable RX 404 clrf RCSTA1 ; disable RX
403 clrf TXSTA1 ; disable TX 405 clrf TXSTA1 ; disable TX
404 bcf PORTC,6 ; switch TX pin hard to GND 406 bcf PORTC,6 ; switch TX pin hard to GND
405 bsf PORTE,0 ; power down BT chip 407 bsf ble_npower ; power down BT chip
406 bcf PORTJ,2 ; /Reset (required for very old OSTC sport) 408 bcf PORTJ,2 ; /Reset (required for very old OSTC sport)
407 bcf TRISC,7 409 bcf TRISC,7
408 bcf PORTC,7 ; switch RX pin hard to GND 410 bcf PORTC,7 ; switch RX pin hard to GND
409 return 411 return
410 412