avr: share code.

This commit is contained in:
Martin Preuss
2025-03-23 01:08:33 +01:00
parent 595f983071
commit ebce002614
6 changed files with 51 additions and 49 deletions

View File

@@ -1,5 +1,5 @@
; ***************************************************************************
; copyright : (C) 2024 by Martin Preuss
; copyright : (C) 2025 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************

View File

@@ -25,8 +25,9 @@
.equ clock=8000000 ; Define the clock frequency
;.equ SEND_DEVICE_EVERY = 3000
.equ SEND_DEVICE_EVERY = 520 ; every 52s
.equ SEND_STATS_EVERY = 240 ; every 24s
.equ SEND_DEVICE_EVERY = 3000 ; every 5mins
.equ SEND_STATS_EVERY = 3100 ; about every 5mins
;.equ SEND_STATS_EVERY = 300 ; every 30s
.equ SEND_DEBUG_EVERY = 110
.nolist
@@ -73,11 +74,11 @@
;#define MODULES_MOTION
.equ NET_BUFFERS_NUM = 6
.equ NET_BUFFERS_NUM = 8
.equ NET_BUFFERS_SIZE = 32
.equ UART_HW_MSGNUMINBUF_SIZE = 6
.equ UART_HW_MSGNUMOUTBUF_SIZE = 6
.equ UART_HW_MSGNUMINBUF_SIZE = 8
.equ UART_HW_MSGNUMOUTBUF_SIZE = 8
; ***************************************************************************
@@ -499,21 +500,6 @@ checkRecvdMsg:
rcall NET_PeekNextIncomingMsgNum ; check read queue (bufNum->r16)
brcc checkRecvdMsg_end ; no msg, jmp
rcall NET_Buffer_Locate ; (R17)
push r16
push xl
push xh
adiw xh:xl, 1
rcall NETMSG_CheckMessageInBuffer ; (R16, R17, R18, R19, R20, X)
pop xh
pop xl
pop r16
brcs checkRecvdMsg_sendMsg
; release buffer
rcall NET_GetNextIncomingMsgNum ; take off the queue
rcall NET_Buffer_ReleaseByNum ; delete
clc
rjmp checkRecvdMsg_end
checkRecvdMsg_sendMsg:
ld r17, X
andi r17, (NET_IFACE_BUFFER_IFACENUM1_BIT | NET_IFACE_BUFFER_IFACENUM0_BIT)
rcall reverseInterfaceNum