522 lines
19 KiB
NASM
522 lines
19 KiB
NASM
; ***************************************************************************
|
|
; 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. *
|
|
; ***************************************************************************
|
|
|
|
#ifndef AQH_AVR_DEVICE_C03_WIN_NETWORK_ASM
|
|
#define AQH_AVR_DEVICE_C03_WIN_NETWORK_ASM
|
|
|
|
|
|
|
|
; ***************************************************************************
|
|
; defines
|
|
|
|
|
|
.equ WINNETWORK_INTERVAL_100ms = 50 ; update every 5s
|
|
|
|
; SDRAM data for WINNETWORK
|
|
.equ WINNETWORK_SD_OFFS_BEGIN = WIDGET_SD_SIZE
|
|
.equ WINNETWORK_SD_OFFS_TIMER = WINNETWORK_SD_OFFS_BEGIN+0
|
|
.equ WINNETWORK_SD_SIZE = WINNETWORK_SD_OFFS_BEGIN+1
|
|
|
|
|
|
|
|
; ***************************************************************************
|
|
; data
|
|
|
|
.dseg
|
|
|
|
|
|
winNetwork_ramdata:
|
|
.byte WINNETWORK_SD_SIZE
|
|
|
|
winNetworkHeader_ramdata:
|
|
.byte WIDGET_SD_SIZE
|
|
|
|
winNetworkBody_ramdata:
|
|
.byte WIDGET_SD_SIZE
|
|
|
|
winNetworkLabel1_ramdata:
|
|
.byte WIDGET_SD_SIZE
|
|
|
|
winNetworkLabel2_ramdata:
|
|
.byte WIDGET_SD_SIZE
|
|
|
|
winNetworkLabel3_ramdata:
|
|
.byte WIDGET_SD_SIZE
|
|
|
|
winNetworkLabel4_ramdata:
|
|
.byte WIDGET_SD_SIZE
|
|
|
|
winNetworkLabel5_ramdata:
|
|
.byte WIDGET_SD_SIZE
|
|
|
|
winNetworkValue1_ramdata:
|
|
.byte VLABEL_SD_SIZE
|
|
|
|
winNetworkValue2_ramdata:
|
|
.byte VLABEL_SD_SIZE
|
|
|
|
winNetworkValue3_ramdata:
|
|
.byte VLABEL_SD_SIZE
|
|
|
|
winNetworkValue4_ramdata:
|
|
.byte VLABEL_SD_SIZE
|
|
|
|
winNetworkValue5_ramdata:
|
|
.byte VLABEL_SD_SIZE
|
|
|
|
buttonNetworkBack_ramdata:
|
|
.byte IMGVIEW_SD_SIZE
|
|
|
|
|
|
|
|
; ***************************************************************************
|
|
; code
|
|
|
|
.cseg
|
|
|
|
|
|
winNetwork:
|
|
; OBJECT
|
|
.db 0x55, 0xaa ; magic
|
|
.dw winEepromDump*2 ; next
|
|
.dw winRoot*2 ; parent
|
|
.dw winNetworkHeader*2 ; first child
|
|
.dw 0 ; target
|
|
.dw 0 ; selector (ony lower 8 bits used)
|
|
.dw winNetwork_signalmap*2 ; signal map
|
|
; WIDGET
|
|
.db (1<<WIDGET_OPTSLO_TIMER_BIT), 0 ; opts lo, hi
|
|
.dw 0 ; X
|
|
.dw 0 ; Y
|
|
.dw DISPLAY_WIDTH ; W
|
|
.dw DISPLAY_HEIGHT ; H
|
|
.dw STYLE_WIN_FOREGROUND ; front color
|
|
.dw STYLE_WIN_BACKGROUND ; back color
|
|
.dw STYLE_WIN_FONT*2 ; font
|
|
.dw winNetwork_ramdata ; ptr to SDRAM
|
|
|
|
winNetwork_signalmap:
|
|
.db 0, OBJECT_SIGNAL_TIMER, LOW(WinNetwork_OnTimer), HIGH(WinNetwork_OnTimer)
|
|
.db 0, OBJECT_SIGNAL_CREATE, LOW(WinNetwork_OnCreate), HIGH(WinNetwork_OnCreate)
|
|
.db 0, WIDGET_SIGNAL_DRAW, LOW(Widget_OnDraw), HIGH(Widget_OnDraw)
|
|
.db 0, 0, 0, 0 ; end of table
|
|
|
|
|
|
|
|
winNetworkHeader:
|
|
; OBJECT
|
|
.db 0x55, 0xaa ; magic
|
|
.dw winNetworkBody*2 ; next
|
|
.dw winNetwork*2 ; parent
|
|
.dw 0 ; first child
|
|
.dw 0 ; target
|
|
.dw 0 ; selector (ony lower 8 bits used)
|
|
.dw Label_DefaultSignalmap*2 ; signal map
|
|
; WIDGET
|
|
.db 0, 0 ; opts lo, hi
|
|
.dw 0 ; X
|
|
.dw 0 ; Y
|
|
.dw DISPLAY_WIDTH ; W
|
|
.dw STYLE_WIN_TITLE_HEIGHT ; H
|
|
.dw STYLE_WIN_TITLE_FOREGROUND ; front color
|
|
.dw STYLE_WIN_TITLE_BACKGROUND ; back color
|
|
.dw STYLE_WIN_FONT*2 ; font
|
|
.dw winNetworkHeader_ramdata ; ptr to SDRAM
|
|
; LABEL
|
|
.dw winNetworkHeader_text*2 ; text
|
|
|
|
winNetworkHeader_text:
|
|
.db "Netzwerk", 0, 0
|
|
|
|
|
|
|
|
winNetworkBody:
|
|
; OBJECT
|
|
.db 0x55, 0xaa ; magic
|
|
.dw 0 ; next
|
|
.dw winNetwork*2 ; parent
|
|
.dw winNetworkLabel1*2 ; first child
|
|
.dw 0 ; target
|
|
.dw 0 ; selector (ony lower 8 bits used)
|
|
.dw winNetworkBody_signalmap*2 ; signal map
|
|
; WIDGET
|
|
.db 0, 0 ; opts lo, hi
|
|
.dw 0 ; X
|
|
.dw STYLE_WIN_TITLE_HEIGHT ; Y
|
|
.dw DISPLAY_WIDTH ; W
|
|
.dw DISPLAY_HEIGHT-STYLE_WIN_TITLE_HEIGHT ; H
|
|
.dw STYLE_WIN_FOREGROUND ; front color
|
|
; .dw DISPLAY_COLOR_YELLOW
|
|
.dw STYLE_WIN_BACKGROUND ; back color
|
|
.dw STYLE_WIN_FONT*2 ; font
|
|
.dw winNetworkBody_ramdata ; ptr to SDRAM
|
|
|
|
winNetworkBody_signalmap:
|
|
.db 0, OBJECT_SIGNAL_CREATE, LOW(Widget_OnCreate), HIGH(Widget_OnCreate)
|
|
.db 0, WIDGET_SIGNAL_DRAW, LOW(Widget_OnDraw), HIGH(Widget_OnDraw)
|
|
.db 0, 0, 0, 0 ; end of table
|
|
|
|
|
|
|
|
winNetworkLabel1:
|
|
; OBJECT
|
|
.db 0x55, 0xaa ; magic
|
|
.dw winNetworkLabel2*2 ; next
|
|
.dw winNetworkBody*2 ; parent
|
|
.dw 0 ; first child
|
|
.dw 0 ; target
|
|
.dw 0 ; selector (ony lower 8 bits used)
|
|
.dw Label_DefaultSignalmap*2 ; signal map
|
|
; WIDGET
|
|
.db 0, 0 ; opts lo, hi
|
|
.dw 2 ; X
|
|
.dw 2 ; Y
|
|
.dw 160 ; W
|
|
.dw STYLE_WIN_FONT_HEIGHT+2 ; H
|
|
.dw STYLE_WIN_FOREGROUND ; front color
|
|
.dw STYLE_WIN_BACKGROUND ; back color
|
|
.dw STYLE_WIN_FONT*2 ; font
|
|
.dw winNetworkLabel1_ramdata ; ptr to SDRAM
|
|
; LABEL
|
|
.dw winNetworkLabel1_text*2 ; text
|
|
|
|
winNetworkLabel1_text:
|
|
.db "Packets in", 0, 0
|
|
|
|
|
|
winNetworkLabel2:
|
|
; OBJECT
|
|
.db 0x55, 0xaa ; magic
|
|
.dw winNetworkLabel3*2 ; next
|
|
.dw winNetworkBody*2 ; parent
|
|
.dw 0 ; first child
|
|
.dw 0 ; target
|
|
.dw 0 ; selector (ony lower 8 bits used)
|
|
.dw Label_DefaultSignalmap*2 ; signal map
|
|
; WIDGET
|
|
.db 0, 0 ; opts lo, hi
|
|
.dw 2 ; X
|
|
.dw 2+(1*(STYLE_WIN_FONT_HEIGHT+2)) ; Y
|
|
.dw 160 ; W
|
|
.dw STYLE_WIN_FONT_HEIGHT+2 ; H
|
|
.dw STYLE_WIN_FOREGROUND ; front color
|
|
.dw STYLE_WIN_BACKGROUND ; back color
|
|
.dw STYLE_WIN_FONT*2 ; font
|
|
.dw winNetworkLabel2_ramdata ; ptr to SDRAM
|
|
; LABEL
|
|
.dw winNetworkLabel2_text*2 ; text
|
|
|
|
winNetworkLabel2_text:
|
|
.db "Packets out", 0
|
|
|
|
|
|
|
|
winNetworkLabel3:
|
|
; OBJECT
|
|
.db 0x55, 0xaa ; magic
|
|
.dw winNetworkLabel4*2 ; next
|
|
.dw winNetworkBody*2 ; parent
|
|
.dw 0 ; first child
|
|
.dw 0 ; target
|
|
.dw 0 ; selector (ony lower 8 bits used)
|
|
.dw Label_DefaultSignalmap*2 ; signal map
|
|
; WIDGET
|
|
.db 0, 0 ; opts lo, hi
|
|
.dw 2 ; X
|
|
.dw 2+(2*(STYLE_WIN_FONT_HEIGHT+2)) ; Y
|
|
.dw 160 ; W
|
|
.dw STYLE_WIN_FONT_HEIGHT+2 ; H
|
|
.dw STYLE_WIN_FOREGROUND ; front color
|
|
.dw STYLE_WIN_BACKGROUND ; back color
|
|
.dw STYLE_WIN_FONT*2 ; font
|
|
.dw winNetworkLabel3_ramdata ; ptr to SDRAM
|
|
; LABEL
|
|
.dw winNetworkLabel3_text*2 ; text
|
|
|
|
winNetworkLabel3_text:
|
|
.db "eContent", 0, 0
|
|
|
|
|
|
|
|
winNetworkLabel4:
|
|
; OBJECT
|
|
.db 0x55, 0xaa ; magic
|
|
.dw winNetworkLabel5*2 ; next
|
|
.dw winNetworkBody*2 ; parent
|
|
.dw 0 ; first child
|
|
.dw 0 ; target
|
|
.dw 0 ; selector (ony lower 8 bits used)
|
|
.dw Label_DefaultSignalmap*2 ; signal map
|
|
; WIDGET
|
|
.db 0, 0 ; opts lo, hi
|
|
.dw 2 ; X
|
|
.dw 2+(3*(STYLE_WIN_FONT_HEIGHT+2)) ; Y
|
|
.dw 160 ; W
|
|
.dw STYLE_WIN_FONT_HEIGHT+2 ; H
|
|
.dw STYLE_WIN_FOREGROUND ; front color
|
|
.dw STYLE_WIN_BACKGROUND ; back color
|
|
.dw STYLE_WIN_FONT*2 ; font
|
|
.dw winNetworkLabel4_ramdata ; ptr to SDRAM
|
|
; LABEL
|
|
.dw winNetworkLabel4_text*2 ; text
|
|
|
|
winNetworkLabel4_text:
|
|
.db "eIO", 0
|
|
|
|
|
|
|
|
winNetworkLabel5:
|
|
; OBJECT
|
|
.db 0x55, 0xaa ; magic
|
|
.dw winNetworkValue1*2 ; next
|
|
.dw winNetworkBody*2 ; parent
|
|
.dw 0 ; first child
|
|
.dw 0 ; target
|
|
.dw 0 ; selector (ony lower 8 bits used)
|
|
.dw Label_DefaultSignalmap*2 ; signal map
|
|
; WIDGET
|
|
.db 0, 0 ; opts lo, hi
|
|
.dw 2 ; X
|
|
.dw 2+(4*(STYLE_WIN_FONT_HEIGHT+2)) ; Y
|
|
.dw 160 ; W
|
|
.dw STYLE_WIN_FONT_HEIGHT+2 ; H
|
|
.dw STYLE_WIN_FOREGROUND ; front color
|
|
.dw STYLE_WIN_BACKGROUND ; back color
|
|
.dw STYLE_WIN_FONT*2 ; font
|
|
.dw winNetworkLabel5_ramdata ; ptr to SDRAM
|
|
; LABEL
|
|
.dw winNetworkLabel5_text*2 ; text
|
|
|
|
winNetworkLabel5_text:
|
|
.db "eMsgSize", 0, 0
|
|
|
|
|
|
|
|
winNetworkValue1:
|
|
; OBJECT
|
|
.db 0x55, 0xaa ; magic
|
|
.dw winNetworkValue2*2 ; next
|
|
.dw winNetworkBody*2 ; parent
|
|
.dw 0 ; first child
|
|
.dw 0 ; target
|
|
.dw 0 ; selector (ony lower 8 bits used)
|
|
.dw ValueLabel_DefaultSignalmap*2 ; signal map
|
|
; WIDGET
|
|
.db 0, (1<<WIDGET_OPTSHI_HALIGNRIGHT_BIT) ; opts lo, hi
|
|
.dw 164 ; X
|
|
.dw 2 ; Y
|
|
.dw 96 ; W
|
|
.dw STYLE_WIN_FONT_HEIGHT+4 ; H
|
|
.dw STYLE_WIN_FOREGROUND ; front color
|
|
.dw STYLE_WIN_BACKGROUND ; back color
|
|
.dw STYLE_WIN_FONT*2 ; font
|
|
.dw winNetworkValue1_ramdata ; ptr to SDRAM
|
|
; VALUELABEL
|
|
.db 0, 0 ; num of post-komma digits
|
|
|
|
|
|
|
|
winNetworkValue2:
|
|
; OBJECT
|
|
.db 0x55, 0xaa ; magic
|
|
.dw winNetworkValue3*2 ; next
|
|
.dw winNetworkBody*2 ; parent
|
|
.dw 0 ; first child
|
|
.dw 0 ; target
|
|
.dw 0 ; selector (ony lower 8 bits used)
|
|
.dw ValueLabel_DefaultSignalmap*2 ; signal map
|
|
; WIDGET
|
|
.db 0, (1<<WIDGET_OPTSHI_HALIGNRIGHT_BIT) ; opts lo, hi
|
|
.dw 164 ; X
|
|
.dw 2+(1*(STYLE_WIN_FONT_HEIGHT+2)) ; Y
|
|
.dw 96 ; W
|
|
.dw STYLE_WIN_FONT_HEIGHT+4 ; H
|
|
.dw STYLE_WIN_FOREGROUND ; front color
|
|
.dw STYLE_WIN_BACKGROUND ; back color
|
|
.dw STYLE_WIN_FONT*2 ; font
|
|
.dw winNetworkValue2_ramdata ; ptr to SDRAM
|
|
; VALUELABEL
|
|
.db 0, 0 ; num of post-komma digits
|
|
|
|
|
|
|
|
winNetworkValue3:
|
|
; OBJECT
|
|
.db 0x55, 0xaa ; magic
|
|
.dw winNetworkValue4*2 ; next
|
|
.dw winNetworkBody*2 ; parent
|
|
.dw 0 ; first child
|
|
.dw 0 ; target
|
|
.dw 0 ; selector (ony lower 8 bits used)
|
|
.dw ValueLabel_DefaultSignalmap*2 ; signal map
|
|
; WIDGET
|
|
.db 0, (1<<WIDGET_OPTSHI_HALIGNRIGHT_BIT) ; opts lo, hi
|
|
.dw 164 ; X
|
|
.dw 2+(2*(STYLE_WIN_FONT_HEIGHT+2)) ; Y
|
|
.dw 96 ; W
|
|
.dw STYLE_WIN_FONT_HEIGHT+4 ; H
|
|
.dw STYLE_WIN_FOREGROUND ; front color
|
|
.dw STYLE_WIN_BACKGROUND ; back color
|
|
.dw STYLE_WIN_FONT*2 ; font
|
|
.dw winNetworkValue3_ramdata ; ptr to SDRAM
|
|
; VALUELABEL
|
|
.db 0, 0 ; num of post-komma digits
|
|
|
|
|
|
|
|
winNetworkValue4:
|
|
; OBJECT
|
|
.db 0x55, 0xaa ; magic
|
|
.dw winNetworkValue5*2 ; next
|
|
.dw winNetworkBody*2 ; parent
|
|
.dw 0 ; first child
|
|
.dw 0 ; target
|
|
.dw 0 ; selector (ony lower 8 bits used)
|
|
.dw ValueLabel_DefaultSignalmap*2 ; signal map
|
|
; WIDGET
|
|
.db 0, (1<<WIDGET_OPTSHI_HALIGNRIGHT_BIT) ; opts lo, hi
|
|
.dw 164 ; X
|
|
.dw 2+(3*(STYLE_WIN_FONT_HEIGHT+2)) ; Y
|
|
.dw 96 ; W
|
|
.dw STYLE_WIN_FONT_HEIGHT+4 ; H
|
|
.dw STYLE_WIN_FOREGROUND ; front color
|
|
.dw STYLE_WIN_BACKGROUND ; back color
|
|
.dw STYLE_WIN_FONT*2 ; font
|
|
.dw winNetworkValue4_ramdata ; ptr to SDRAM
|
|
; VALUELABEL
|
|
.db 0, 0 ; num of post-komma digits
|
|
|
|
|
|
|
|
winNetworkValue5:
|
|
; OBJECT
|
|
.db 0x55, 0xaa ; magic
|
|
.dw buttonNetworkBack*2 ; next
|
|
.dw winNetworkBody*2 ; parent
|
|
.dw 0 ; first child
|
|
.dw 0 ; target
|
|
.dw 0 ; selector (ony lower 8 bits used)
|
|
.dw ValueLabel_DefaultSignalmap*2 ; signal map
|
|
; WIDGET
|
|
.db 0, (1<<WIDGET_OPTSHI_HALIGNRIGHT_BIT) ; opts lo, hi
|
|
.dw 164 ; X
|
|
.dw 2+(4*(STYLE_WIN_FONT_HEIGHT+2)) ; Y
|
|
.dw 96 ; W
|
|
.dw STYLE_WIN_FONT_HEIGHT+4 ; H
|
|
.dw STYLE_WIN_FOREGROUND ; front color
|
|
.dw STYLE_WIN_BACKGROUND ; back color
|
|
.dw STYLE_WIN_FONT*2 ; font
|
|
.dw winNetworkValue5_ramdata ; ptr to SDRAM
|
|
; VALUELABEL
|
|
.db 0, 0 ; num of post-komma digits
|
|
|
|
|
|
|
|
|
|
buttonNetworkBack:
|
|
; OBJECT
|
|
.db 0x55, 0xaa ; magic
|
|
.dw 0 ; next
|
|
.dw winNetworkBody*2 ; parent
|
|
.dw 0 ; first child
|
|
.dw appC03*2 ; target
|
|
.dw APPC03_SEL_BUTTON_CLIMATE ; selector (ony lower 8 bits used)
|
|
.dw Button_DefaultSignalmap*2 ; signal map
|
|
; WIDGET
|
|
.db (1<<WIDGET_OPTSLO_INPUT_BIT) | (1<<WIDGET_OPTSLO_BORDER_BIT), 0 ; opts lo, hi
|
|
.dw DISPLAY_WIDTH-56 ; X
|
|
.dw DISPLAY_HEIGHT-STYLE_WIN_TITLE_HEIGHT-56 ; Y
|
|
.dw 52 ; W
|
|
.dw 52 ; H
|
|
.dw STYLE_BUTTON_COL_FG_NORM ; front color
|
|
.dw STYLE_BUTTON_COL_BG_NORM ; back color
|
|
.dw STYLE_WIN_FONT*2 ; font
|
|
.dw buttonClimateNetwork_ramdata ; ptr to SDRAM
|
|
; IMGVIEW
|
|
.dw RESSSOURCE_IMG_ARROWBACK ; ressource id
|
|
|
|
|
|
|
|
|
|
|
|
WinNetwork_OnCreate:
|
|
bigcall Widget_OnCreate
|
|
bigcall Widget_GetSdramPtr ; (none)
|
|
ldi r16, WINNETWORK_INTERVAL_100ms
|
|
std Y+WINNETWORK_SD_OFFS_TIMER, r16
|
|
sec
|
|
ret
|
|
; @end
|
|
|
|
|
|
|
|
WinNetwork_OnTimer:
|
|
push zl
|
|
push zh
|
|
bigcall Widget_GetSdramPtr ; (none)
|
|
ldd r16, Y+WINNETWORK_SD_OFFS_TIMER
|
|
tst r16
|
|
breq WinNetwork_OnTimer_ret
|
|
dec r16
|
|
brne WinNetwork_OnTimer_store
|
|
|
|
ldi zl, LOW(winNetworkValue1*2)
|
|
ldi zh, HIGH(winNetworkValue1*2)
|
|
ldi r16, VLABEL_SIGNAL_SETVALUE
|
|
clr r17
|
|
lds xl, netInterfaceData+NET_IFACE_OFFS_PACKETSIN_LOW
|
|
lds xh, netInterfaceData+NET_IFACE_OFFS_PACKETSIN_HIGH
|
|
bigcall OBJ_HandleSignal
|
|
|
|
ldi zl, LOW(winNetworkValue2*2)
|
|
ldi zh, HIGH(winNetworkValue2*2)
|
|
ldi r16, VLABEL_SIGNAL_SETVALUE
|
|
clr r17
|
|
lds xl, netInterfaceData+NET_IFACE_OFFS_PACKETSOUT_LOW
|
|
lds xh, netInterfaceData+NET_IFACE_OFFS_PACKETSOUT_HIGH
|
|
bigcall OBJ_HandleSignal
|
|
|
|
ldi zl, LOW(winNetworkValue3*2)
|
|
ldi zh, HIGH(winNetworkValue3*2)
|
|
ldi r16, VLABEL_SIGNAL_SETVALUE
|
|
clr r17
|
|
lds xl, netInterfaceData+NET_IFACE_OFFS_ERR_CONTENT_LOW
|
|
lds xh, netInterfaceData+NET_IFACE_OFFS_ERR_CONTENT_HIGH
|
|
bigcall OBJ_HandleSignal
|
|
|
|
ldi zl, LOW(winNetworkValue4*2)
|
|
ldi zh, HIGH(winNetworkValue4*2)
|
|
ldi r16, VLABEL_SIGNAL_SETVALUE
|
|
clr r17
|
|
lds xl, netInterfaceData+NET_IFACE_OFFS_ERR_IO_LOW
|
|
lds xh, netInterfaceData+NET_IFACE_OFFS_ERR_IO_HIGH
|
|
bigcall OBJ_HandleSignal
|
|
|
|
ldi zl, LOW(winNetworkValue5*2)
|
|
ldi zh, HIGH(winNetworkValue5*2)
|
|
ldi r16, VLABEL_SIGNAL_SETVALUE
|
|
clr r17
|
|
lds xl, netInterfaceData+NET_IFACE_OFFS_ERR_MSGSIZE_LOW
|
|
lds xh, netInterfaceData+NET_IFACE_OFFS_ERR_MSGSIZE_HIGH
|
|
bigcall OBJ_HandleSignal
|
|
|
|
ldi r16, WINNETWORK_INTERVAL_100ms
|
|
WinNetwork_OnTimer_store:
|
|
std Y+WINNETWORK_SD_OFFS_TIMER, r16
|
|
WinNetwork_OnTimer_ret:
|
|
pop zh
|
|
pop zl
|
|
sec
|
|
ret
|
|
; @end
|
|
|
|
|
|
|
|
#endif
|