avr: more work on com2wn module.

This commit is contained in:
Martin Preuss
2025-09-01 23:25:02 +02:00
parent 81669a5442
commit b95a4fa872
6 changed files with 38 additions and 83 deletions

View File

@@ -46,6 +46,13 @@ com2wnSetupIrq:
com2wnEnableClkIrq:
push r16
push r17
; clear this interfaces CLK bit in com2wnIoDisabledClockMask
ldd r16, Y+COM2W_IFACE_OFFS_PINMASK_CLK
com r16
lds r17, com2wnIoDisabledClockMask
and r17, r16
sts com2wnIoDisabledClockMask, r17
; enable pin change irq
ldd r16, Y+COM2W_IFACE_OFFS_PINMASK_IRQ
inr r17, COM_IRQ_ADDR_CLK
or r17, r16
@@ -70,6 +77,13 @@ com2wnDisableClkIrq:
inr r17, COM_IRQ_ADDR_CLK
and r17, r16 ; clear bit for clock line
outr COM_IRQ_ADDR_CLK, r17
; set this interfaces CLK bit in com2wnIoDisabledClockMask
ldd r16, Y+COM2W_IFACE_OFFS_PINMASK_CLK
lds r17, com2wnIoDisabledClockMask
or r17, r16
sts com2wnIoDisabledClockMask, r17
pop r17
pop r16
ret
@@ -93,6 +107,8 @@ COM2WN_ClkChangeIsr:
push r16
inr r16, COM_CLK_INPUT ; read clk state early
push r17
lds r17, com2wnIoDisabledClockMask ; mask disabled interfaces
or r16, r17
push r18
push xl
push xh
@@ -125,6 +141,8 @@ COM2WN_ClkChangeIsr_popRet:
inr r16, COM_CLK_INPUT ; read clk state early
inr r17, COM_DATA_INPUT ; read data state early
push r18
lds r18, com2wnIoDisabledClockMask ; mask disabled interfaces
or r16, r18
push xl
push xh
push yl