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 + + + + + +