twi_master: add routine twiReceiveByteSendAck.

This commit is contained in:
Martin Preuss
2023-01-30 01:02:31 +01:00
parent 89f403f602
commit 4864d16482

View File

@@ -340,6 +340,32 @@ twiReceiveByte_error:
; ---------------------------------------------------------------------------
; twiReceiveByteSendAck
;
; Read a byte from the bus. Sends ACK bit.
;
; IN:
; OUT:
; - CARRY flag set: okay, cleared on error
; - R16: byte received
; USED: R16, R17, R18, R22
twiReceiveByteSendAck:
rcall twiReceiveByte
brcc twiReceiveByteSendAck_error
push r16
clr r16
rcall twiWriteBit ; send ACK (R16, R22)
pop r16
sec
ret
twiReceiveByteSendAck_error:
clc
ret
TWI_Master_ScanNext:
in r15, SREG
cli