Files
aqhomecontrol/avr/modules/com2w_router/isr.asm
2026-02-16 01:12:25 +01:00

65 lines
1.6 KiB
NASM

; ***************************************************************************
; copyright : (C) 2026 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. *
; ***************************************************************************
#ifndef AVR_MOD_COM2WROUTER_ISR_ASM
#define AVR_MOD_COM2WROUTER_ISR_ASM
; ***************************************************************************
; code
.cseg
; ---------------------------------------------------------------------------
; @routine COM2WR_Router_PinChangeISR @global @isr
;
; @clobbers none
COM2WR_Router_PinChangeISR:
push r15
inr r15, SREG
push r16
push r17
push r18
inr r16, COM_CLK_INPUT
inr r17, COM_DATA_INPUT
lds r18, com2wAllCurrentPinMask
or r16, r18 ; preset ports marked as sending with ones
lds r18, com2wAllLastClock
sts com2wAllLastClock, r16
eor r18, r16 ; check for clock changes
breq COM2WR_Router_PinChangeISR_done
push r19
push xl
push xh
bigcall COM2WR_Ringbuffer_WriteWord ; (xl, xh, r18, r19)
pop xh
pop xl
pop r19
COM2WR_Router_PinChangeISR_done:
pop r18
pop r17
pop r16
outr SREG, r15
pop r15
reti
; @end
#endif ; AVR_MOD_COM2WROUTER_ISR_ASM