put wait routines into their own files.
helps with reducing size of bootloader.
This commit is contained in:
27
avr/common/wait_100us.asm
Normal file
27
avr/common/wait_100us.asm
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
; ***************************************************************************
|
||||||
|
; 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_WaitFor100MicroSecs @global
|
||||||
|
;
|
||||||
|
; wait for about 100 microsecs.
|
||||||
|
;
|
||||||
|
; @clobbers r22
|
||||||
|
|
||||||
|
Utils_WaitFor100MicroSecs:
|
||||||
|
rcall Utils_WaitFor50MicroSecs
|
||||||
|
rcall Utils_WaitFor50MicroSecs
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
25
avr/common/wait_10us.asm
Normal file
25
avr/common/wait_10us.asm
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
; ***************************************************************************
|
||||||
|
; 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_WaitFor10MicroSecs @global
|
||||||
|
;
|
||||||
|
; wait for 10 microsecs (minus cycles for call and ret).
|
||||||
|
;
|
||||||
|
; @clobbers r22
|
||||||
|
|
||||||
|
Utils_WaitFor10MicroSecs:
|
||||||
|
Utils_WaitNanoSecs 10000, 7, r22 ; wait for 10us (minus RCALL and RET)
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
|
||||||
24
avr/common/wait_50us.asm
Normal file
24
avr/common/wait_50us.asm
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
; ***************************************************************************
|
||||||
|
; 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_WaitFor50MicroSecs @global
|
||||||
|
;
|
||||||
|
; wait for 50 microsecs (minus cycles for call and ret).
|
||||||
|
;
|
||||||
|
; @clobbers r22
|
||||||
|
|
||||||
|
Utils_WaitFor50MicroSecs:
|
||||||
|
Utils_WaitNanoSecs 50000, 7, r22 ; wait for 50us (minus RCALL and RET)
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
Reference in New Issue
Block a user