started working on 2nd version of motion module.

This commit is contained in:
Martin Preuss
2025-04-21 00:36:45 +02:00
parent 16a6bb08b5
commit ba55a2898d

View 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