diff --git a/avr/devices/0BUILD b/avr/devices/0BUILD index 8e3d7f9..0ea9557 100644 --- a/avr/devices/0BUILD +++ b/avr/devices/0BUILD @@ -3,30 +3,14 @@ - n00 - n06 - n11 - n12 - n14 - n15 - n16 - n17 - n18 - n19 - n20 - n21 - n22 - n23 - n24 - t03 all c01 - c02 c03 + e01 n14 n16 n21 @@ -35,6 +19,7 @@ n26 n27 n28 + n29 r06 s03 t03 diff --git a/avr/devices/c02/README b/avr/devices/c02/README deleted file mode 100644 index 53dfeb9..0000000 --- a/avr/devices/c02/README +++ /dev/null @@ -1,10 +0,0 @@ - -C01 -=== - -- Role: Controller with Display -- MCU: AtMega 644P -- Connection: RJ45 -- Periphery: - - Display with SPI - diff --git a/avr/devices/c02/boot/boot.asm b/avr/devices/c02/boot/boot.asm deleted file mode 100644 index 5704672..0000000 --- a/avr/devices/c02/boot/boot.asm +++ /dev/null @@ -1,159 +0,0 @@ -; *************************************************************************** -; Source file for base system node on AtMega 644P -; -; This is for the maintenance system (i.e. the flash loader). -; -; All definitions and changes should go into this file. -; *************************************************************************** - -.equ clock=8000000 ; Define the clock frequency - -.nolist -.include "include/m644Pdef.inc" ; Define device ATmega8515 -.list - -.include "../defs.asm" -.include "devices/all/defs.asm" - -.include "common/calls.asm" -.include "common/utils_wait.asm" -.include "common/utils_io.asm" - - - -; *************************************************************************** -; defines - -; --------------------------------------------------------------------------- -; generic - - -.equ NET_BUFFERS_NUM = 6 -.equ NET_BUFFERS_SIZE = 32 - - - -; --------------------------------------------------------------------------- -; firmware settings - -.equ FIRMWARE_VERSION_MAJOR = 0 -.equ FIRMWARE_VERSION_MINOR = 0 -.equ FIRMWARE_VERSION_PATCHLEVEL = 1 - - - -; --------------------------------------------------------------------------- -; LED - -.equ LED_DDR = DDRD -.equ LED_PORT = PORTD -.equ LED_PIN = PIND -.equ LED_PINNUM = PORTD4 - - - - - -; *************************************************************************** -; code segment - -.cseg -.org 0x0000 - - - -; --------------------------------------------------------------------------- -; Reset and interrupt vectors - jmp main ; 1: Reset vector RESET - jmp irqNotSet ; 2: INT0 External Interrupt Request 0 - jmp irqNotSet ; 3: INT1 External Interrupt Request 1 - jmp irqNotSet ; 4: INT2 External Interrupt Request 2 - jmp irqNotSet ; 5: PCINT0 Pin Change Interrupt Request 0 - jmp irqNotSet ; 6: PCINT1 Pin Change Interrupt Request 1 - jmp irqNotSet ; 7: PCINT2 Pin Change Interrupt Request 2 - jmp irqNotSet ; 8: PCINT3 Pin Change Interrupt Request 3 - jmp irqNotSet ; 9: WDT Watchdog Time-out Interrupt - jmp irqNotSet ; 10: TIMER2_COMPA Timer/Counter2 Compare Match A - jmp irqNotSet ; 11: TIMER2_COMPB Timer/Counter2 Compare Match B - jmp irqNotSet ; 12: TIMER2_OVF Timer/Counter2 Overflow - jmp irqNotSet ; 13: TIMER1_CAPT Timer/Counter1 Capture Event - jmp irqNotSet ; 14: TIMER1_COMPA Timer/Counter1 Compare Match A - jmp irqNotSet ; 15: TIMER1_COMPB Timer/Counter1 Compare Match B - jmp irqNotSet ; 16: TIMER1_OVF Timer/Counter1 Overflow - jmp irqNotSet ; 17: TIMER0_COMPA Timer/Counter0 Compare Match A - jmp irqNotSet ; 18: TIMER0_COMPB Timer/Counter0 Compare Match B - jmp irqNotSet ; 19: TIMER0_OVF Timer/Counter0 Overflow - jmp irqNotSet ; 20: SPI_STC Serial Transfer Complete - jmp irqNotSet ; 21: USART0_RXC USART0 Rx Complete - jmp irqNotSet ; 22: USART0_UDRE USART0 Data Register Empty - jmp irqNotSet ; 23: USART0_TXC USART0 Tx Complete - jmp irqNotSet ; 24: ANA_COMP Analog Comparator - jmp irqNotSet ; 25: ADC ADC Conversion Complete - jmp irqNotSet ; 26: EE_RDY EEPROM Ready - jmp irqNotSet ; 27: TWI 2-Wire Interface - jmp irqNotSet ; 28: SPM_RDY Store Program Memory Ready - - - -; --------------------------------------------------------------------------- -; Device Info Block - -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_BOOT, FIRMWARE_VERSION_MAJOR - .db FIRMWARE_VERSION_MINOR, FIRMWARE_VERSION_PATCHLEVEL - -firmwareStart: - jmp main ; will be overwritten when flashing - -irqNotSet: - reti - - - -; *************************************************************************** -; main code - - -.org BOOTLOADER_ADDR - - -main: -; ldi r16, 0xb0 ; orig: a0 -; out OSCCAL, r16 - jmp bootLoader ; this routine is in modules/bootloader/main.asm - - - -; *************************************************************************** -; includes - -.include "common/wait_10us.asm" -.include "common/utils_copy_from_flash.asm" -.include "common/utils_copy_sdram.asm" - -.include "modules/flash/defs.asm" -.include "modules/flash/eeprom.asm" -.include "modules/flash/io.asm" -.include "modules/flash/io_com2w.asm" -.include "modules/flash/flash1pmega.asm" -.include "modules/flash/flashxp.asm" -.include "modules/flash/flashprocess.asm" -.include "modules/flash/wait.asm" -.include "modules/bootloader/main.asm" -.include "modules/network/msg/defs.asm" -.include "modules/network/msg/crc.asm" - -;.include "common/debug.asm" - - - -systemSetSpeed: - ; speed not changeable at runtime on this device - ret - - - - diff --git a/avr/devices/c02/defs.asm b/avr/devices/c02/defs.asm deleted file mode 100644 index a73734c..0000000 --- a/avr/devices/c02/defs.asm +++ /dev/null @@ -1,185 +0,0 @@ -; *************************************************************************** -; 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. * -; *************************************************************************** - - -; *************************************************************************** -; -; AtMega644 -; -------- -; DSPLED PB0 1 40 PA0 DEV0 -; DC PB1 2 39 PA1 DEV1 -; INT2 PB2 3 38 PA2 DEV2 -; DSPRES PB3 4 37 PA3 PA3 -; SS PB4 5 36 PA4 PA4 -; MOSI PB5 6 35 PA5 -; MISO PB6 7 34 PA6 -; SCK PB7 8 33 PA7 -; /RESET 9 32 AREF -; VCC 10 31 GND -; GND 11 30 AVCC -; XTAL2 12 29 PC7 -; XTAL1 13 28 PC6 -; RXD PD0 14 27 PC5 -; TXD PD1 15 26 PC4 -; ATTN PD2 16 25 PC3 -; INT1 PD3 17 24 PC2 -; LED PD4 18 23 PC1 -; PD5 19 22 PC0 -; PD6 20 21 PD7 -; -------- -; -; *************************************************************************** - - - -.equ BOOTLOADER_ADDR = 0x7c00 - -.equ FIRMWARE_VARIANT_BOOT = 0 -.equ FIRMWARE_VARIANT_TEMP_WINDOW = 1 - -.equ DEVICEINFO_ID = 'C' -.equ DEVICEINFO_VERSION = 2 -.equ DEVICEINFO_REVISION = 0 - - - -; --------------------------------------------------------------------------- -; LED module - -.equ LED_SIMPLE_ONTIME = 1 ; shorter -.equ LED_SIMPLE_OFFTIME = 50 ; longer -.equ LED_SIMPLE_DDR = DDRD -.equ LED_SIMPLE_PORT = PORTD -.equ LED_SIMPLE_PORTIN = PIND -.equ LED_SIMPLE_PINNUM = PORTD4 - - - -; --------------------------------------------------------------------------- -; COM module - -.equ COM_BIT_LENGTH = 52000 ; 104000ns=9600, 52000ns=19200, 26000ns=38400 -.equ COM_HALFBIT_LENGTH = 26000 ; see https://de.wikipedia.org/wiki/Universal_Asynchronous_Receiver_Transmitter - -.equ COM_DATA_DDR = DDRD -.equ COM_DATA_INPUT = PIND -.equ COM_DATA_OUTPUT = PORTD -.equ COM_DATA_PIN = PORTD0 - -.equ COM_CLK_DDR = DDRD -.equ COM_CLK_INPUT = PIND -.equ COM_CLK_OUTPUT = PORTD -.equ COM_CLK_PIN = PORTD2 - -.equ COM_IRQ_ADDR_CLK = EIMSK -.equ COM_IRQ_BIT_CLK = INT0 -.equ COM_IRQ_GIFR_CLK = INTF0 -;.equ COM_IRQ_GIMSK_CLK = PCIE0 - - - -; --------------------------------------------------------------------------- -; SPI hardware module - -.equ SPIHW_SS_DDR = DDRB -.equ SPIHW_SS_INPUT = PINB -.equ SPIHW_SS_OUTPUT = PORTB -.equ SPIHW_SS_PIN = PORTB4 - -.equ SPIHW_MOSI_DDR = DDRB -.equ SPIHW_MOSI_INPUT = PINB -.equ SPIHW_MOSI_OUTPUT = PORTB -.equ SPIHW_MOSI_PIN = PORTB5 - -.equ SPIHW_MISO_DDR = DDRB -.equ SPIHW_MISO_INPUT = PINB -.equ SPIHW_MISO_OUTPUT = PORTB -.equ SPIHW_MISO_PIN = PORTB6 - -.equ SPIHW_SCK_DDR = DDRB -.equ SPIHW_SCK_INPUT = PINB -.equ SPIHW_SCK_OUTPUT = PORTB -.equ SPIHW_SCK_PIN = PORTB7 - -.equ SPIHW_SS0_DDR = DDRA -.equ SPIHW_SS0_OUTPUT = PORTA -.equ SPIHW_SS0_INPUT = PORTA -.equ SPIHW_SS0_PIN = PORTA0 - -.equ SPIHW_SS1_DDR = DDRA -.equ SPIHW_SS1_OUTPUT = PORTA -.equ SPIHW_SS1_INPUT = PORTA -.equ SPIHW_SS1_PIN = PORTA1 - -.equ SPIHW_SS2_DDR = DDRA -.equ SPIHW_SS2_OUTPUT = PORTA -.equ SPIHW_SS2_INPUT = PORTA -.equ SPIHW_SS2_PIN = PORTA2 - - - -; --------------------------------------------------------------------------- -; ILI9341 module - -.equ DISPLAY_WIDTH = 320 -.equ DISPLAY_HEIGHT = 240 - -.equ ILI9341_DEVICENUM = 0 -.equ ILI9341_DSP_WIDTH = DISPLAY_WIDTH -.equ ILI9341_DSP_HEIGHT = DISPLAY_HEIGHT - -.equ ILI9341_RESET_DDR = DDRB -.equ ILI9341_RESET_OUTPUT = PORTB -.equ ILI9341_RESET_INPUT = PORTB -.equ ILI9341_RESET_PIN = PORTB3 - -.equ ILI9341_DC_DDR = DDRB -.equ ILI9341_DC_OUTPUT = PORTB -.equ ILI9341_DC_INPUT = PORTB -.equ ILI9341_DC_PIN = PORTB1 - -.equ ILI9341_LED_DDR = DDRB -.equ ILI9341_LED_OUTPUT = PORTB -.equ ILI9341_LED_INPUT = PORTB -.equ ILI9341_LED_PIN = PORTB0 - - - -; --------------------------------------------------------------------------- -; XPT2046 module - -.equ XPT2046_DEVICENUM = 1 - - - -; --------------------------------------------------------------------------- -; ComOnUart module - -;.equ USART0_DATAREG = UDR -;.equ UCSR0A = UCSRA -;.equ UCSR0B = UCSRB -;.equ UCSR0C = UCSRC -;.equ UBRR0L = UBRRL -;.equ UBRR0H = UBRRH - -;.equ UCSZ00 = UCSZ0 -;.equ UCSZ01 = UCSZ1 -;.equ UDRE0 = UDRE -;.equ RXC0 = RXC -;.equ TXC0 = TXC -;.equ FE0 = FE -;.equ DOR0 = DOR -;.equ UPE0 = UPE -;.equ RXEN0 = RXEN -;.equ TXEN0 = TXEN -;.equ USBS0 = USBS -;.equ RXCIE0 = RXCIE -;.equ UDRIE0 = UDRIE - - diff --git a/avr/devices/c02/main/main.asm b/avr/devices/c02/main/main.asm deleted file mode 100644 index 44e9a84..0000000 --- a/avr/devices/c02/main/main.asm +++ /dev/null @@ -1,286 +0,0 @@ -; *************************************************************************** -; 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. * -; *************************************************************************** - -;.equ clock=1000000 ; Define the clock frequency -.equ clock=8000000 ; Define the clock frequency - - - -.nolist -.include "include/m644Pdef.inc" ; Define device ATmega644P -.list - -.include "version.asm" -.include "../defs.asm" -.include "./data.asm" - -.include "devices/all/defs.asm" -.include "common/calls.asm" -.include "common/utils_wait.asm" -.include "common/utils_io.asm" - - - -; *************************************************************************** -; defines - -; --------------------------------------------------------------------------- -; generic - -.equ STACK_SIZE = 256 - -.equ NET_BUFFERS_NUM = 8 -.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_TIMER -#define MODULES_CLOCK -;#define MODULES_XRAM -;#define MODULES_HEAP -#define MODULES_LED_SIMPLE -#define MODULES_NETWORK -;#define MODULES_COMONUART0 -;#define MODULES_UART_HW -;#define MODULES_UART_BITBANG -#define MODULES_COM2W -#define MODULES_SPI_HW -#define MODULES_ILI9341 -#define MODULES_XPT2046 -#define MODULES_FONT -#define MODULES_GUI -;#define MODULES_TWI_MASTER -;#define MODULES_LCD -;#define LCD_MINIMAL_FONT -;#define MODULES_SI7021 -;#define MODULES_SGP30 -;#define MODULES_SGP40 -;#define MODULES_STATS -;#define MODULES_OWI_MASTER -;#define MODULES_DS18B20 -;#define MODULES_MOTION -;#define MODULES_CCS811 - -#define APPS_NETWORK -;#define APPS_MOTION -;#define APPS_REPORTSENSORS -#define APPS_STATS - - - -; --------------------------------------------------------------------------- -; defines for values - -.equ VALUE_ID_SI7021_TEMP = 0x01 -.equ VALUE_ID_SI7021_HUM = 0x02 - -.equ VALUE_ID_ADC = 0x03 -;.equ VALUE_ID_DS18B20_TEMP = 0x06 -.equ VALUE_ID_MOTION = 0x07 - -.equ VALUE_ID_SGP40_TVOC = 0x08 - -.equ VALUE_ID_SGP30_TVOC = 0x09 -.equ VALUE_ID_SGP30_CO2 = 0x0a - -;.equ VALUE_ID_REED_CONF = 0x81 - -.equ VALUE_ID_DEBUG = 0x7f - -.equ VALUE_ID_LEDSIMPLE_TIMING = 0x88 - - - - - -; *************************************************************************** -; code segment - -.cseg -.org 000000 - - - -; --------------------------------------------------------------------------- -; Reset and interrupt vectors - jmp BOOTLOADER_ADDR ; 1: Reset vector RESET - jmp com2wPcintIsr ; 2: INT0 External Interrupt Request 0 - jmp irqNotSet ; 3: INT1 External Interrupt Request 1 - jmp irqNotSet ; 4: INT2 External Interrupt Request 2 - jmp irqNotSet ; 5: PCINT0 Pin Change Interrupt Request 0 - jmp irqNotSet ; 6: PCINT1 Pin Change Interrupt Request 1 - jmp irqNotSet ; 7: PCINT2 Pin Change Interrupt Request 2 - jmp irqNotSet ; 8: PCINT3 Pin Change Interrupt Request 3 - jmp irqNotSet ; 9: WDT Watchdog Time-out Interrupt - jmp irqNotSet ; 10: TIMER2_COMPA Timer/Counter2 Compare Match A - jmp irqNotSet ; 11: TIMER2_COMPB Timer/Counter2 Compare Match B - jmp irqNotSet ; 12: TIMER2_OVF Timer/Counter2 Overflow - jmp irqNotSet ; 13: TIMER1_CAPT Timer/Counter1 Capture Event - jmp irqNotSet ; 14: TIMER1_COMPA Timer/Counter1 Compare Match A - jmp irqNotSet ; 15: TIMER1_COMPB Timer/Counter1 Compare Match B - jmp irqNotSet ; 16: TIMER1_OVF Timer/Counter1 Overflow - jmp baseTimerIrqOC0A ; 17: TIMER0_COMPA Timer/Counter0 Compare Match A - jmp irqNotSet ; 18: TIMER0_COMPB Timer/Counter0 Compare Match B - jmp irqNotSet ; 19: TIMER0_OVF Timer/Counter0 Overflow - jmp irqNotSet ; 20: SPI_STC Serial Transfer Complete - jmp irqNotSet ; 21: USART0_RXC USART0 Rx Complete - jmp irqNotSet ; 22: USART0_UDRE USART0 Data Register Empty - jmp irqNotSet ; 23: USART0_TXC USART0 Tx Complete - jmp irqNotSet ; 24: ANA_COMP Analog Comparator - jmp irqNotSet ; 25: ADC ADC Conversion Complete - jmp irqNotSet ; 26: EE_RDY EEPROM Ready - jmp irqNotSet ; 27: TWI 2-Wire Interface - jmp irqNotSet ; 28: SPM_RDY Store Program Memory Ready - - - -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_TEMP_WINDOW, FIRMWARE_VERSION_MAJOR - .db FIRMWARE_VERSION_MINOR, FIRMWARE_VERSION_PATCHLEVEL - - - -; --------------------------------------------------------------------------- -; @routine firmwareStart @global - -firmwareStart: - rjmp main -; @end - - -irqNotSet: - reti - - - -; --------------------------------------------------------------------------- -; @routine onSystemStart - -onSystemStart: - clr r16 - sts statsUpdateTimer, r16 - bigcall test - 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: -onEveryMinute: -onEveryHour: -onEveryDay: - ret -; @end - - -onEverySecond: -#ifdef MODULES_GUI - lds r16, statsUpdateTimer - inc r16 - cpi r16, 5 - brcc onEverySecond_updateStats - sts statsUpdateTimer, r16 - ret -onEverySecond_updateStats: - bigcall WinNetStats_Update - clr r16 - sts statsUpdateTimer, r16 -#endif - ret - - - -; --------------------------------------------------------------------------- -; @routine onEveryLoop -; -; Called on every loop (i.e. after awakening from sleep). -; -onEveryLoop: - ret -; @end - - - -test: -#ifdef MODULES_GUI - bigcall WinNetStats_Init - bigcall WinNetStats_Show -#endif - ret - - - - - -; *************************************************************************** -; includes - -.include "devices/all/hw_m644p.asm" -.include "devices/all/includes.asm" - -;.include "common/debug.asm" - - .include "modules/lcd2/gui/titlewindow2.asm" -;.include "modules/lcd2/font/font2.asm" -;.include "modules/lcd2/font/font3.asm" -;.include "modules/lcd2/font/font16x26.asm" -;.include "modules/lcd2/font/font4.asm" -;.include "modules/lcd2/font/font12x16.asm" -.include "modules/lcd2/ili9341/font12x20.asm" -.include "modules/lcd2/ili9341/font12x20_1.asm" -;.include "common/list_t.asm" -;.include "common/tree_t.asm" -.include "common/divide.asm" - - .include "modules/lcd2/gui/style.asm" - .include "win_netstats.asm" - - -; --------------------------------------------------------------------------- -; defines for network interface - -;.equ netInterfaceData = netUartIface -;.equ netInterfaceData = uart_bitbang_iface -.equ netInterfaceData = com2w_iface - - -.dseg - -statsUpdateTimer: .byte 1 - -heapStart: - - -.equ HEAP_START = heapStart -.equ HEAP_SIZE = (SRAM_SIZE-STACK_SIZE)-HEAP_START - diff --git a/avr/devices/c02/main/win_netstats.asm b/avr/devices/c02/main/win_netstats.asm deleted file mode 100644 index 9733e20..0000000 --- a/avr/devices/c02/main/win_netstats.asm +++ /dev/null @@ -1,187 +0,0 @@ -; *************************************************************************** -; 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. * -; *************************************************************************** - -#ifndef AQH_AVR_DEVICE_C02_WIN_NETSTATS_ASM -#define AQH_AVR_DEVICE_C02_WIN_NETSTATS_ASM - - -.cseg - - -WinNetStats_Init: - clr r16 - sts winNetstatsUpdateNum, r16 - sts winNetstatsUpdateNum+1, r16 - - ; setup - ldi yl, LOW(winNetstats) - ldi yh, HIGH(winNetstats) - bigcall TitleWindow_Init - - ldi zl, LOW(STYLE_WIN_FONT*2) - ldi zh, HIGH(STYLE_WIN_FONT*2) - std Y+WIN_OFFS_FONT_LO, zl - std Y+WIN_OFFS_FONT_HI, zh - - bigcall TitleWindow_SetFullSize - bigcall TitleWindow_SetStyleColors - - ret -; @end - - - -; @param @0 Y -; @param @1 label addr - -.macro WINNETSTATS_PRINTLABEL - ; packets in - ldi zl, LOW(@1 * 2) - ldi zh, HIGH(@1 * 2) - ldi r16, 2 ; X - mov r4, r16 - clr r5 - ldi r16, LOW(STYLE_WIN_TITLE_HEIGHT+@0) ; Y - mov r6, r16 - ldi r16, HIGH(STYLE_WIN_TITLE_HEIGHT+@0) - mov r7, r16 - bigcall Window_DrawTextFlash -.endmacro - - - -; @param @0 X -; @param @1 Y -; @param @2 data address - -.macro WINNETSTATS_PRINTDATA - ldi r16, @0 ; X - mov r4, r16 - clr r5 - ldi r16, LOW(STYLE_WIN_TITLE_HEIGHT+@1) ; Y - mov r6, r16 - ldi r16, HIGH(@1) - mov r7, r16 - lds r16, @2 ; data - lds r17, @2+1 - bigcall Window_WriteHexWordAt -.endmacro - - - -WinNetStats_Show: - ; draw title window basics (with title) - ldi yl, LOW(winNetstats) - ldi yh, HIGH(winNetstats) - ldi zl, LOW(winNetstats_title*2) - ldi zh, HIGH(winNetstats_title*2) - bigcall TitleWindow_DrawTitle - - bigcall TitleWindow_ClearContentArea - - ; packets in - WINNETSTATS_PRINTLABEL 2, winNetstats_lPacketsIn - ; packets out - WINNETSTATS_PRINTLABEL 24, winNetstats_lPacketsOut - ; eContent - WINNETSTATS_PRINTLABEL 46, winNetstats_lContentErr - ; eIO - WINNETSTATS_PRINTLABEL 68, winNetstats_lIoErr - ; eMsgSize - WINNETSTATS_PRINTLABEL 90, winNetstats_lMsgSizeErr - - ; draw horizontal line - ldi r16, STYLE_WIN_TITLE_HEIGHT+112 - mov r6, r16 - clr r7 - clr r4 - clr r5 - ldi r16, LOW(DISPLAY_WIDTH) - mov r8, r16 - ldi r16, HIGH(DISPLAY_WIDTH) - mov r9, r16 - clr r2 - clr r3 - bigcall Display_DrawHLine - - ; X - WINNETSTATS_PRINTLABEL 114, winNetstats_lX - ; Y - WINNETSTATS_PRINTLABEL 136, winNetstats_lY - ; Z - WINNETSTATS_PRINTLABEL 158, winNetstats_lZ - ; update num - WINNETSTATS_PRINTLABEL 180, winNetstats_lUpdate - - rcall WinNetStats_Update - - ret -; @end - - - -WinNetStats_Update: - lds r16, winNetstatsUpdateNum - inc r16 - sts winNetstatsUpdateNum, r16 - - ldi yl, LOW(winNetstats) - ldi yh, HIGH(winNetstats) - - ; packets in - WINNETSTATS_PRINTDATA 160, 2, netInterfaceData+NET_IFACE_OFFS_PACKETSIN_LOW - ; packets out - WINNETSTATS_PRINTDATA 160, 24, netInterfaceData+NET_IFACE_OFFS_PACKETSOUT_LOW - ; eContent - WINNETSTATS_PRINTDATA 160, 46, netInterfaceData+NET_IFACE_OFFS_ERR_CONTENT_LOW - ; eIO - WINNETSTATS_PRINTDATA 160, 68, netInterfaceData+NET_IFACE_OFFS_ERR_IO_LOW - ; eMsgSize - WINNETSTATS_PRINTDATA 160, 90, netInterfaceData+NET_IFACE_OFFS_ERR_MSGSIZE_LOW - - ; X - WINNETSTATS_PRINTDATA 160, 114, xpt2046CurrentX - WINNETSTATS_PRINTDATA 240, 114, xpt2046RawX - ; Y - WINNETSTATS_PRINTDATA 160, 136, xpt2046CurrentY - WINNETSTATS_PRINTDATA 240, 136, xpt2046RawY - ; Z - WINNETSTATS_PRINTDATA 160, 158, xpt2046CurrentZ - ; update num - WINNETSTATS_PRINTDATA 160, 180, winNetstatsUpdateNum - - ret -; @end - - - -winNetstats_title: .db "Network Statistics", 0, 0 - -winNetstats_lPacketsIn: .db "Pkgs In :", 0 -winNetstats_lPacketsOut: .db "Pkgs Out:", 0 -winNetstats_lContentErr: .db "eContent:", 0 -winNetstats_lIoErr: .db "eIO :", 0 -winNetstats_lMsgSizeErr: .db "eMsgSize:", 0 -winNetstats_lX: .db "X :", 0 -winNetstats_lY: .db "Y :", 0 -winNetstats_lZ: .db "Z :", 0 -winNetstats_lUpdate: .db "Update :", 0 -.dseg - -winNetstats: - .byte WIN_SIZE - - - -.dseg - -winNetstatsUpdateNum: .byte 2 - - -#endif diff --git a/avr/devices/c02/.gitignore b/avr/devices/e01/.gitignore similarity index 100% rename from avr/devices/c02/.gitignore rename to avr/devices/e01/.gitignore diff --git a/avr/devices/c02/0BUILD b/avr/devices/e01/0BUILD similarity index 100% rename from avr/devices/c02/0BUILD rename to avr/devices/e01/0BUILD diff --git a/avr/devices/e01/README b/avr/devices/e01/README new file mode 100644 index 0000000..4628c7a --- /dev/null +++ b/avr/devices/e01/README @@ -0,0 +1,10 @@ + +E01 +=== + +- Role: COM-PC-Interface extension for S05 +- MCU: AtTiny841 +- Connection: S05-internal +- Predecessor: T04 +- COM: UARTFD0, COM2W + diff --git a/avr/devices/c02/boot/0BUILD b/avr/devices/e01/boot/0BUILD similarity index 87% rename from avr/devices/c02/boot/0BUILD rename to avr/devices/e01/boot/0BUILD index aa0156b..5b8516c 100644 --- a/avr/devices/c02/boot/0BUILD +++ b/avr/devices/e01/boot/0BUILD @@ -2,7 +2,7 @@ - + -I $(builddir) diff --git a/avr/devices/e01/boot/boot.asm b/avr/devices/e01/boot/boot.asm new file mode 100644 index 0000000..2f9fa66 --- /dev/null +++ b/avr/devices/e01/boot/boot.asm @@ -0,0 +1,150 @@ +; *************************************************************************** +; Source file for base system node on AtTiny 84 +; +; This is for the maintenance system (i.e. the flash loader). +; +; All definitions and changes should go into this file. +; *************************************************************************** + +;.equ clock=1000000 ; Define the clock frequency +.equ clock=8000000 ; Define the clock frequency + +.nolist +.include "include/tn841def.inc" ; Define device ATtiny841 +.list + +.include "version.asm" +.include "../defs.asm" +.include "devices/all/defs.asm" + +.include "common/calls.asm" +.include "common/utils_wait.asm" + + + +; *************************************************************************** +; defines + + +;#define COM_ACCEPT_ALL_DEST 1 + + + +; --------------------------------------------------------------------------- +; LED + +.equ LED_DDR = DDRB +.equ LED_PORT = PORTB +.equ LED_PIN = PINB +.equ LED_PINNUM = PORTB2 + + +; *************************************************************************** +; code segment + +.cseg +.org 0x0000 + + + +; --------------------------------------------------------------------------- +; Reset and interrupt vectors + + rjmp main ; 1: RESET Reset vector use this for flashed system + reti ; 2: INT0 External Interrupt Request 0 + reti ; 3: PCINT0 Pin Change Interrupt 0 + reti ; 4: PCINT1 Pin Change Interrupt 1 + reti ; 5: WDT Watchdog Time-out + reti ; 6: TIM1_CAPT Timer/Counter1 Capture Event + reti ; 7: TIM1_COMPA (OC1A) Timer/Counter1 Compare Match A + reti ; 8: TIM1_COMPB (OC1B) Timer/Counter1 Compare Match B + reti ; 9: TIM1_OVF (OVF1) Timer/Counter1 Overflow + reti ; 10: TIM0_COMPA (OC0A) Timer/Counter0 Compare Match A + reti ; 11: TIM0_COMPB (OC0B) Timer/Counter0 Compare Match B + reti ; 12: TIM0_OVF (OVF0) Timer/Counter0 Overflow + reti ; 13: ANA_COMP0 Analog Comparator 0 + reti ; 14: ADC_READY ADC Conversion Complete + reti ; 15: EE_RDY (ERDY) EEPROM Ready + reti ; 16: ANA_COMP1 Analog Comparator 1 + reti ; 17: TIM2_CAPT Timer/Counter2 Capture Event + reti ; 18: TIM2_COMPA (OC2A) Timer/Counter2 Compare Match A + reti ; 19: TIM2_COMPB (OC2B) Timer/Counter2 Compare Match B + reti ; 20: TIM2_OVF (OVF2) Timer/Counter2 Overflow + reti ; 21: SPI SPI Serial Transfer Complete + reti ; 22: USART0_RXS USART0 Rx Start + reti ; 23: USART0_RXC USART0 Rx Complete + reti ; 24: USART0_DRE USART0 Data Register Empty + reti ; 25: USART0_TXC USART0 Tx Complete + reti ; 26: USART1_RXS USART1 Rx Start + reti ; 27: USART1_RXC USART1 Rx Complete + reti ; 28: USART1_DRE USART1 Data Register Empty + reti ; 29: USART1_TXC USART1 Tx Complete + reti ; 30: TWI Two-Wire-Interface + reti ; 31: RESERVED reserved + + + +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_BOOT, FIRMWARE_VERSION_MAJOR + .db FIRMWARE_VERSION_MINOR, FIRMWARE_VERSION_PATCHLEVEL + +firmwareStart: + rjmp main ; will be overwritten when flashing + + + +; *************************************************************************** +; main code + + +.org BOOTLOADER_ADDR + + +main: + rjmp bootLoader ; this routine is in modules/bootloader/main.asm + + + + +; *************************************************************************** +; includes + +.include "common/utils_wait_fixed.asm" +.include "common/utils_copy_from_flash.asm" +.include "common/utils_copy_sdram.asm" +.include "modules/flash/defs.asm" +.include "modules/flash/eeprom.asm" +.include "modules/flash/io.asm" +.include "modules/flash/io_uart0.asm" +.include "modules/flash/io_uart_all.asm" +.include "modules/flash/flashxp.asm" +.include "modules/flash/flash4p.asm" +.include "modules/flash/flashprocess.asm" +.include "modules/flash/wait.asm" +.include "modules/bootloader/main.asm" +.include "modules/network/msg/defs.asm" +.include "modules/network/msg/crc.asm" + + + +systemSetSpeed: +.if clock == 1000000 + ldi r17, 0xd8 + ldi r16, (1< + + + + + + + -I $(builddir) + -I $(srcdir) + -I $(topsrcdir)/avr + -I $(topbuilddir)/avr + + + + + main.asm + + + + + + + + + + + + + + + + + diff --git a/avr/devices/e01/main/main.asm b/avr/devices/e01/main/main.asm new file mode 100644 index 0000000..5419556 --- /dev/null +++ b/avr/devices/e01/main/main.asm @@ -0,0 +1,246 @@ +; *************************************************************************** +; 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 temperature sensor node on AtTiny 84 +; +; This is for the full system (i.e. not the boot loader). +; +; All definitions and changes should go into this file. +; +; +; *************************************************************************** + + +;.equ clock=1000000 ; Define the clock frequency +.equ clock=8000000 ; Define the clock frequency + + +.nolist +.include "include/tn841def.inc" ; Define device ATtiny841 +.list + +.include "../defs.asm" +.include "version.asm" +;.include "defs_all.asm" + +.include "devices/all/defs.asm" + +.include "common/calls.asm" +.include "common/utils_wait.asm" +.include "common/utils_io.asm" + + + +; *************************************************************************** +; defines + +; --------------------------------------------------------------------------- +; generic + +.equ COMONUART0_IFACENUM = 1 +.equ TTYONUART0_IFACENUM = 2 + + +; debug + +;.equ T03_FLAGS_ALLOC = 0x01 +;.equ T03_FLAGS_I1_SKIPPING = 0x02 +;.equ T03_FLAGS_I1_RESTARTED = 0x04 +;.equ T03_FLAGS_ADDIN = 0x08 +;.equ T03_FLAGS_I1_ADDOUT = 0x10 +;.equ T03_FLAGS_I2_ADDOUT = 0x20 + + + +; --------------------------------------------------------------------------- +; firmware settings including list of modules used + + +#define MAIN_WITHOUT_MSG_HANDLING ; we do message handling ourselfes +#define COM_ACCEPT_ALL_DEST ; accept all messages! +#define APP_STATS_NETDEV2 +#define APP_ROUTER_NO_ADDR_MGR + +#define MODULES_CLOCK +;#define MODULES_COM +;#define MODULES_COM_WITH_ADDR_PROTO +;#define MODULES_LED +;#define MODULES_LED_SIMPLE +;#define MODULES_LED_SIGNAL +#define MODULES_LED_ACTIVITY +;#define MODULES_TWI_MASTER +;#define MODULES_LCD +;#define LCD_MINIMAL_FONT +;#define MODULES_SI7021 +;#define MODULES_STATS +;#define MODULES_CNY70 +;#define MODULES_REED +;#define MODULES_OWI_MASTER +;#define MODULES_DS18B20 +;#define MODULES_MOTION +#define MODULES_NETWORK +#define MODULES_COM2W +;#define MODULES_COMONUART0 +;#define MODULES_TTYONUART1 +#define MODULES_UARTFD0 +#define APPS_STATS +;#define APPS_NETWORK +;#define APPS_ROUTER +#define APPS_FORWARDER + + + +.equ NET_BUFFERS_NUM = 10 +.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) + + + + +; --------------------------------------------------------------------------- +; defines for values + +.equ VALUE_ID_DS18B20_TEMP = 0x06 + +.equ VALUE_ID_LEDSIMPLE_TIMING = 0x88 +;.equ VALUE_ID_ROUTER_SETRANGE = 0x89 + + + +; *************************************************************************** +; code segment + +.cseg +.org 000000 + + + +; --------------------------------------------------------------------------- +; Reset and interrupt vectors + + rjmp BOOTLOADER_ADDR ; 1: RESET Reset vector use this for flashed system + reti ; 2: INT0 External Interrupt Request 0 + rjmp com2wPcintIsr ; 3: PCINT0 Pin Change Interrupt 0 + reti ; 4: PCINT1 Pin Change Interrupt 1 + reti ; 5: WDT Watchdog Time-out + reti ; 6: TIM1_CAPT Timer/Counter1 Capture Event + reti ; 7: TIM1_COMPA (OC1A) Timer/Counter1 Compare Match A + reti ; 8: TIM1_COMPB (OC1B) Timer/Counter1 Compare Match B + reti ; 9: TIM1_OVF (OVF1) Timer/Counter1 Overflow + rjmp baseTimerIrqOC0A ; 10: TIM0_COMPA (OC0A) Timer/Counter0 Compare Match A + reti ; 11: TIM0_COMPB (OC0B) Timer/Counter0 Compare Match B + reti ; 12: TIM0_OVF (OVF0) Timer/Counter0 Overflow + reti ; 13: ANA_COMP0 Analog Comparator 0 + reti ; 14: ADC_READY ADC Conversion Complete + reti ; 15: EE_RDY (ERDY) EEPROM Ready + reti ; 16: ANA_COMP1 Analog Comparator 1 + reti ; 17: TIM2_CAPT Timer/Counter2 Capture Event + reti ; 18: TIM2_COMPA (OC2A) Timer/Counter2 Compare Match A + reti ; 19: TIM2_COMPB (OC2B) Timer/Counter2 Compare Match B + reti ; 20: TIM2_OVF (OVF2) Timer/Counter2 Overflow + reti ; 21: SPI SPI Serial Transfer Complete + reti ; 22: USART0_RXS USART0 Rx Start + rjmp UARTFD0_RxCharIsr ; 23: USART0_RXC USART0 Rx Complete + rjmp UARTFD0_TxUdreIsr ; 24: USART0_DRE USART0 Data Register Empty + rjmp UARTFD0_TxCharIsr ; 25: USART0_TXC USART0 Tx Complete + reti ; 26: USART1_RXS USART1 Rx Start + reti ; 27: USART1_RXC USART1 Rx Complete + reti ; 28: USART1_DRE USART1 Data Register Empty + reti ; 29: USART1_TXC USART1 Tx Complete + reti ; 30: TWI Two-Wire-Interface + reti ; 31: RESERVED reserved + + + +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_TEMP_WINDOW, FIRMWARE_VERSION_MAJOR + .db FIRMWARE_VERSION_MINOR, FIRMWARE_VERSION_PATCHLEVEL + + + +; --------------------------------------------------------------------------- +; @routine firmwareStart @global + +firmwareStart: + rjmp main +; @end + + + +; --------------------------------------------------------------------------- +; @routine onSystemStart + +onSystemStart: + ldi r16, 0xf0 + sts netInterfaceData+NET_IFACE_OFFS_ADDRESS, r16 + sts netInterfaceData2+NET_IFACE_OFFS_ADDRESS, r16 + ret +; @end + + + +onEvery100ms: +onEverySecond: +onEveryMinute: +onEveryHour: +onEveryDay: + ret + + + +; --------------------------------------------------------------------------- +; @routine onEveryLoop +; +; Called on every loop (i.e. after awakening from sleep). + +onEveryLoop: + ret +; @end + + + +; --------------------------------------------------------------------------- +; @routine onMessageReceived +; +; Called on every message received + +onMessageReceived: + clc + ret +; @end + + + + + + +; *************************************************************************** +; includes + +.include "devices/all/hw_tn841.asm" +.include "devices/all/includes.asm" +.include "common/debug.asm" + + + + +; --------------------------------------------------------------------------- +; defines for network interface + +.equ netInterfaceData = uartFd0_iface +.equ netInterfaceData2 = com2w_iface + + diff --git a/avr/devices/n29/0BUILD b/avr/devices/n29/0BUILD new file mode 100644 index 0000000..dc4c439 --- /dev/null +++ b/avr/devices/n29/0BUILD @@ -0,0 +1,18 @@ + + + + + + boot + main + + + + defs.asm + README + + + + + + diff --git a/avr/devices/n29/README b/avr/devices/n29/README new file mode 100644 index 0000000..e5dacce --- /dev/null +++ b/avr/devices/n29/README @@ -0,0 +1,15 @@ + +N29 +=== + +- Role: Air quality and climate sensors +- MCU: AtTiny84 +- Connection: RJ45 +- Predecessor: N27, N24, N23, N19 +- Periphery: + - PIR sensor (AMN31112) + - TWI interface + - SI7021 temperature and humidity sensor + or + - SGP-30/40 air quality sensor + - Photo LED diff --git a/avr/devices/n29/boot/0BUILD b/avr/devices/n29/boot/0BUILD new file mode 100644 index 0000000..f3702ec --- /dev/null +++ b/avr/devices/n29/boot/0BUILD @@ -0,0 +1,32 @@ + + + + + + + + -I $(builddir) + -I $(srcdir) + -I $(topsrcdir)/avr + -I $(topbuilddir)/avr + + + + + boot.asm + + + + + + + + + + + + + + + + diff --git a/avr/devices/n29/boot/boot.asm b/avr/devices/n29/boot/boot.asm new file mode 100644 index 0000000..7f35036 --- /dev/null +++ b/avr/devices/n29/boot/boot.asm @@ -0,0 +1,157 @@ +; *************************************************************************** +; copyright : (C) 2026 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 base system node on AtTiny 84 +; +; This is for the maintenance system (i.e. the flash loader). +; +; All definitions and changes should go into this file. +; *************************************************************************** + +.equ clock=1000000 ; Define the clock frequency + +.nolist +.include "include/tn84def.inc" ; Define device ATtiny84 +.list + +.include "version.asm" +.include "../defs.asm" + +.include "common/calls.asm" +.include "common/utils_io.asm" +.include "devices/all/defs.asm" + + +#define COM_ACCEPT_ALL_DEST + + + +; *************************************************************************** +; defines + +; --------------------------------------------------------------------------- +; generic + +.include "common/utils_wait.asm" +.include "modules/com2/defs.asm" +.include "modules/comproto/defs.asm" + + + +; --------------------------------------------------------------------------- +; firmware settings + + + +; --------------------------------------------------------------------------- +; LED + +.equ LED_DDR = DDRA +.equ LED_PORT = PORTA +.equ LED_PIN = PINA +.equ LED_PINNUM = PORTA3 + + +; *************************************************************************** +; code segment + +.cseg +.org 0x0000 + + + +; --------------------------------------------------------------------------- +; Reset and interrupt vectors +; rjmp start ; Reset vector + rjmp main ; Reset vector + reti ; EXT_INT0 + reti ; PCI0 + reti ; PCI1 + reti ; WATCHDOG + reti ; ICP1 + reti ; OC1A + reti ; OC1B + reti ; OVF1 + reti ; OC0A + reti ; OC0B + reti ; OVF0 + reti ; ACI + reti ; ADCC + reti ; ERDY + reti ; USI_STR + reti ; 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_BOOT, FIRMWARE_VERSION_MAJOR + .db FIRMWARE_VERSION_MINOR, FIRMWARE_VERSION_PATCHLEVEL + +firmwareStart: rjmp main ; will be overwritten when flashing + + + +; *************************************************************************** +; main code + + +.org BOOTLOADER_ADDR + + +main: + rjmp bootLoader ; this routine is in modules/bootloader/main.asm + + + +; *************************************************************************** +; includes + +.include "common/utils_wait_fixed.asm" +.include "common/utils_copy_from_flash.asm" +.include "common/utils_copy_sdram.asm" + +.include "modules/flash/defs.asm" +.include "modules/flash/eeprom.asm" +.include "modules/flash/io.asm" +.include "modules/flash/io_com2w.asm" +.include "modules/flash/flash1p.asm" +.include "modules/flash/flashxp.asm" +.include "modules/flash/flashprocess.asm" +.include "modules/flash/wait.asm" +.include "modules/bootloader/main.asm" +.include "modules/network/msg/defs.asm" +.include "modules/network/msg/crc.asm" + +;.include "common/debug.asm" + + + +systemSetSpeed: +.if clock == 8000000 + ldi r16, (1< - + -I $(builddir) diff --git a/avr/devices/c02/main/data.asm b/avr/devices/n29/main/data.asm similarity index 100% rename from avr/devices/c02/main/data.asm rename to avr/devices/n29/main/data.asm diff --git a/avr/devices/n29/main/main.asm b/avr/devices/n29/main/main.asm new file mode 100644 index 0000000..eb36eca --- /dev/null +++ b/avr/devices/n29/main/main.asm @@ -0,0 +1,222 @@ +; *************************************************************************** +; copyright : (C) 2026 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 temperature sensor node on AtTiny 84 +; +; This is for the full system (i.e. not the boot loader). +; +; All definitions and changes should go into this file. +; +; +; *************************************************************************** + + +.equ clock=1000000 ; Define the clock frequency +;.equ clock=8000000 ; Define the clock frequency + + + +.nolist +.include "include/tn84def.inc" ; Define device ATtiny84 +.list + +.include "../defs.asm" +.include "./data.asm" + +.include "version.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_TIMER +#define MODULES_CLOCK +#define MODULES_LED_SIMPLE +;#define MODULES_LED_ACTIVITY +#define MODULES_NETWORK +;#define MODULES_UART_BITBANG +#define MODULES_COM2W +#define MODULES_TWI_MASTER +;#define MODULES_LCD +;#define LCD_MINIMAL_FONT +#define MODULES_SI7021 +#define MODULES_SGP30 +;#define MODULES_SGP40 +;#define MODULES_STATS +;#define MODULES_OWI_MASTER +;#define MODULES_DS18B20 +#define MODULES_MOTION +;#define MODULES_CCS811 +#define MODULES_BRIGHTNESS + +#define APPS_NETWORK +#define APPS_MOTION +#define APPS_REPORTSENSORS +#define APPS_STATS + + + +; --------------------------------------------------------------------------- +; defines for values + +.equ VALUE_ID_SI7021_TEMP = 0x01 +.equ VALUE_ID_SI7021_HUM = 0x02 + +.equ VALUE_ID_ADC = 0x03 +;.equ VALUE_ID_DS18B20_TEMP = 0x06 +.equ VALUE_ID_MOTION = 0x07 + +;.equ VALUE_ID_SGP40_TVOC = 0x08 + +.equ VALUE_ID_SGP30_TVOC = 0x09 +.equ VALUE_ID_SGP30_CO2 = 0x0a + +.equ VALUE_ID_BRIGHTNESS = 0x0b + +.equ VALUE_ID_LEDSIMPLE_TIMING = 0x88 + + + + + +; *************************************************************************** +; code segment + +.cseg +.org 000000 + + + +; --------------------------------------------------------------------------- +; 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 + reti ; EXT_INT0 + rjmp com2wPcintIsr ; PCI0 + reti ; PCI1 + reti ; WATCHDOG + reti ; ICP1 + reti ; OC1A + reti ; OC1B + reti ; OVF1 + rjmp baseTimerIrqOC0A ; OC0A + reti ; OC0B + reti ; OVF0 + reti ; ACI + reti ; ADCC + reti ; ERDY + reti ; USI_STR + reti ; 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_TEMP_WINDOW, 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: +onEverySecond: +onEveryMinute: +onEveryHour: +onEveryDay: + 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" + + + +; --------------------------------------------------------------------------- +; defines for network interface + +.equ netInterfaceData = com2w_iface + + +