gui2: more work, added image viewer.
This commit is contained in:
@@ -245,6 +245,19 @@ GuiApp_OnTouch_done:
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine GuiApp_OnMsgReceived @global
|
||||
;
|
||||
; @param Z byte address of guiapp object (for LPM!)
|
||||
; @param X pointer to touch event in SDRAM
|
||||
|
||||
GuiApp_OnMsgReceived:
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine GuiApp_OnCreate @global
|
||||
;
|
||||
|
||||
@@ -118,6 +118,40 @@ GuiCntrl_Every100ms:
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine GuiCntrl_Every100ms @global
|
||||
;
|
||||
; @param Z byte address of guiapp object (for LPM!)
|
||||
; @param X ptr to msg received
|
||||
|
||||
GuiCntrl_MsgReceived:
|
||||
push zl
|
||||
push zh
|
||||
bigcall OBJ_GetFirstChild
|
||||
GuiCntrl_MsgReceived_loop:
|
||||
mov zl, r18
|
||||
mov zh, r19
|
||||
or r18, r19
|
||||
breq GuiCntrl_MsgReceived_loopEnd
|
||||
; let child handle msg signal
|
||||
ldi r16, OBJECT_SIGNAL_RECVMSG
|
||||
clr r17
|
||||
push xl
|
||||
push xh
|
||||
bigcall OBJ_HandleSignal
|
||||
pop xh
|
||||
pop xl
|
||||
bigcall OBJ_GetNext
|
||||
rjmp GuiCntrl_MsgReceived_loop
|
||||
GuiCntrl_MsgReceived_loopEnd:
|
||||
pop zh
|
||||
pop zl
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine guiCntrlCheckTouch
|
||||
;
|
||||
|
||||
117
avr/modules/lcd2/gui2/imageview.asm
Normal file
117
avr/modules/lcd2/gui2/imageview.asm
Normal file
@@ -0,0 +1,117 @@
|
||||
; ***************************************************************************
|
||||
; 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_IMAGEVIEW_ASM
|
||||
#define AQH_AVR_GUI2_IMAGEVIEW_ASM
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; defines
|
||||
|
||||
; IMGVIEW in flash
|
||||
.equ IMGVIEW_OFFS_IMGVIEW = WIDGET_SIZE
|
||||
.equ IMGVIEW_OFFS_RESSOURCEID_LO = IMGVIEW_OFFS_IMGVIEW+0
|
||||
.equ IMGVIEW_OFFS_RESSOURCEID_HI = IMGVIEW_OFFS_IMGVIEW+1
|
||||
.equ IMGVIEW_SIZE = IMGVIEW_OFFS_IMGVIEW+2
|
||||
|
||||
|
||||
; SDRAM data for IMGVIEW
|
||||
.equ IMGVIEW_SD_OFFS_IMGVIEW = WIDGET_SD_SIZE
|
||||
.equ IMGVIEW_SD_OFFS_BGCOL_LO = IMGVIEW_SD_OFFS_IMGVIEW+0
|
||||
.equ IMGVIEW_SD_OFFS_BGCOL_HI = IMGVIEW_SD_OFFS_IMGVIEW+1
|
||||
.equ IMGVIEW_SD_SIZE = IMGVIEW_SD_OFFS_IMGVIEW+2
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; code
|
||||
|
||||
.cseg
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine ImageView_OnCreate @global
|
||||
;
|
||||
; @param Z byte address of widget object (for LPM!)
|
||||
; @return CFLAG set if signal handled
|
||||
; @clobbers any, !Z
|
||||
|
||||
ImageView_OnCreate:
|
||||
bigcall Widget_OnCreate
|
||||
bigcall Widget_GetSdramPtr ; (none)
|
||||
ldi r16, LOW(STYLE_WIN_BACKGROUND)
|
||||
ldi r17, HIGH(STYLE_WIN_BACKGROUND)
|
||||
std Y+IMGVIEW_SD_OFFS_BGCOL_LO, r16
|
||||
std Y+IMGVIEW_SD_OFFS_BGCOL_HI, r17
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Widget_OnDraw @global
|
||||
;
|
||||
; @param Z byte address of widget object (for LPM!)
|
||||
; @return CFLAG set if signal handled
|
||||
; @clobbers any, !Z
|
||||
|
||||
ImageView_OnDraw:
|
||||
bigcall Widget_GetSdramPtr ; (none)
|
||||
ldd r16, Y+WIDGET_SD_OFFS_FLAGS
|
||||
andi r16, (1<<WIDGET_FLAGS_DIRTY_BIT)
|
||||
breq ImageView_OnDraw_ret
|
||||
|
||||
; rcall Widget_Clear
|
||||
|
||||
push zl
|
||||
push zh
|
||||
; get ressource id
|
||||
adiw zh:zl, IMGVIEW_OFFS_RESSOURCEID_LO
|
||||
lpm r16, Z+
|
||||
lpm r17, Z
|
||||
sbiw zh:zl, IMGVIEW_OFFS_RESSOURCEID_LO+1
|
||||
; get ressource
|
||||
ldi zl, LOW(RESSOURCE_ADDR*2)
|
||||
ldi zh, HIGH(RESSOURCE_ADDR*2)
|
||||
bigcall RES_GetRessource
|
||||
mov r12, zl
|
||||
mov r13, zh
|
||||
pop zh
|
||||
pop zl
|
||||
brcc ImageView_OnDraw_done
|
||||
|
||||
; get background color
|
||||
ldd r0, Y+IMGVIEW_SD_OFFS_BGCOL_LO
|
||||
ldd r1, Y+IMGVIEW_SD_OFFS_BGCOL_HI
|
||||
|
||||
; draw at 0/0
|
||||
clr r4 ; X
|
||||
clr r5
|
||||
clr r6 ; Y
|
||||
clr r7
|
||||
|
||||
bigcall Widget_DrawImage
|
||||
|
||||
ImageView_OnDraw_done:
|
||||
bigcall Widget_GetSdramPtr ; (none)
|
||||
ldd r16, Y+WIDGET_SD_OFFS_FLAGS
|
||||
cbr r16, (1<<WIDGET_FLAGS_DIRTY_BIT)
|
||||
std Y+WIDGET_SD_OFFS_FLAGS, r16
|
||||
|
||||
ImageView_OnDraw_ret:
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -40,7 +40,8 @@
|
||||
.equ OBJECT_SIGNAL_CREATE = 1
|
||||
.equ OBJECT_SIGNAL_DESTROY = 2
|
||||
.equ OBJECT_SIGNAL_TIMER = 3
|
||||
.equ OBJECT_SIGNAL_NEXTFREE = 4
|
||||
.equ OBJECT_SIGNAL_RECVMSG = 4 ; X=msg
|
||||
.equ OBJECT_SIGNAL_NEXTFREE = 5
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user