summaryrefslogtreecommitdiff
path: root/software/ihu/ttx.inc
diff options
context:
space:
mode:
authorChristian Pointner <equinox@mur.at>2012-01-28 15:44:06 +0000
committerChristian Pointner <equinox@mur.at>2012-01-28 15:44:06 +0000
commit37b5fe39f23067e6a3fc0beb9e40457298bfcba0 (patch)
treee0258f23d934a06c87801caf3877e6ba372011bf /software/ihu/ttx.inc
parentcleanup (diff)
added aknowledge pulse to ihu-ttx communication
git-svn-id: https://svn.spreadspace.org/mur.sat@239 7de4ea59-55d0-425e-a1af-a3118ea81d4c
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
+ ;; -------------------------------------