summaryrefslogtreecommitdiff
path: root/software/ihu/ttx.inc
diff options
context:
space:
mode:
Diffstat (limited to 'software/ihu/ttx.inc')
-rw-r--r--software/ihu/ttx.inc23
1 files changed, 19 insertions, 4 deletions
diff --git a/software/ihu/ttx.inc b/software/ihu/ttx.inc
index b9f45e7..2098340 100644
--- a/software/ihu/ttx.inc
+++ b/software/ihu/ttx.inc
@@ -108,7 +108,7 @@ ttx_send_frame
movf TTX_BYTE_CNT,f
btfsc STATUS,Z
- return
+ goto ttx_get_csum
ttx_next_byte
call ttx_break
@@ -119,16 +119,31 @@ ttx_next_byte
decfsz TTX_BYTE_CNT,f
goto ttx_next_byte
+ttx_get_csum
call ttx_break
call ttx_recv_byte
movf TTX_BYTE,w
xorwf TTX_CSUM,w
btfss STATUS,Z
goto ttx_csum_error
- return
+ retlw .0
ttx_csum_error
- ;; TODO: react to comm error
- return
+ retlw .1
;; -------------------------------------
+ttx_send
+ call ttx_send_frame
+ movwf TTX_BYTE
+ call ttx_break
+ btfsc TTX_BYTE,0
+ bcf PORTD,TTX_SDA
+ btfss TTX_BYTE,0
+ bsf PORTD,TTX_SDA
+ bsf PORTD,TTX_SCL
+ nop
+ nop
+ nop
+ bcf PORTD,TTX_SCL
+ return
+ ;; -------------------------------------