c03: removed old main firmware folder, make "test" folder new main.
This commit is contained in:
267
avr/devices/c03/main/w_menu.asm
Normal file
267
avr/devices/c03/main/w_menu.asm
Normal file
@@ -0,0 +1,267 @@
|
||||
; ***************************************************************************
|
||||
; 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_W_MENU_ASM
|
||||
#define AQH_AVR_W_MENU_ASM
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; defines
|
||||
|
||||
.equ MENUWIN_OFFS_BEGIN = MAINWINDOW_SIZE
|
||||
.equ MENUWIN_SIZE = MENUWIN_OFFS_BEGIN+0
|
||||
|
||||
|
||||
.equ MENUWIN_SIGNAL_CLIMATE = WIDGET_SIGNAL_NEXTFREE+0
|
||||
.equ MENUWIN_SIGNAL_LIGHT = WIDGET_SIGNAL_NEXTFREE+1
|
||||
.equ MENUWIN_SIGNAL_WINDOWS = WIDGET_SIGNAL_NEXTFREE+2
|
||||
.equ MENUWIN_SIGNAL_DEBUG = WIDGET_SIGNAL_NEXTFREE+3
|
||||
.equ MENUWIN_SIGNAL_NETSTATS = WIDGET_SIGNAL_NEXTFREE+4
|
||||
.equ MENUWIN_SIGNAL_NEXTFREE = WIDGET_SIGNAL_NEXTFREE+5
|
||||
|
||||
|
||||
.equ MENUWIN_SEL_CLIMATE = 1
|
||||
.equ MENUWIN_SEL_LIGHT = 2
|
||||
.equ MENUWIN_SEL_WINDOWS = 3
|
||||
.equ MENUWIN_SEL_DEBUG = 4
|
||||
.equ MENUWIN_SEL_NETSTATS = 5
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; code
|
||||
|
||||
.cseg
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine MenuWin_new @global
|
||||
;
|
||||
; @param Y pointer to GUIAPP
|
||||
; @return CFLAG set of okay, cleared otherwise
|
||||
; @return Y address of newly created object
|
||||
|
||||
MenuWin_new:
|
||||
bigcall GuiApp_GetRootWindow
|
||||
brcc MenuWin_new_ret
|
||||
mov xl, r18 ; use root window as parent for main window
|
||||
mov xh, r19
|
||||
|
||||
ldi r16, 0 ; OPTS
|
||||
ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
||||
ldi r20, LOW(RESSSOURCE_TXT_AQHOME)
|
||||
ldi r21, HIGH(RESSSOURCE_TXT_AQHOME)
|
||||
bigcall MainWindow_new
|
||||
brcc MenuWin_new_ret
|
||||
|
||||
; set default signal map
|
||||
ldi r16, LOW(MenuWin_DefaultSignalmap*2)
|
||||
std Y+OBJECT_OFFS_SIGNALMAP_LO, r16
|
||||
ldi r16, HIGH(MenuWin_DefaultSignalmap*2)
|
||||
std Y+OBJECT_OFFS_SIGNALMAP_HI, r16
|
||||
|
||||
|
||||
; Y=MainWindow
|
||||
push yl
|
||||
push yh
|
||||
bigcall MainWindow_GetContentWidget ; r19:r18=content window
|
||||
brcc MenuWin_new_popRet
|
||||
mov xl, r18 ; use content window as parent
|
||||
mov xh, r19
|
||||
|
||||
push xl ; content window
|
||||
push xh
|
||||
rcall menuWinCreateContent
|
||||
pop xh
|
||||
pop xl
|
||||
MenuWin_new_popRet:
|
||||
pop yh
|
||||
pop yl
|
||||
MenuWin_new_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine menuWinCreateContent
|
||||
;
|
||||
; @param Y pointer to MainWindow
|
||||
; @param X pointer to MainWindow content window (becomes parent)
|
||||
; @return CFLAG set of okay, cleared otherwise
|
||||
; @return Y address of newly created object
|
||||
|
||||
menuWinCreateContent:
|
||||
; create MLayout
|
||||
push yl
|
||||
push yh
|
||||
ldi r16, 0 ; OPTS
|
||||
ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
||||
ldi r20, 5 ; columns per row
|
||||
bigcall MCLayout_new
|
||||
mov xl, yl ; use MLayout as parent
|
||||
mov xh, yh
|
||||
pop yh
|
||||
pop yl
|
||||
brcc menuWinCreateContent_ret
|
||||
|
||||
ldi r20, LOW(RESSSOURCE_IMG_TEMP)
|
||||
ldi r21, HIGH(RESSSOURCE_IMG_TEMP)
|
||||
ldi r22, MENUWIN_SEL_CLIMATE
|
||||
rcall menuWinCreateButton
|
||||
brcc menuWinCreateContent_ret
|
||||
|
||||
ldi r20, LOW(RESSSOURCE_IMG_LIGHT)
|
||||
ldi r21, HIGH(RESSSOURCE_IMG_LIGHT)
|
||||
ldi r22, MENUWIN_SEL_LIGHT
|
||||
rcall menuWinCreateButton
|
||||
brcc menuWinCreateContent_ret
|
||||
|
||||
ldi r20, LOW(RESSSOURCE_IMG_WINCLOSED)
|
||||
ldi r21, HIGH(RESSSOURCE_IMG_WINCLOSED)
|
||||
ldi r22, MENUWIN_SEL_WINDOWS
|
||||
rcall menuWinCreateButton
|
||||
brcc menuWinCreateContent_ret
|
||||
|
||||
ldi r20, LOW(RESSSOURCE_IMG_NETWORK)
|
||||
ldi r21, HIGH(RESSSOURCE_IMG_NETWORK)
|
||||
ldi r22, MENUWIN_SEL_NETSTATS
|
||||
rcall menuWinCreateButton
|
||||
brcc menuWinCreateContent_ret
|
||||
|
||||
ldi r20, LOW(RESSSOURCE_IMG_DEBUGEEPROM)
|
||||
ldi r21, HIGH(RESSSOURCE_IMG_DEBUGEEPROM)
|
||||
ldi r22, MENUWIN_SEL_DEBUG
|
||||
rcall menuWinCreateButton
|
||||
brcc menuWinCreateContent_ret
|
||||
|
||||
mov yl, xl
|
||||
mov yh, xh
|
||||
sec
|
||||
menuWinCreateContent_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine menuWinCreateButton
|
||||
;
|
||||
; @param Y pointer to MainWindow
|
||||
; @param X parent
|
||||
; @param r21:r20 img ressource
|
||||
; @param r22 selector
|
||||
; @return CFLAG set if new object created, cleared on error
|
||||
; @clobbers any, !X, !Y
|
||||
|
||||
menuWinCreateButton:
|
||||
push xl
|
||||
push xh
|
||||
push yl
|
||||
push yh
|
||||
ldi r16, 0
|
||||
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
||||
bigcall C03App_CreateButton
|
||||
mov xl, yl
|
||||
mov xh, yh
|
||||
pop yh
|
||||
pop yl
|
||||
brcc menuWinCreateButton_popRet
|
||||
adiw xh:xl, OBJECT_OFFS_TARGET_LO
|
||||
st X+, yl
|
||||
st X, yh
|
||||
sbiw xh:xl, (OBJECT_OFFS_TARGET_LO+1)
|
||||
sec
|
||||
menuWinCreateButton_popRet:
|
||||
pop xh
|
||||
pop xl
|
||||
menuWinCreateButton_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine MenuWin_OnCmdClimate
|
||||
|
||||
MenuWin_OnCmdClimate:
|
||||
ldi r16, MENUWIN_SIGNAL_CLIMATE
|
||||
bigcall OBJ_EmitSignal
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine MenuWin_OnCmdLight
|
||||
|
||||
MenuWin_OnCmdLight:
|
||||
ldi r16, MENUWIN_SIGNAL_LIGHT
|
||||
bigcall OBJ_EmitSignal
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine MenuWin_OnCmdWindows
|
||||
|
||||
MenuWin_OnCmdWindows:
|
||||
ldi r16, MENUWIN_SIGNAL_WINDOWS
|
||||
bigcall OBJ_EmitSignal
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine MenuWin_OnCmdNetStats
|
||||
|
||||
MenuWin_OnCmdNetStats:
|
||||
ldi r16, MENUWIN_SIGNAL_NETSTATS
|
||||
bigcall OBJ_EmitSignal
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine MenuWin_OnCmdDebug
|
||||
|
||||
MenuWin_OnCmdDebug:
|
||||
ldi r16, MENUWIN_SIGNAL_DEBUG
|
||||
bigcall OBJ_EmitSignal
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; data in FLASH
|
||||
|
||||
MenuWin_DefaultSignalmap:
|
||||
; header
|
||||
.dw MainWindow_DefaultSignalmap*2 ; next table to use
|
||||
; entries
|
||||
.db MENUWIN_SEL_CLIMATE, WIDGET_SIGNAL_COMMAND, LOW(MenuWin_OnCmdClimate), HIGH(MenuWin_OnCmdClimate)
|
||||
.db MENUWIN_SEL_LIGHT, WIDGET_SIGNAL_COMMAND, LOW(MenuWin_OnCmdLight), HIGH(MenuWin_OnCmdLight)
|
||||
.db MENUWIN_SEL_WINDOWS, WIDGET_SIGNAL_COMMAND, LOW(MenuWin_OnCmdWindows), HIGH(MenuWin_OnCmdWindows)
|
||||
.db MENUWIN_SEL_NETSTATS, WIDGET_SIGNAL_COMMAND, LOW(MenuWin_OnCmdNetStats), HIGH(MenuWin_OnCmdNetStats)
|
||||
.db MENUWIN_SEL_DEBUG, WIDGET_SIGNAL_COMMAND, LOW(MenuWin_OnCmdDebug), HIGH(MenuWin_OnCmdDebug)
|
||||
|
||||
.db 0, 0, 0, 0 ; end of table
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user