From e56f2600e80583bfdc2ae62227ee6a01cbc32113 Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Thu, 1 May 2025 00:56:03 +0200 Subject: [PATCH] avr: more work on avr app framework. --- avr/devices/all/0BUILD | 2 ++ avr/devices/all/apps.asm | 7 ++++ avr/devices/all/hw_tn84.asm | 65 +++++++++++++++++++++++++++++++++++ avr/devices/all/hw_tn85.asm | 65 +++++++++++++++++++++++++++++++++++ avr/devices/all/includes.asm | 33 ++++++++++++++++-- avr/devices/all/main.asm | 39 +++++++++++++++++++++ avr/devices/all/modules.asm | 8 ++--- avr/devices/all/sendvalue.asm | 47 +++++++++++++++++++++---- 8 files changed, 253 insertions(+), 13 deletions(-) create mode 100644 avr/devices/all/hw_tn84.asm create mode 100644 avr/devices/all/hw_tn85.asm diff --git a/avr/devices/all/0BUILD b/avr/devices/all/0BUILD index 106eb17..d06b95e 100644 --- a/avr/devices/all/0BUILD +++ b/avr/devices/all/0BUILD @@ -6,6 +6,8 @@ apps.asm data.asm defs.asm + hw_tn84.asm + hw_tn85.asm includes.asm main.asm modules.asm diff --git a/avr/devices/all/apps.asm b/avr/devices/all/apps.asm index 2dedf5f..efbd423 100644 --- a/avr/devices/all/apps.asm +++ b/avr/devices/all/apps.asm @@ -37,6 +37,13 @@ initApps: rcall AppDoor_Init #endif +#ifdef APPS_REPORTSENSORS + rcall AppReportSensors_Init +#endif + +#ifdef APPS_STATS + rcall AppStats_Init +#endif ; done ret ; @end diff --git a/avr/devices/all/hw_tn84.asm b/avr/devices/all/hw_tn84.asm new file mode 100644 index 0000000..cdb1436 --- /dev/null +++ b/avr/devices/all/hw_tn84.asm @@ -0,0 +1,65 @@ +; *************************************************************************** +; copyright : (C) 2025 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. * +; *************************************************************************** + +; Hardware routine for AtTiny 84 devices + + +.cseg + + +; --------------------------------------------------------------------------- +; @routine systemInitHardware +; + +systemInitHardware: + ; set all ports as inputs and enable internal pull-up resistors + ldi r16, 0xff + clr r17 +.ifdef PORTA + out DDRA, r17 ; all input + out PORTA, r16 ; enable pull-up on all +.endif + +.ifdef PORTB + out DDRB, r17 ; all input + out PORTB, r16 ; enable pull-up on all +.endif + +.ifdef PORTC + out DDRC, r17 ; all input + out PORTC, r16 ; enable pull-up on all +.endif + ret +; @end + + + +; --------------------------------------------------------------------------- +; @routine systemSetSpeed +; + +systemSetSpeed: +.if clock == 8000000 + ldi r16, (1<