Revert "avr: make lcdOneByteCommand() and lcdTwoByteCommand() more generic."
This reverts commit 28882010a9.
This commit is contained in:
@@ -128,59 +128,40 @@ LCD_Fini:
|
|||||||
;
|
;
|
||||||
; @return nothing
|
; @return nothing
|
||||||
; @param r16 1=sleep, 0=awake
|
; @param r16 1=sleep, 0=awake
|
||||||
; @clobbers r15, r16, r20 (R17, R18, R22)
|
|
||||||
;
|
|
||||||
|
|
||||||
LCD_Sleep:
|
|
||||||
ldi r20, 0xae ; set sleep
|
|
||||||
tst r16
|
|
||||||
brne LCD_Sleep_send
|
|
||||||
ldi r20, 0xaf ; set wake
|
|
||||||
LCD_Sleep_send:
|
|
||||||
ldi r23, LCD_MODE_MULTICMD
|
|
||||||
rjmp lcdOneByteMsg
|
|
||||||
; @end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
|
||||||
; @routine LCD_SetContrast @global
|
|
||||||
;
|
|
||||||
; @return nothing
|
|
||||||
; @param r16 contrast value (0-255)
|
|
||||||
; @clobbers r15, r16, r19 (R17, R18, R22)
|
; @clobbers r15, r16, r19 (R17, R18, R22)
|
||||||
;
|
;
|
||||||
|
|
||||||
LCD_SetContrast:
|
LCD_Sleep:
|
||||||
ldi r23, LCD_MODE_MULTICMD
|
ldi r16, 0xae ; set sleep
|
||||||
ldi r20, 0x81
|
tst r19
|
||||||
mov r21, r16
|
brne LCD_Sleep_send
|
||||||
rjmp lcdTwoByteMsg
|
ldi r16, 0xaf ; set wake
|
||||||
|
LCD_Sleep_send:
|
||||||
|
rjmp lcdOneByteCommand
|
||||||
; @end
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine lcdOneByteMsg
|
; @routine lcdOneByteCommand
|
||||||
; Send a one byte command
|
; Send a one byte command
|
||||||
;
|
;
|
||||||
; @return nothing
|
; @return nothing
|
||||||
; @param r23 packet type (LCD_MODE_MULTICMD, LCD_MODE_DATA etc)
|
|
||||||
; @param r20 first byte of command
|
; @param r20 first byte of command
|
||||||
; @clobbers r15, r16, r19 (R17, R18, R22)
|
; @clobbers r15, r16, r19 (R17, R18, R22)
|
||||||
;
|
;
|
||||||
|
|
||||||
lcdOneByteMsg:
|
lcdOneByteCommand:
|
||||||
in r15, SREG
|
in r15, SREG
|
||||||
push r15
|
push r15
|
||||||
cli
|
cli
|
||||||
|
|
||||||
rcall lcdBeginMsg
|
rcall lcdBeginMultiCommand
|
||||||
brcc lcdOneByteMsg_error
|
brcc lcdOneByteCommand_error
|
||||||
|
|
||||||
mov r16, r20
|
mov r16, r20
|
||||||
rcall twiSendByteExpectAck ; (R16, R17, R18, R22)
|
rcall twiSendByteExpectAck ; (R16, R17, R18, R22)
|
||||||
brcc lcdOneByteMsg_error
|
brcc lcdOneByteCommand_error
|
||||||
|
|
||||||
rcall twiStop ; (R22)
|
rcall twiStop ; (R22)
|
||||||
pop r15
|
pop r15
|
||||||
@@ -188,38 +169,37 @@ lcdOneByteMsg:
|
|||||||
sec
|
sec
|
||||||
ret
|
ret
|
||||||
|
|
||||||
lcdOneByteMsg_error:
|
lcdOneByteCommand_error:
|
||||||
rjmp lcdTwiStopPopR15ClcRet ; (R22)
|
rjmp lcdTwiStopPopR15ClcRet ; (R22)
|
||||||
; @end
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine lcdTwoByteMsg
|
; @routine lcdTwoByteCommand
|
||||||
; Send a two byte command
|
; Send a two byte command
|
||||||
;
|
;
|
||||||
; @return nothing
|
; @return nothing
|
||||||
; @param r23 packet type (LCD_MODE_MULTICMD, LCD_MODE_DATA etc)
|
|
||||||
; @param r20 first byte of command
|
; @param r20 first byte of command
|
||||||
; @param r21 second byte of command
|
; @param r21 second byte of command
|
||||||
; @clobbers r15, r16, r19 (R17, R18, R22)
|
; @clobbers r15, r16, r19 (R17, R18, R22)
|
||||||
;
|
;
|
||||||
|
|
||||||
lcdTwoByteMsg:
|
lcdTwoByteCommand:
|
||||||
in r15, SREG
|
in r15, SREG
|
||||||
push r15
|
push r15
|
||||||
cli
|
cli
|
||||||
|
|
||||||
rcall lcdBeginMsg
|
rcall lcdBeginMultiCommand
|
||||||
brcc lcdTwoByteMsg_error
|
brcc lcdTwoByteCommand_error
|
||||||
|
|
||||||
mov r16, r20
|
mov r16, r20
|
||||||
rcall twiSendByteExpectAck ; (R16, R17, R18, R22)
|
rcall twiSendByteExpectAck ; (R16, R17, R18, R22)
|
||||||
brcc lcdTwoByteMsg_error
|
brcc lcdTwoByteCommand_error
|
||||||
|
|
||||||
mov r16, r21
|
mov r16, r21
|
||||||
rcall twiSendByteExpectAck ; (R16, R17, R18, R22)
|
rcall twiSendByteExpectAck ; (R16, R17, R18, R22)
|
||||||
brcc lcdTwoByteMsg_error
|
brcc lcdTwoByteCommand_error
|
||||||
|
|
||||||
rcall twiStop ; (R22)
|
rcall twiStop ; (R22)
|
||||||
pop r15
|
pop r15
|
||||||
@@ -227,31 +207,30 @@ lcdTwoByteMsg:
|
|||||||
sec
|
sec
|
||||||
ret
|
ret
|
||||||
|
|
||||||
lcdTwoByteMsg_error:
|
lcdTwoByteCommand_error:
|
||||||
rjmp lcdTwiStopPopR15ClcRet ; (R22)
|
rjmp lcdTwiStopPopR15ClcRet ; (R22)
|
||||||
; @end
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine lcdBeginMsg
|
; @routine lcdBeginMultiCommand
|
||||||
; Send a two byte command
|
; Send a two byte command
|
||||||
;
|
;
|
||||||
; @return nothing
|
; @return nothing
|
||||||
; @param r23 packet type (LCD_MODE_MULTICMD, LCD_MODE_DATA etc)
|
; @param r20 first byte of command
|
||||||
|
; @param r21 second byte of command
|
||||||
; @clobbers r16, (R17, R18, R22)
|
; @clobbers r16, (R17, R18, R22)
|
||||||
;
|
;
|
||||||
|
|
||||||
lcdBeginMsg:
|
lcdBeginMultiCommand:
|
||||||
rcall twiStart ; (R22)
|
rcall twiStart ; (R22)
|
||||||
ldi r16, (LCD_TWI_ADDRESS*2)
|
ldi r16, (LCD_TWI_ADDRESS*2)
|
||||||
rcall twiSendByteExpectAck ; (R16, R17, R18, R22)
|
rcall twiSendByteExpectAck ; (R16, R17, R18, R22)
|
||||||
brcc lcdBeginMsg_error
|
brcc lcdTwoByteCommand_error
|
||||||
|
|
||||||
mov r16, r23
|
ldi r16, LCD_MODE_MULTICMD
|
||||||
rjmp twiSendByteExpectAck ; (R16, R17, R18, R22)
|
rjmp twiSendByteExpectAck ; (R16, R17, R18, R22)
|
||||||
lcdBeginMsg_error:
|
|
||||||
ret
|
|
||||||
; @end
|
; @end
|
||||||
|
|
||||||
|
|
||||||
@@ -689,7 +668,6 @@ lcdPrintOneChar_error:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; lcdGetCharMatrix
|
; lcdGetCharMatrix
|
||||||
;
|
;
|
||||||
|
|||||||
Reference in New Issue
Block a user