From 6383d18e0ec9c1af5bb62634c24885cb6ab2ead5 Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Sun, 29 Jun 2025 22:32:43 +0200 Subject: [PATCH] avr: added comonuart1. --- avr/devices/all/defs.asm | 2 +- avr/devices/all/includes.asm | 13 + avr/devices/all/main.asm | 6 +- avr/devices/all/modules.asm | 9 + avr/modules/uart_hw/comonuart0.asm | 60 ++- avr/modules/uart_hw/comonuart1.asm | 670 +++++++++++++++++++++++++++++ 6 files changed, 734 insertions(+), 26 deletions(-) create mode 100644 avr/modules/uart_hw/comonuart1.asm diff --git a/avr/devices/all/defs.asm b/avr/devices/all/defs.asm index 9966df5..d81b01a 100644 --- a/avr/devices/all/defs.asm +++ b/avr/devices/all/defs.asm @@ -36,7 +36,7 @@ .equ AQHOME_VALUEID_STATS_HEAP_FREE = 0xe8 - +.equ AQHOME_VALUEID_STATS_PACKETS2_IN = 0xe9 ; --------------------------------------------------------------------------- diff --git a/avr/devices/all/includes.asm b/avr/devices/all/includes.asm index ad3a6a2..d28721b 100644 --- a/avr/devices/all/includes.asm +++ b/avr/devices/all/includes.asm @@ -74,6 +74,15 @@ .include "modules/uart_hw/comonuart0.asm" #endif +#ifdef MODULES_COMONUART1 +#ifndef MODULES_COMONUART0 +.include "modules/uart_hw/defs.asm" +.include "modules/uart_hw/lowlevel.asm" +.include "modules/uart_hw/m_lowlevel_uart.asm" +#endif +.include "modules/uart_hw/comonuart1.asm" +#endif + #ifdef MODULES_TTYONUART1 #ifndef MODULES_COMONUART0 @@ -160,6 +169,10 @@ #endif #endif +#ifdef MODULES_LCD + .include "modules/lcd/main.asm" +#endif + #ifdef MODULES_ILI9341 .include "modules/lcd2/ili9341/defs.asm" .include "modules/lcd2/ili9341/main.asm" diff --git a/avr/devices/all/main.asm b/avr/devices/all/main.asm index 522c148..98f5f17 100644 --- a/avr/devices/all/main.asm +++ b/avr/devices/all/main.asm @@ -107,16 +107,18 @@ onSystemTimerTick: bigcall ComOnUart0_Periodically #endif +#ifdef MODULES_COMONUART1 + bigcall ComOnUart1_Periodically +#endif + #ifdef MODULES_TCRT1000 bigcall TCRT1K_Every100ms #endif - #ifdef MODULES_BRIGHTNESS bigcall Brightness_Every100ms #endif - #ifdef APPS_NETWORK ldi yl, LOW(netInterfaceData) ldi yh, HIGH(netInterfaceData) diff --git a/avr/devices/all/modules.asm b/avr/devices/all/modules.asm index 6823fe7..ab73847 100644 --- a/avr/devices/all/modules.asm +++ b/avr/devices/all/modules.asm @@ -77,6 +77,10 @@ initModules: bigcall ComOnUart0_Init #endif +#ifdef MODULES_COMONUART1 + bigcall ComOnUart1_Init +#endif + #ifdef MODULES_MOTION bigcall Motion_Init #endif @@ -194,6 +198,10 @@ runModules_ComEnd: bigcall ComOnUart0_Run #endif +#ifdef MODULES_COMONUART1 + bigcall ComOnUart1_Run +#endif + #ifdef MODULES_STATS bigcall Stats_Run #endif @@ -215,6 +223,7 @@ runModules_ComEnd: ; rcall TCRT1K_Run #endif + ; add more modules here ret diff --git a/avr/modules/uart_hw/comonuart0.asm b/avr/modules/uart_hw/comonuart0.asm index 402dee0..1d6300c 100644 --- a/avr/modules/uart_hw/comonuart0.asm +++ b/avr/modules/uart_hw/comonuart0.asm @@ -38,8 +38,10 @@ ComOnUart0_Init: std Y+NET_IFACE_OFFS_IFACENUM, r16 sbi COM_IRQ_ADDR_ATTN, COM_IRQ_BIT_ATTN ; enable pin change irq for ATTN line + + in r16, GIMSK ; enable pin change irq PCIE0 or PCIE1 - ori r16, (1<