84 lines
1.8 KiB
NASM
84 lines
1.8 KiB
NASM
; ***************************************************************************
|
|
; copyright : (C) 2023 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. *
|
|
; ***************************************************************************
|
|
|
|
|
|
|
|
; ***************************************************************************
|
|
; data
|
|
|
|
.dseg
|
|
|
|
ledSimpleTimer: .byte 1
|
|
|
|
|
|
|
|
; ***************************************************************************
|
|
; code
|
|
|
|
.cseg
|
|
|
|
|
|
LED_SIMPLE_BEGIN:
|
|
|
|
|
|
|
|
; ---------------------------------------------------------------------------
|
|
; LedSimple_Init
|
|
;
|
|
; IN:
|
|
; - nothing
|
|
; OUT:
|
|
; - CFLAG: set if okay, clear on error
|
|
; USED: R1, R2, R3, R4, R16, R17, X
|
|
|
|
LedSimple_Init:
|
|
sbi LED_SIMPLE_DDR, LED_SIMPLE_PINNUM ; out
|
|
cbi LED_SIMPLE_PORT, LED_SIMPLE_PINNUM ; on
|
|
ldi r16, LED_SIMPLE_ONTIME
|
|
sts ledSimpleTimer, r16
|
|
sec
|
|
ret
|
|
|
|
|
|
; ---------------------------------------------------------------------------
|
|
; LedSimple_Every100ms
|
|
;
|
|
; IN:
|
|
; - nothing
|
|
; OUT:
|
|
; - nothing
|
|
; USED:
|
|
|
|
LedSimple_Every100ms:
|
|
lds r16, ledSimpleTimer
|
|
dec r16
|
|
breq LedSimple_Every100ms_zero
|
|
rjmp LedSimple_Every100ms_setTimer
|
|
LedSimple_Every100ms_zero:
|
|
sbic LED_SIMPLE_PORT, LED_SIMPLE_PINNUM ; skip next op if LED is on
|
|
rjmp LedSimple_Tick_isOff
|
|
; is on
|
|
sbi LED_SIMPLE_PORT, LED_SIMPLE_PINNUM ; off
|
|
ldi r16, LED_SIMPLE_OFFTIME
|
|
rjmp LedSimple_Every100ms_setTimer
|
|
LedSimple_Tick_isOff:
|
|
cbi LED_SIMPLE_PORT, LED_SIMPLE_PINNUM ; on
|
|
ldi r16, LED_SIMPLE_ONTIME
|
|
LedSimple_Every100ms_setTimer:
|
|
sts ledSimpleTimer, r16
|
|
ret
|
|
|
|
|
|
|
|
LED_SIMPLE_END:
|
|
.equ MODULE_SIZE_LED_SIMPLE = LED_SIMPLE_END-LED_SIMPLE_BEGIN
|
|
|
|
|
|
|