summaryrefslogtreecommitdiff
path: root/software/ihu/ihu.asm
diff options
context:
space:
mode:
Diffstat (limited to 'software/ihu/ihu.asm')
-rw-r--r--software/ihu/ihu.asm16
1 files changed, 14 insertions, 2 deletions
diff --git a/software/ihu/ihu.asm b/software/ihu/ihu.asm
index 1b483e1..b9cbdad 100644
--- a/software/ihu/ihu.asm
+++ b/software/ihu/ihu.asm
@@ -145,6 +145,7 @@ STATUS_TEMP EQU H'007F'
goto interrupt_end
int_ctr
+ ;; TODO: get byte from CTR (via SPI)
bcf INTCON,INTF
goto interrupt_end
@@ -152,6 +153,13 @@ int_ctr
int_portchange
btfsc RTC_RST
call rtc_init
+ btfsc BAT_INT
+ goto int_bat
+ bcf INTCON,RBIF
+ goto interrupt_end
+
+int_bat
+ ;; TODO: get byte from BAT (via SPI)
bcf INTCON,RBIF
goto interrupt_end
@@ -197,8 +205,8 @@ init
bcf STATUS,RP1
movlw b'00111111' ; Weak Pull-UPS for
movwf WPUB ; RTC_RST, DEPLOY, CAPGOOD, POWER_FAIL, BAT_INT, CTR_INT
- movlw b'00100000' ; Port Change Interrup on
- movwf IOCB ; RTC_RST
+ movlw b'00101000' ; Port Change Interrup on
+ movwf IOCB ; RTC_RST, BAT_INT
movlw b'00000010' ; Weak-Pull-UPs enabled, INT -> falling edge, TMR0 internal clock
movwf OPTION_REG ; Prescaler @ TMR0, Prescaler 1:8
clrf PSTRCON ; disable pulse steering
@@ -240,6 +248,7 @@ init
movwf INTCON
call i2c_init
+ call spi_init
clrf TMR0
clrf TMP
bsf INTCON,GIE
@@ -278,6 +287,9 @@ wait_loop
include "rtc.inc"
;; -------------------------------------
+ include "spi.inc"
+
+ ;; -------------------------------------
;; include "temp.inc"
;; -------------------------------------