avr: add LED module LED_SIMPLE
very much shorter version with only basic functionality.
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
flash
|
flash
|
||||||
lcd
|
lcd
|
||||||
led
|
led
|
||||||
|
led_simple
|
||||||
reed
|
reed
|
||||||
si7021
|
si7021
|
||||||
stats
|
stats
|
||||||
|
|||||||
11
avr/modules/led_simple/0BUILD
Normal file
11
avr/modules/led_simple/0BUILD
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml?>
|
||||||
|
|
||||||
|
<gwbuild>
|
||||||
|
|
||||||
|
<extradist>
|
||||||
|
main.asm
|
||||||
|
</extradist>
|
||||||
|
|
||||||
|
</gwbuild>
|
||||||
|
|
||||||
|
|
||||||
83
avr/modules/led_simple/main.asm
Normal file
83
avr/modules/led_simple/main.asm
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
; ***************************************************************************
|
||||||
|
; 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
|
||||||
|
brne 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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user