put wait routines into their own files.
helps with reducing size of bootloader.
This commit is contained in:
47
avr/common/wait_1ms.asm
Normal file
47
avr/common/wait_1ms.asm
Normal file
@@ -0,0 +1,47 @@
|
||||
; ***************************************************************************
|
||||
; 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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user