avr: share code (saves 8 bytes)
This commit is contained in:
@@ -53,12 +53,10 @@ com2SendByte_loopEnd:
|
|||||||
; send stopbit
|
; send stopbit
|
||||||
cbi COM_DDR_DATA, COM_PINNUM_DATA ; +2 set DATA as input, pullup R makes it ONE
|
cbi COM_DDR_DATA, COM_PINNUM_DATA ; +2 set DATA as input, pullup R makes it ONE
|
||||||
Utils_WaitNanoSecs COM_BIT_LENGTH, 4, r22 ; wait for one bit length
|
Utils_WaitNanoSecs COM_BIT_LENGTH, 4, r22 ; wait for one bit length
|
||||||
sec
|
rjmp com2LowLevelSecRet
|
||||||
ret
|
|
||||||
|
|
||||||
com2SendByte_error:
|
com2SendByte_error:
|
||||||
clc
|
rjmp com2LowLevelClcRet
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -97,11 +95,9 @@ com2ReceiveByte_shiftIn:
|
|||||||
rcall com2WaitForDataHigh ; wait for start of stopbit
|
rcall com2WaitForDataHigh ; wait for start of stopbit
|
||||||
brcc com2ReceiveByte_error
|
brcc com2ReceiveByte_error
|
||||||
mov r16, r20
|
mov r16, r20
|
||||||
sec
|
rjmp com2LowLevelSecRet
|
||||||
ret
|
|
||||||
com2ReceiveByte_error:
|
com2ReceiveByte_error:
|
||||||
clc
|
rjmp com2LowLevelClcRet
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -170,11 +166,9 @@ com2WaitForDataState1ms_loop:
|
|||||||
rcall com2WaitFor10MicroSecs ; wait for 10us (R22)
|
rcall com2WaitFor10MicroSecs ; wait for 10us (R22)
|
||||||
dec r17
|
dec r17
|
||||||
brne com2WaitForDataState1ms_loop
|
brne com2WaitForDataState1ms_loop
|
||||||
clc
|
rjmp com2LowLevelClcRet
|
||||||
ret
|
|
||||||
com2WaitForDataState1ms_stateReached:
|
com2WaitForDataState1ms_stateReached:
|
||||||
sec
|
rjmp com2LowLevelSecRet
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -198,11 +192,9 @@ com2WaitForAttnState1ms_loop:
|
|||||||
rcall com2WaitFor10MicroSecs ; wait for 10us (R22)
|
rcall com2WaitFor10MicroSecs ; wait for 10us (R22)
|
||||||
dec r17
|
dec r17
|
||||||
brne com2WaitForAttnState1ms_loop
|
brne com2WaitForAttnState1ms_loop
|
||||||
clc
|
rjmp com2LowLevelClcRet
|
||||||
ret
|
|
||||||
com2WaitForAttnState1ms_stateReached:
|
com2WaitForAttnState1ms_stateReached:
|
||||||
sec
|
rjmp com2LowLevelSecRet
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -220,3 +212,13 @@ com2WaitFor10MicroSecs:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
com2LowLevelClcRet:
|
||||||
|
clc
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
com2LowLevelSecRet:
|
||||||
|
sec
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user