started reorganizing code into subfolders.

This commit is contained in:
Martin Preuss
2023-04-22 00:04:10 +02:00
parent 97016b21b9
commit 5e12b8ad4e
40 changed files with 38 additions and 60 deletions

42
avr/common/watchdog.asm Normal file
View File

@@ -0,0 +1,42 @@
; ***************************************************************************
; 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
watchdogOn:
in r16, WDTCSR
ori r16, (1<<WDE) | (1<<WDP0) ; about 32ms period
out WDTCSR, r16
ret
watchdogOff:
wdr ; reset WDT
in r16, WDTCSR
ori r16, (1<<WDCE)|(1<<WDE)
push r15
in r15, SREG
cli
out WDTCSR, r16
ldi r16, (0<<WDE) ; Turn off WDT
out WDTCSR, r16
out SREG, r15
pop r15
ret