ili9341: created dedicated sourcefile for font handling.
This commit is contained in:
@@ -156,6 +156,7 @@
|
|||||||
.include "modules/lcd2/ili9341/defs.asm"
|
.include "modules/lcd2/ili9341/defs.asm"
|
||||||
.include "modules/lcd2/ili9341/main.asm"
|
.include "modules/lcd2/ili9341/main.asm"
|
||||||
.include "modules/lcd2/ili9341/io_spi.asm"
|
.include "modules/lcd2/ili9341/io_spi.asm"
|
||||||
|
.include "modules/lcd2/ili9341/font8x8.asm"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
88
avr/modules/lcd2/ili9341/font8x8.asm
Normal file
88
avr/modules/lcd2/ili9341/font8x8.asm
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
; ***************************************************************************
|
||||||
|
; copyright : (C) 2025 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. *
|
||||||
|
; ***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
; ***************************************************************************
|
||||||
|
; code
|
||||||
|
|
||||||
|
.cseg
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine ili9341WriteCharacterFromFont8x8
|
||||||
|
|
||||||
|
; @param R16 character to write
|
||||||
|
; @param R1:R0 background color
|
||||||
|
; @param R3:R2 foreground color
|
||||||
|
; @param Z pointer to font
|
||||||
|
; @param X pointer to RAM to store data to
|
||||||
|
; @clobbers r17, r24, r25, x, z
|
||||||
|
|
||||||
|
ili9341WriteCharacterFromFont8x8:
|
||||||
|
rcall ili9341GetCharPosInFont8x8 ; (r17, r24, r25, z)
|
||||||
|
ldi r25, 8 ; 8 bytes
|
||||||
|
ili9341WriteCharacterFromFont8x8_loop1:
|
||||||
|
ldi r24, 8 ; 8 bits
|
||||||
|
lpm r17, Z+
|
||||||
|
ili9341WriteCharacterFromFont8x8_loop2:
|
||||||
|
lsr r17
|
||||||
|
brcs ili9341WriteCharacterFromFont8x8_writeForeground
|
||||||
|
st X+, r0
|
||||||
|
st X+, r1
|
||||||
|
rjmp ili9341WriteCharacterFromFont8x8_loop2end
|
||||||
|
ili9341WriteCharacterFromFont8x8_writeForeground:
|
||||||
|
st X+, r2
|
||||||
|
st X+, r3
|
||||||
|
ili9341WriteCharacterFromFont8x8_loop2end:
|
||||||
|
dec r24
|
||||||
|
brne ili9341WriteCharacterFromFont8x8_loop2
|
||||||
|
dec r25
|
||||||
|
brne ili9341WriteCharacterFromFont8x8_loop1
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine ili9341GetCharPosInFont8x8
|
||||||
|
|
||||||
|
; @param R16 character to write
|
||||||
|
; @param Z pointer to font
|
||||||
|
; @return Z pointer to begin of char data
|
||||||
|
; @clobbers r17, r24, r25, z
|
||||||
|
|
||||||
|
ili9341GetCharPosInFont8x8:
|
||||||
|
mov r24, r16
|
||||||
|
lpm r17, Z+ ; first char num
|
||||||
|
sub r24, r17
|
||||||
|
brcc ili9341GetCharPosInFont8x8_firstValueOkay
|
||||||
|
adiw zh:zl, 1 ; use first char
|
||||||
|
ret
|
||||||
|
ili9341GetCharPosInFont8x8_firstValueOkay:
|
||||||
|
lpm r17, Z+
|
||||||
|
cp r24, r17
|
||||||
|
brcs ili9341WriteCharacterFromFont8x8_gotPos
|
||||||
|
ret
|
||||||
|
ili9341WriteCharacterFromFont8x8_gotPos:
|
||||||
|
clr r25
|
||||||
|
lsl r24 ; R16x8
|
||||||
|
rol r25
|
||||||
|
lsl r24
|
||||||
|
rol r25
|
||||||
|
lsl r24
|
||||||
|
rol r25
|
||||||
|
add zl, r24
|
||||||
|
adc zh, r25
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user