avr: move ds18b20 screen code into module file.
This commit is contained in:
46
avr/main.asm
46
avr/main.asm
@@ -233,7 +233,7 @@ initialWait:
|
||||
initialWait_l1: ; wait R16 x 10 milliseconds
|
||||
ldi r17, 200
|
||||
initialWait_l2: ; wait for 10ms
|
||||
Utils_WaitNanoSecs 50000, 0, r22 ; wait for 50 microseconds
|
||||
rcall Utils_WaitFor50MicroSecs ; (R22)
|
||||
dec r17
|
||||
brne initialWait_l2
|
||||
dec r16
|
||||
@@ -241,47 +241,3 @@ initialWait_l2: ; wait for 10ms
|
||||
ret
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef MODULES_DS18B20
|
||||
printDs:
|
||||
in r15, SREG ; debug
|
||||
push r15
|
||||
cli
|
||||
ldi r18, 0
|
||||
ldi r19, 2
|
||||
rcall LCD_SetCursor
|
||||
|
||||
ldi zl, LOW(textDs18b20)
|
||||
ldi zh, HIGH(textDs18b20)
|
||||
rcall LCD_PrintFromFlash
|
||||
|
||||
ldi xl, LOW(ds18b20DataBuffer)
|
||||
ldi xh, HIGH(ds18b20DataBuffer)
|
||||
ldi r23, 9
|
||||
printDs_loop1:
|
||||
ld r16, X+
|
||||
rcall LCD_PrintHexByte
|
||||
|
||||
ldi r16, 32
|
||||
rcall LCD_PrintChar
|
||||
dec r23
|
||||
brne printDs_loop1
|
||||
pop r15
|
||||
out SREG, r15
|
||||
ret
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef MODULES_SI7021
|
||||
# ifdef MODULES_LCD
|
||||
textDs18b20: .db "Rec: ", 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
67
avr/modules/ds18b20/screen.asm
Normal file
67
avr/modules/ds18b20/screen.asm
Normal file
@@ -0,0 +1,67 @@
|
||||
; ***************************************************************************
|
||||
; copyright : (C) 2024 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. *
|
||||
; ***************************************************************************
|
||||
|
||||
|
||||
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
; This file contains timer handlers for the address protocol
|
||||
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
;
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; code
|
||||
|
||||
.cseg
|
||||
|
||||
|
||||
DS18B20_Screen:
|
||||
in r15, SREG
|
||||
push r15
|
||||
cli
|
||||
|
||||
ldi r16, 0
|
||||
rcall LCD_Fill
|
||||
|
||||
ldi r18, 0
|
||||
ldi r19, 0
|
||||
rcall LCD_SetCursor
|
||||
ldi zl, LOW(ds18b20ScreenText_title)
|
||||
ldi zh, HIGH(ds18b20ScreenText_title)
|
||||
rcall LCD_PrintFromFlash
|
||||
|
||||
ldi r18, 0
|
||||
ldi r19, 2
|
||||
rcall LCD_SetCursor
|
||||
|
||||
ldi zl, LOW(ds18b20ScreenText_buffer)
|
||||
ldi zh, HIGH(ds18b20ScreenText_buffer)
|
||||
rcall LCD_PrintFromFlash
|
||||
|
||||
ldi xl, LOW(ds18b20DataBuffer)
|
||||
ldi xh, HIGH(ds18b20DataBuffer)
|
||||
ldi r23, 9
|
||||
DS18B20_Screen_loop1:
|
||||
ld r16, X+
|
||||
rcall LCD_PrintHexByte
|
||||
|
||||
ldi r16, 32
|
||||
rcall LCD_PrintChar
|
||||
dec r23
|
||||
brne DS18B20_Screen_loop1
|
||||
pop r15
|
||||
out SREG, r15
|
||||
ret
|
||||
|
||||
|
||||
|
||||
ds18b20ScreenText_title: .db "DS18B20", 0
|
||||
ds18b20ScreenText_buffer: .db "Rec: ", 0
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user