From ba55a2898d941bb2d1ea597003a7983c5ccbf761 Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Mon, 21 Apr 2025 00:36:45 +0200 Subject: [PATCH] started working on 2nd version of motion module. --- avr/modules/motion/main2.asm | 76 ++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 avr/modules/motion/main2.asm diff --git a/avr/modules/motion/main2.asm b/avr/modules/motion/main2.asm new file mode 100644 index 0000000..115b9ea --- /dev/null +++ b/avr/modules/motion/main2.asm @@ -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 + + + + + +