147 lines
4.4 KiB
NASM
147 lines
4.4 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_W_CLIMATE_ASM
|
|
#define AQH_AVR_W_CLIMATE_ASM
|
|
|
|
|
|
; ***************************************************************************
|
|
; defines
|
|
|
|
.equ CLIMATEWIN_OFFS_BEGIN = MAINWINDOW_SIZE
|
|
.equ CLIMATEWIN_SIZE = CLIMATEWIN_OFFS_BEGIN+0
|
|
|
|
|
|
|
|
; ***************************************************************************
|
|
; code
|
|
|
|
.cseg
|
|
|
|
|
|
|
|
; ---------------------------------------------------------------------------
|
|
; @routine ClimateWin_new @global
|
|
;
|
|
; @param Y pointer to GUIAPP
|
|
; @return CFLAG set of okay, cleared otherwise
|
|
; @return Y address of newly created object
|
|
|
|
ClimateWin_new:
|
|
bigcall GuiApp_GetRootWindow
|
|
brcc ClimateWin_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_ROOMCLIMATE)
|
|
ldi r21, HIGH(RESSSOURCE_TXT_ROOMCLIMATE)
|
|
bigcall MainWindow_new
|
|
brcc ClimateWin_new_ret
|
|
|
|
; Y=MainWindow
|
|
push yl
|
|
push yh
|
|
bigcall MainWindow_GetContentWidget ; r19:r18=content window
|
|
brcc ClimateWin_new_popRet
|
|
mov xl, r18 ; use content window as parent
|
|
mov xh, r19
|
|
|
|
push xl ; content window
|
|
push xh
|
|
rcall climateWinCreateSensorWatches
|
|
pop xh
|
|
pop xl
|
|
; brcc ClimateWin_new_popRet
|
|
|
|
; TODO: create menu bar below
|
|
|
|
ClimateWin_new_popRet:
|
|
pop yh
|
|
pop yl
|
|
ClimateWin_new_ret:
|
|
ret
|
|
; @end
|
|
|
|
|
|
|
|
; ---------------------------------------------------------------------------
|
|
; @routine climateWinCreateSensorWatches
|
|
;
|
|
; @param X pointer to MainWindow content window (becomes parent)
|
|
; @return CFLAG set of okay, cleared otherwise
|
|
; @return Y address of newly created object
|
|
|
|
climateWinCreateSensorWatches:
|
|
ldi r16, 0 ; OPTS
|
|
ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
|
ldi r20, HLAYOUT_MODE_SPREAD
|
|
; ldi r20, HLAYOUT_MODE_EXPAND
|
|
bigcall HLayout_new
|
|
brcc climateWinCreateSensorWatches_ret
|
|
|
|
mov xl, yl ; use HLayout as parent
|
|
mov xh, yh
|
|
|
|
; CO2 sensor watch
|
|
push xl ; HLayout
|
|
push xh
|
|
ldi r16, (1<<OBJECT_OPTS_TIMER_BIT) | \
|
|
(1<<WIDGET_OPTS_INPUT_BIT) | \
|
|
(1<<OBJECT_OPTS_MSGRECV_BIT) ; OPTS
|
|
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | \
|
|
(WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
|
ldi r20, VALUE_ID_SENSOR_CO2_BASE
|
|
ldi r21, C03_EEID_SENSOR_CO2
|
|
ldi r22, SENSORWATCH_TYPE_CO2
|
|
bigcall SensorWatch_new
|
|
pop xh
|
|
pop xl
|
|
brcc climateWinCreateSensorWatches_ret
|
|
|
|
; temp sensor watch
|
|
push xl ; HLayout
|
|
push xh
|
|
ldi r16, (1<<OBJECT_OPTS_TIMER_BIT) | \
|
|
(1<<WIDGET_OPTS_INPUT_BIT) | \
|
|
(1<<OBJECT_OPTS_MSGRECV_BIT); OPTS
|
|
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | \
|
|
(WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
|
ldi r20, VALUE_ID_SENSOR_TEMP_BASE
|
|
ldi r21, C03_EEID_SENSOR_TEMP
|
|
ldi r22, SENSORWATCH_TYPE_TEMP
|
|
bigcall SensorWatch_new
|
|
pop xh
|
|
pop xl
|
|
brcc climateWinCreateSensorWatches_ret
|
|
|
|
; humidity sensor watch
|
|
push xl ; HLayout
|
|
push xh
|
|
ldi r16, (1<<OBJECT_OPTS_TIMER_BIT) | \
|
|
(1<<WIDGET_OPTS_INPUT_BIT) | \
|
|
(1<<OBJECT_OPTS_MSGRECV_BIT); OPTS
|
|
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | \
|
|
(WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
|
ldi r20, VALUE_ID_SENSOR_HUM_BASE
|
|
ldi r21, C03_EEID_SENSOR_HUM
|
|
ldi r22, SENSORWATCH_TYPE_HUM
|
|
bigcall SensorWatch_new
|
|
pop xh
|
|
pop xl
|
|
|
|
climateWinCreateSensorWatches_ret:
|
|
ret
|
|
; @end
|
|
|
|
|
|
|
|
#endif
|
|
|