started working on 2nd version of motion module.
This commit is contained in:
76
avr/modules/motion/main2.asm
Normal file
76
avr/modules/motion/main2.asm
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
; ***************************************************************************
|
||||||
|
; 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. *
|
||||||
|
; ***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
; ***************************************************************************
|
||||||
|
; defs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ***************************************************************************
|
||||||
|
; data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ***************************************************************************
|
||||||
|
; code
|
||||||
|
|
||||||
|
.cseg
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine Motion_Init @global
|
||||||
|
;
|
||||||
|
; @return CFLAG set if okay, clear on error
|
||||||
|
; @clobbers none
|
||||||
|
|
||||||
|
Motion_Init:
|
||||||
|
; setup pins
|
||||||
|
cbi MOTION_DDR, MOTION_PIN ; set DATA port as input
|
||||||
|
cbi MOTION_OUTPUT, MOTION_PIN ; disable internal pullup for TXD
|
||||||
|
sec
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine Motion_Fini @global
|
||||||
|
;
|
||||||
|
; @clobbers none
|
||||||
|
|
||||||
|
Motion_Fini:
|
||||||
|
cbi MOTION_DDR, MOTION_PIN ; set DATA port as input
|
||||||
|
cbi MOTION_OUTPUT, MOTION_PIN ; disable internal pullup for TXD
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine Motion_GetValue @global
|
||||||
|
;
|
||||||
|
; @return CFLAG set if there is a value, cleared otherwise (standard api)
|
||||||
|
; @return R16 value (0=no motion, 1=motion)
|
||||||
|
; @clobbers any
|
||||||
|
|
||||||
|
Motion_GetValue:
|
||||||
|
clr r16
|
||||||
|
sbic MOTION_INPUT, MOTION_PIN
|
||||||
|
inc r16
|
||||||
|
sec ; there always is data
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user