From f58f301423e6db79da054cf6d09d5b290dadd87f Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Sat, 4 Feb 2023 16:02:18 +0100 Subject: [PATCH] Call UID generator (if necessary). --- avr/att84_temp1.asm | 77 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 70 insertions(+), 7 deletions(-) diff --git a/avr/att84_temp1.asm b/avr/att84_temp1.asm index 5df1b63..9050c19 100644 --- a/avr/att84_temp1.asm +++ b/avr/att84_temp1.asm @@ -55,6 +55,14 @@ +; --------------------------------------------------------------------------- +; EEPROM positions + + +.equ EEPROM_OFFS_UUID = 0 ; 4 bytes (occupy total of 8 bytes for extensibility) +.equ EEPROM_OFFS_COMADDR = 8 ; 1 byte + + ; --------------------------------------------------------------------------- ; COM module @@ -80,8 +88,6 @@ ; --------------------------------------------------------------------------- ; TWI master module -.equ LCD_TWI_ADDRESS = 0x3c - .equ TWI_DDR_SCL = DDRA .equ TWI_PORT_SCL = PORTA .equ TWI_PIN_SCL = PINA @@ -94,6 +100,13 @@ +; --------------------------------------------------------------------------- +; LCD module + +.equ LCD_TWI_ADDRESS = 0x3c + + + ; --------------------------------------------------------------------------- ; BMP 280 @@ -139,11 +152,34 @@ reti ; USI_STR reti ; USI_OVF -.org 0x40 -; --------------------------------------------------------------------------- -; Node Id (not overwritten when updating system) -nodeUid: .db 0, 0, 0, 0, 0, 0, 0, 0 + + + +; --------------------------------------------------------------------------- +; maintenance system starts here. + +.org 0x50 + + +realInterruptTable: + rjmp main ; Reset vector + reti ; EXT_INT0 + rjmp comIsrPcint0 ; PCI0 + reti ; PCI1 + reti ; WATCHDOG + reti ; ICP1 + reti ; OC1A + reti ; OC1B + reti ; OVF1 + rjmp timerIrqOC0A ; OC0A + reti ; OC0B + reti ; OVF0 + reti ; ACI + reti ; ADCC + reti ; ERDY + reti ; USI_STR + reti ; USI_OVF ; *************************************************************************** @@ -189,11 +225,36 @@ blinkPattern: .db 5, 5, 5, 5, 5, 10, 0xff, 0xff ; 3 short blinks, 1s pause, r blinkPattern2: .db 10, 20, 0xff, 0xff ; 1 long blink, 2s pause, restart - .include "main.asm" +; --------------------------------------------------------------------------- +; onSystemStart +; +; Called on first time run, i.e. on system start. +; +; IN: +; - nothing +; OUT: +; - nothing +; USED: depending on called routines + +onSystemStart: + + +#ifdef MODULES_COM + rcall Utils_SetupUid +; brcc onSystemStart_l1 + ldi r16, 0xff + rcall CPRO_EnqueueNeedAddress +onSystemStart_l1: +#endif + + ret + + + ; --------------------------------------------------------------------------- ; onEvery100ms ; @@ -271,6 +332,8 @@ onEvery30s: rcall SI7021_PeriodicMeasurement rcall sendValueMsg #endif + +; rcall Utils_SetupUid ; debug ret