; *************************************************************************** ; 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. * ; *************************************************************************** ; *************************************************************************** ; Source file for LED controller node on AtTiny 84 ; ; This is for the full system (i.e. not the boot loader). ; *************************************************************************** .equ clock=8000000 ; Define the clock frequency .nolist .include "include/tn84def.inc" ; Define device ATtiny84 .list .include "version.asm" .include "../defs.asm" .include "../eeprom.asm" ;.include "./data.asm" .include "devices/all/defs.asm" .include "common/calls.asm" .include "common/utils_io.asm" .include "common/utils_wait.asm" ; *************************************************************************** ; defines ; --------------------------------------------------------------------------- ; generic .equ NET_BUFFERS_NUM = 6 .equ NET_MSGNUMINBUF_SIZE = 8 ; max buffer nums in ringbuffer (global incoming) .equ NET_IFACE_OUTMSGBUF_SIZE = 8 ; max buffer nums in ringbuffer (per interface outbound) ; --------------------------------------------------------------------------- ; firmware settings including list of modules used #define MODULES_CLOCK #define MODULES_LED_SIMPLE #define MODULES_NETWORK #define MODULES_COM2W #define MODULES_OWI_MASTER #define MODULES_DS18B20 #define MODULES_SK6812 #define APPS_NETWORK #define APPS_REPORTSENSORS #define APPS_STATS #define APPS_MA_LIGHT ; --------------------------------------------------------------------------- ; defines for modules .equ VALUE_ID_DS18B20_TEMP = 0x06 .equ VALUE_ID_MAL_STATE = 0x07 .equ VALUE_ID_LED_STATE = 0x81 .equ VALUE_ID_LED_NUMLEDS = 0x82 .equ VALUE_ID_LED_RGBW_VALUE = 0x83 .equ VALUE_ID_MAL_RGBW_VALUE = 0x84 .equ VALUE_ID_MAL_ONTIME = 0x85 .equ VALUE_ID_MAL_SOURCE1 = 0x86 .equ VALUE_ID_MAL_SOURCE2 = 0x87 .equ VALUE_ID_MAL_BSOURCE = 0x89 .equ VALUE_ID_MAL_BVALUE = 0x8a .equ VALUE_ID_LED_MODE = 0x8b .equ VALUE_ID_LED_TYPE = 0x8c ; *************************************************************************** ; code segment .cseg .org 000000 ; --------------------------------------------------------------------------- ; Reset and interrupt vectors rjmp BOOTLOADER_ADDR ; 1: Reset vector ; use this for flashed system reti ; 2: EXT_INT0 rjmp com2wPcintIsr ; 3: PCI0 reti ; 4: PCI1 reti ; 5: WDT reti ; 6: TIM1_CAPT reti ; 7: TIM1_COMPA reti ; 8: TIM1_COMPB reti ; 9: TIM1_OVF rjmp baseTimerIrqOC0A ; 10: TIM0_COMPA reti ; 11: TIM0_COMPB reti ; 12: TIM0_OVF reti ; 13: ANA_COMP reti ; 14: ADC reti ; 15: EE_RDY reti ; 16: USI_STR reti ; 17: USI_OVF devInfoBlock: ; 12 bytes devInfoManufacturer: .db 'A', 'Q', 'U', 'A' devInfoId: .db DEVICEINFO_ID, 0 devInfoVersion: .db DEVICEINFO_VERSION, DEVICEINFO_REVISION ; version, revision firmwareVersion: .db FIRMWARE_VARIANT_LEDSTRIPS, FIRMWARE_VERSION_MAJOR .db FIRMWARE_VERSION_MINOR, FIRMWARE_VERSION_PATCHLEVEL ; --------------------------------------------------------------------------- ; @routine firmwareStart @global firmwareStart: rjmp main ; @end ; --------------------------------------------------------------------------- ; @routine onSystemStart onSystemStart: ret ; @end ; --------------------------------------------------------------------------- ; @routine onMessageReceived ; ; Called on every message received onMessageReceived: clc ret ; @end ; --------------------------------------------------------------------------- ; @routine onEvery100ms ; ; Called every 100ms. Add your routine calls here. No arguments, no results. onEvery100ms: onEveryHour: onEveryDay: onEveryMinute: onEverySecond: ret ; @end ; --------------------------------------------------------------------------- ; @routine onEveryLoop ; ; Called on every loop (i.e. after awakening from sleep). ; onEveryLoop: ret ; @end ; *************************************************************************** ; includes .include "devices/all/hw_tn84.asm" .include "devices/all/includes.asm" ;.include "common/debug.asm" ; --------------------------------------------------------------------------- ; defines for network interface .equ netInterfaceData = com2w_iface deviceCodeEnd: .if deviceCodeEnd >= BOOTLOADER_ADDR .warning "Code reaches into boot loader!" .endif