Files
aqhomecontrol/avr/common/wait_1ms.asm
Martin Preuss 4fdfd77a54 put wait routines into their own files.
helps with reducing size of bootloader.
2025-05-26 21:09:45 +02:00

48 lines
1.2 KiB
NASM

; ***************************************************************************
; 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. *
; ***************************************************************************
; ---------------------------------------------------------------------------
; @routine Utils_WaitFor1MilliSec @global
;
; wait for about 1ms.
;
; @clobbers r22
Utils_WaitFor1MilliSec:
push r21
ldi r21, 10
Utils_WaitFor1MilliSec_loop:
rcall Utils_WaitFor100MicroSecs ; (R22)
dec r21
brne Utils_WaitFor1MilliSec_loop
pop r21
ret
; @end
; ---------------------------------------------------------------------------
; @routine Utils_WaitForMilliSecs @global
;
; wait for given amount of milliseconds
; @param r16 number of millisecs to wait
; @clobbers r22
Utils_WaitForMilliSecs:
rcall Utils_WaitFor100MicroSecs ; (R22)
dec r16
brne Utils_WaitForMilliSecs
ret
; @end