avr: share code (saves 8 bytes)
This commit is contained in:
@@ -53,12 +53,10 @@ com2SendByte_loopEnd:
|
||||
; send stopbit
|
||||
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
|
||||
sec
|
||||
ret
|
||||
rjmp com2LowLevelSecRet
|
||||
|
||||
com2SendByte_error:
|
||||
clc
|
||||
ret
|
||||
rjmp com2LowLevelClcRet
|
||||
|
||||
|
||||
|
||||
@@ -97,11 +95,9 @@ com2ReceiveByte_shiftIn:
|
||||
rcall com2WaitForDataHigh ; wait for start of stopbit
|
||||
brcc com2ReceiveByte_error
|
||||
mov r16, r20
|
||||
sec
|
||||
ret
|
||||
rjmp com2LowLevelSecRet
|
||||
com2ReceiveByte_error:
|
||||
clc
|
||||
ret
|
||||
rjmp com2LowLevelClcRet
|
||||
|
||||
|
||||
|
||||
@@ -170,11 +166,9 @@ com2WaitForDataState1ms_loop:
|
||||
rcall com2WaitFor10MicroSecs ; wait for 10us (R22)
|
||||
dec r17
|
||||
brne com2WaitForDataState1ms_loop
|
||||
clc
|
||||
ret
|
||||
rjmp com2LowLevelClcRet
|
||||
com2WaitForDataState1ms_stateReached:
|
||||
sec
|
||||
ret
|
||||
rjmp com2LowLevelSecRet
|
||||
|
||||
|
||||
|
||||
@@ -198,11 +192,9 @@ com2WaitForAttnState1ms_loop:
|
||||
rcall com2WaitFor10MicroSecs ; wait for 10us (R22)
|
||||
dec r17
|
||||
brne com2WaitForAttnState1ms_loop
|
||||
clc
|
||||
ret
|
||||
rjmp com2LowLevelClcRet
|
||||
com2WaitForAttnState1ms_stateReached:
|
||||
sec
|
||||
ret
|
||||
rjmp com2LowLevelSecRet
|
||||
|
||||
|
||||
|
||||
@@ -220,3 +212,13 @@ com2WaitFor10MicroSecs:
|
||||
ret
|
||||
|
||||
|
||||
com2LowLevelClcRet:
|
||||
clc
|
||||
ret
|
||||
|
||||
|
||||
com2LowLevelSecRet:
|
||||
sec
|
||||
ret
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user