From 0dc4a3a952a35c96d5e7c785ea33a3cad26d2f92 Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Mon, 4 Aug 2025 22:28:49 +0200 Subject: [PATCH] avr: started adding COM2WN module. --- avr/devices/all/includes.asm | 14 ++++++++++++++ avr/devices/all/main.asm | 5 +++++ avr/devices/all/modules.asm | 12 ++++++++++++ avr/devices/r06/main/main.asm | 10 +++++----- 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/avr/devices/all/includes.asm b/avr/devices/all/includes.asm index 83a040b..4c75d55 100644 --- a/avr/devices/all/includes.asm +++ b/avr/devices/all/includes.asm @@ -119,6 +119,20 @@ #endif + +#ifdef MODULES_COM2WN +.include "modules/com2w/defs.asm" +.include "modules/com2w/com2wn_init.asm" +.include "modules/com2w/com2wn_io.asm" +.include "modules/com2w/com2wn_irq.asm" +.include "modules/com2w/com2wn_recv.asm" +.include "modules/com2w/com2wn_run.asm" +.include "modules/com2w/com2wn_send.asm" +.include "modules/com2w/com2wn_wait.asm" +.include "modules/com2w/com2wn_data.asm" +#endif + + #ifdef MODULES_CLOCK .include "modules/clock/main.asm" #endif diff --git a/avr/devices/all/main.asm b/avr/devices/all/main.asm index 8c520a0..d5d5047 100644 --- a/avr/devices/all/main.asm +++ b/avr/devices/all/main.asm @@ -148,6 +148,11 @@ onSystemTimerTick: bigcall COM2W1_Periodically #endif +#ifdef MODULES_COM2WN + bigcall COM2WN_Periodically +#endif + + #ifdef MODULES_TCRT1000 bigcall TCRT1K_Every100ms #endif diff --git a/avr/devices/all/modules.asm b/avr/devices/all/modules.asm index b5a3e19..027bb77 100644 --- a/avr/devices/all/modules.asm +++ b/avr/devices/all/modules.asm @@ -93,6 +93,11 @@ initModules: bigcall COM2W1_Init #endif +#ifdef MODULES_COM2WN + bigcall COM2WN_Init +#endif + + #ifdef MODULES_MOTION bigcall Motion_Init #endif @@ -250,6 +255,13 @@ runComModules_loop: sbci r16, 0 #endif +#ifdef MODULES_COM2WN + push r16 + bigcall COM2WN_Run + pop r16 + sbci r16, 0 +#endif + pop r17 ; check for repeat request tst r16 diff --git a/avr/devices/r06/main/main.asm b/avr/devices/r06/main/main.asm index 9ef4528..14e7ee4 100644 --- a/avr/devices/r06/main/main.asm +++ b/avr/devices/r06/main/main.asm @@ -47,7 +47,8 @@ ; --------------------------------------------------------------------------- ; generic -.equ NET_BUFFERS_NUM = 6 +.equ NET_BUFFERS_NUM = 6 +.equ COM2WN_IO_RINGBUFFER_SIZE = 128 .equ PROGRAM_SENSOR_INTERVAL_SECS = 60 .equ PROGRAM_STATS_INTERVAL_MINS = 10 @@ -62,7 +63,7 @@ #define MODULES_LED_SIMPLE #define MODULES_NETWORK ;#define MODULES_UART_BITBANG -#define MODULES_COM2WG +#define MODULES_COM2WN ;#define MODULES_TWI_MASTER ;#define MODULES_LCD ;#define LCD_MINIMAL_FONT @@ -122,10 +123,9 @@ ; Reset and interrupt vectors (will be removed as soon as we can flash data over COM) ; rjmp main ; Reset vector - rjmp BOOTLOADER_ADDR ; Reset vector ; use this for flashed system + rjmp BOOTLOADER_ADDR ; Reset vector ; use this for flashed system reti ; EXT_INT0 -; rjmp UART_BitBang_PcintIsr ; PCI0 - rjmp com2wPcintIsr ; PCI0 + rjmp COM2WN_ClkChangeIsr ; PCI0 reti ; PCI1 reti ; WATCHDOG reti ; ICP1