added modules for SGP30/40.
This commit is contained in:
@@ -107,6 +107,30 @@ TWI_Master_Run:
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine twiCheckPresence
|
||||
;
|
||||
; Expects interrupts being disabled!
|
||||
;
|
||||
; @param r16 address to check (with read bit set!)
|
||||
; @return CFLAG set if okay, clear on error
|
||||
; @clobbers (R16, R17, R18, R22)
|
||||
|
||||
twiCheckPresence:
|
||||
rcall twiStart ; (R22)
|
||||
rcall twiSendByte ; (R16, R17, R18, R22)
|
||||
; rcall twiSendByteExpectAck ; (R16, R17, R18, R22)
|
||||
brcc twiCheckPresence_notfound
|
||||
rcall twiStop ; (R22)
|
||||
sec
|
||||
ret
|
||||
twiCheckPresence_notfound:
|
||||
rcall twiStop ; (R22)
|
||||
clc
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; twiStart
|
||||
@@ -257,6 +281,29 @@ twiWriteBit_clockReleased:
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine twiSendFromFlashExpectAck
|
||||
;
|
||||
; Write bytes from flash to TWI expecting ACK bits.
|
||||
;
|
||||
; @param Z pointer to data in FLASH to send (prepared for "LPM"!)
|
||||
; @param r19 number of bytes to send
|
||||
; @return CFLAG set if okay, cleared on error
|
||||
; @clobbers R16, R17, R18, R22, Z
|
||||
|
||||
twiSendFromFlashExpectAck:
|
||||
twiSendFromFlashExpectAck_loop:
|
||||
lpm r16, Z+
|
||||
rcall twiSendByteExpectAck ; (R16, R17, R18, R22)
|
||||
brcc twiSendFromFlashExpectAck_ret
|
||||
dec r19
|
||||
brne twiSendFromFlashExpectAck_loop
|
||||
sec
|
||||
twiSendFromFlashExpectAck_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; twiSendByte
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user