added initial wait routine.
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
utils.asm
|
||||
utils_copy_from_flash.asm
|
||||
utils_copy_sdram.asm
|
||||
utils_initial_wait.asm
|
||||
utils_wait.asm
|
||||
utils_wait_fixed.asm
|
||||
utils_wait_pin.asm
|
||||
|
||||
41
avr/common/utils_initial_wait.asm
Normal file
41
avr/common/utils_initial_wait.asm
Normal file
@@ -0,0 +1,41 @@
|
||||
; ***************************************************************************
|
||||
; copyright : (C) 2025 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. *
|
||||
; ***************************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Utils_InitialWait
|
||||
;
|
||||
; Initial wait to desync nodes.
|
||||
;
|
||||
; This routine waits for between 10 to 2560 milliseconds (derived from UID)
|
||||
;
|
||||
; @clobbers r16, r17, r18, r19, r20, r21, r22, X
|
||||
|
||||
Utils_InitialWait:
|
||||
; setup initial wait loop
|
||||
rcall Utils_ReadUid ; (R16, X)
|
||||
clr r16
|
||||
eor r16, r18
|
||||
eor r16, r19
|
||||
eor r16, r20
|
||||
eor r16, r21
|
||||
|
||||
Utils_InitialWait_l1: ; wait R16 x 10 milliseconds
|
||||
ldi r17, 200
|
||||
Utils_InitialWait_l2: ; wait for 10ms
|
||||
rcall Utils_WaitFor50MicroSecs ; (R22)
|
||||
dec r17
|
||||
brne Utils_InitialWait_l2
|
||||
dec r16
|
||||
brne Utils_InitialWait_l1
|
||||
ret
|
||||
; @end
|
||||
|
||||
Reference in New Issue
Block a user