avr: call Motion_Run if enabled.
This commit is contained in:
@@ -15,9 +15,10 @@
|
||||
.equ MOTION_SEND_2_AFTER = 11 ; send motion message after 1100ms
|
||||
.equ MOTION_RESTART_AFTER = 100 ; restart motion report counter after 10s
|
||||
|
||||
|
||||
.equ MOTION_UPCOUNTER_VALUE = 50 ; keep MOTION state active for at least 5s
|
||||
|
||||
.equ MOTION_FLAGS_REPORT_MOTION_BIT = 0
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
@@ -26,6 +27,7 @@
|
||||
.dseg
|
||||
|
||||
motionDataBegin:
|
||||
motionFlags: .byte 1
|
||||
motionStateCounter: .byte 1
|
||||
motionUpCounter: .byte 1
|
||||
motionDataEnd:
|
||||
@@ -76,6 +78,30 @@ Motion_Fini:
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Motion_Run @global
|
||||
;
|
||||
; @clobbers none
|
||||
|
||||
Motion_Run:
|
||||
lds r16, motionFlags
|
||||
andi r16, (1<<MOTION_FLAGS_REPORT_MOTION_BIT)
|
||||
breq Motion_Run_retnc
|
||||
ldi r18, 1
|
||||
rcall Motion_SendReport
|
||||
brcc Motion_Run_retnc
|
||||
lds r16, motionFlags
|
||||
andi r16, ~(1<<MOTION_FLAGS_REPORT_MOTION_BIT)
|
||||
sts motionFlags, r16
|
||||
sec
|
||||
ret
|
||||
Motion_Run_retnc:
|
||||
clc
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Motion_Every100ms @global
|
||||
;
|
||||
@@ -118,8 +144,10 @@ Motion_Every100ms_handleStateCounter:
|
||||
sts motionStateCounter, r17
|
||||
ret
|
||||
Motion_Every100ms_send:
|
||||
ldi r18, 1
|
||||
rjmp Motion_SendReport
|
||||
lds r16, motionFlags
|
||||
ori r16, (1<<MOTION_FLAGS_REPORT_MOTION_BIT)
|
||||
sts motionFlags, r16
|
||||
ret
|
||||
Motion_Every100ms_end:
|
||||
ret
|
||||
; @end
|
||||
|
||||
Reference in New Issue
Block a user