started reorganizing code into subfolders.
This commit is contained in:
42
avr/common/watchdog.asm
Normal file
42
avr/common/watchdog.asm
Normal 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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user