; *************************************************************************** ; copyright : (C) 2023 by Martin Preuss ; email : martin@libchipcard.de ; ; *************************************************************************** ; * This file is part of the project "AqHome". * ; * Please see toplevel file COPYING of that project for license details. * ; *************************************************************************** ; *************************************************************************** ; code .cseg ; --------------------------------------------------------------------------- ; wait indefinately until ATTN line is high, send packet over wire, retry until successfull ; ; IN: ; - x : ptr to buffer to send ; OUT: ; - nothing ; REGS: (R16, R17, R18, R21, R22, R24, R25, X) flashSendPacketUntilSuccess: push xl push xh rcall uartBitbang_SendPacket ; (R16, R17, R21, R22, X) pop xh pop xl brcc flashSendPacket_error ret flashSendPacket_error: ldi r16, 3 rcall flashWaitForMulti100ms rcall flashWaitForAttnHigh ; (R16, R17, R18, R22, R24, R25) rjmp flashSendPacketUntilSuccess ; --------------------------------------------------------------------------- ; wait indefinately for free ATTN line ; ; IN: ; - nothing ; OUT: ; - nothing ; REGS: (R16, R17, R18, R22, R24, R25) flashWaitForAttnHigh: rcall uartBitbang_WaitForAttnHigh ; (r17, r22) brcc flashWaitForAttnHigh_stillLow ret flashWaitForAttnHigh_stillLow: rcall flashWaitDependingOnUid ; (R16, R18, R22, R24, R25) rjmp flashWaitForAttnHigh