avr: more work on gui.

This commit is contained in:
Martin Preuss
2026-04-21 00:01:15 +02:00
parent 8c567c3a87
commit 93aa9b46c3
13 changed files with 1475 additions and 60 deletions

View File

@@ -0,0 +1,86 @@
; ***************************************************************************
; 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_GUI2_BUTTONGROUP_ASM
#define AQH_AVR_GUI2_BUTTONGROUP_ASM
; ***************************************************************************
; This modules assumes all children to be CheckButton widgets.
; Of those children only one is active at any time.
; When a child gets activated a COMMAND signal will be emitted with the selector
; of the child emitting the signal.
; ***************************************************************************
; ***************************************************************************
; code
.cseg
; ***************************************************************************
; signal handlers
ButtonGroup_OnCommand:
tst xl
brne ButtonGroup_OnCommand_done
push r17
rcall buttonGroupDeselectOthers
pop r17 ; re-use selector from original signal
ldi r16, WIDGET_SIGNAL_COMMAND
bigcall OBJ_EmitSignalWithSelector
ButtonGroup_OnCommand_done:
sec
ret
; @end
; ---------------------------------------------------------------------------
; @routine hbuttonGroupDeselectOthers
;
; @param Y address of widget
; @param r17 selector of the selected child
buttonGroupDeselectOthers:
push yl
push yh
bigcall OBJ_GetFirstChild ; (none)
buttonGroupDeselectOthers_loop:
brcc buttonGroupDeselectOthers_done
mov yl, r18
mov yh, r19
ldd r16, Y+OBJECT_OFFS_SELECTOR
cp r16, r17
breq buttonGroupDeselectOthers_next
push r17
clr r16
bigcall CheckButton_SetState
pop r17
buttonGroupDeselectOthers_next:
bigcall OBJ_GetNext
rjmp buttonGroupDeselectOthers_loop
buttonGroupDeselectOthers_done:
pop yh
pop yl
ret
; @end
#endif