added some test code.
This commit is contained in:
@@ -142,3 +142,132 @@ ili9341JumpToFontRenderFn:
|
||||
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine textNibbleToAscii
|
||||
;
|
||||
; Convert a nibble to an ASCII char.
|
||||
; @return R16 ASCII representation of that nibble (e.g. '0' for 0)
|
||||
; @param R16 byte (in bits 0-3)
|
||||
; @clobbers r16, r17
|
||||
|
||||
textNibbleToAscii:
|
||||
andi r16, 0xf
|
||||
cpi r16, 10
|
||||
brcs textNibbleToAscii_l1
|
||||
ldi r17, 7
|
||||
add r16, r17
|
||||
textNibbleToAscii_l1:
|
||||
ldi r17, '0'
|
||||
add r16, r17
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine ili9341_WriteCharacterX4At
|
||||
|
||||
; @param R16 byte to write
|
||||
; @param r5:r4 X
|
||||
; @param r7:r6 Y
|
||||
; @param r1:r0 background color
|
||||
; @param r3:r2 foreground color
|
||||
; @param Z pointer to font (byte address for LPM!)
|
||||
; @param X pointer to RAM to store data to
|
||||
; @return r5:r4 new X (advanced by character width)
|
||||
; @clobbers r16, r17, r18, r19, r24, r25, x, z
|
||||
|
||||
|
||||
ili9341_WriteHexByte:
|
||||
push r16
|
||||
swap r16
|
||||
rcall textNibbleToAscii ; write high nibble (r16, r17)
|
||||
push xl
|
||||
push xh
|
||||
rcall ili9341_WriteCharacterX2At ; (r16, r17, r18, r19, r20, r24, r25, x, z)
|
||||
pop xh
|
||||
pop xl
|
||||
pop r16
|
||||
rcall textNibbleToAscii ; write high nibble (r16, r17)
|
||||
rcall ili9341_WriteCharacterX2At ; (r16, r17, r18, r19, r20, r24, r25, x, z)
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
Debug_WriteHexByte:
|
||||
push r16
|
||||
; set Xpos
|
||||
ldi r16, LOW(50)
|
||||
mov r4, r16
|
||||
ldi r16, HIGH(50)
|
||||
mov r5, r16
|
||||
|
||||
; setYpos
|
||||
ldi r16, LOW(200)
|
||||
mov r6, r16
|
||||
ldi r16, HIGH(200)
|
||||
mov r7, r16
|
||||
|
||||
; set font pos
|
||||
ldi zl, LOW(font2_6x8*2)
|
||||
ldi zh, HIGH(font2_6x8*2)
|
||||
|
||||
; set buffer pos
|
||||
; ldi xl, LOW(ILI9341_buffer)
|
||||
; ldi xh, HIGH(ILI9341_buffer)
|
||||
ldi xl, LOW(0x260)
|
||||
ldi xh, HIGH(0x260)
|
||||
pop r16
|
||||
rjmp ili9341_WriteHexByte
|
||||
|
||||
|
||||
|
||||
|
||||
; @param X=ptr
|
||||
; @param r17 size
|
||||
Debug_WriteHexBuffer:
|
||||
; set Xpos
|
||||
ldi r16, LOW(50)
|
||||
mov r4, r16
|
||||
ldi r16, HIGH(50)
|
||||
mov r5, r16
|
||||
|
||||
; setYpos
|
||||
ldi r16, LOW(200)
|
||||
mov r6, r16
|
||||
ldi r16, HIGH(200)
|
||||
mov r7, r16
|
||||
|
||||
; set foreground color
|
||||
ldi r16, 0b00000000 ; black
|
||||
mov r2, r16
|
||||
mov r3, r16
|
||||
|
||||
; set font
|
||||
ldi zl, LOW(font2_6x8*2)
|
||||
ldi zh, HIGH(font2_6x8*2)
|
||||
|
||||
Debug_WriteHexBuffer_loop:
|
||||
push r17
|
||||
ld r16, X+
|
||||
push xl
|
||||
push xh
|
||||
ldi xl, LOW(0x260)
|
||||
ldi xh, HIGH(0x260)
|
||||
rcall ili9341_WriteHexByte
|
||||
|
||||
ldi r16, 32
|
||||
rcall ili9341_WriteCharacterX2At ; (r16, r17, r18, r19, r24, r25, x, z)
|
||||
pop xh
|
||||
pop xl
|
||||
pop r17
|
||||
dec r17
|
||||
brne Debug_WriteHexBuffer_loop
|
||||
ret
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user