added simple beeper module.
This commit is contained in:
@@ -177,6 +177,14 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef MODULES_BEEPER_SIMPLE
|
||||||
|
.include "modules/beeper_simple/main.asm"
|
||||||
|
#ifdef MODULES_NETWORK
|
||||||
|
.include "modules/beeper_simple/recv.asm"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef MODULES_TWI_MASTER
|
#ifdef MODULES_TWI_MASTER
|
||||||
.include "modules/twimaster/main.asm"
|
.include "modules/twimaster/main.asm"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -125,6 +125,11 @@ onSystemTimerTick:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef MODULES_BEEPER_SIMPLE
|
||||||
|
bigcall BeeperSimple_Every100ms
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef MODULES_UART_BITBANG
|
#ifdef MODULES_UART_BITBANG
|
||||||
bigcall UART_BitBang_Every100ms
|
bigcall UART_BitBang_Every100ms
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -58,12 +58,16 @@ initModules:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef MODULES_LED_ACTIVITY
|
#ifdef MODULES_LED_ACTIVITY
|
||||||
bigcall LedActivity_Init
|
bigcall LedActivity_Init
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef MODULES_BEEPER_SIMPLE
|
||||||
|
bigcall BeeperSimple_Init
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef MODULES_COM
|
#ifdef MODULES_COM
|
||||||
bigcall Com2_Init ; init COM module
|
bigcall Com2_Init ; init COM module
|
||||||
bigcall CPRO_Init ; init COM protocol module
|
bigcall CPRO_Init ; init COM protocol module
|
||||||
@@ -325,6 +329,13 @@ mainModulesOnPacketReceived:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef MODULES_BEEPER_SIMPLE
|
||||||
|
#ifdef MODULES_NETWORK
|
||||||
|
bigcall BeeperSimple_OnPacketReceived
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
; add more here
|
; add more here
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|||||||
11
avr/modules/beeper_simple/0BUILD
Normal file
11
avr/modules/beeper_simple/0BUILD
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml?>
|
||||||
|
|
||||||
|
<gwbuild>
|
||||||
|
|
||||||
|
<extradist>
|
||||||
|
main.asm
|
||||||
|
</extradist>
|
||||||
|
|
||||||
|
</gwbuild>
|
||||||
|
|
||||||
|
|
||||||
107
avr/modules/beeper_simple/main.asm
Normal file
107
avr/modules/beeper_simple/main.asm
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
; ***************************************************************************
|
||||||
|
; copyright : (C) 2026 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
|
||||||
|
|
||||||
|
beeperSimpleTimer: .byte 1
|
||||||
|
beeperSimpleOnTime: .byte 1
|
||||||
|
beeperSimpleOffTime: .byte 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ***************************************************************************
|
||||||
|
; code
|
||||||
|
|
||||||
|
.cseg
|
||||||
|
|
||||||
|
|
||||||
|
BEEPER_SIMPLE_BEGIN:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; BeeperSimple_Init
|
||||||
|
;
|
||||||
|
; @return CFLAG set if okay, clear on error
|
||||||
|
; @clobbers r16
|
||||||
|
|
||||||
|
BeeperSimple_Init:
|
||||||
|
sbi BEEPER_SIMPLE_DDR, BEEPER_SIMPLE_PINNUM ; out
|
||||||
|
cbi BEEPER_SIMPLE_PORT, BEEPER_SIMPLE_PINNUM ; off
|
||||||
|
clr r16
|
||||||
|
sts beeperSimpleTimer, r16
|
||||||
|
sts beeperSimpleOnTime, r16
|
||||||
|
sts beeperSimpleOffTime, r16
|
||||||
|
sec
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine BeeperSimple_Every100ms @global
|
||||||
|
;
|
||||||
|
; @clobbers r16
|
||||||
|
|
||||||
|
BeeperSimple_Every100ms:
|
||||||
|
lds r16, beeperSimpleTimer
|
||||||
|
tst r16
|
||||||
|
breq BeeperSimple_Every100ms_ret
|
||||||
|
dec r16
|
||||||
|
brne BeeperSimple_Every100ms_setTimer
|
||||||
|
|
||||||
|
sbis BEEPER_SIMPLE_PORT, BEEPER_SIMPLE_PINNUM ; skip next op if beeper is on
|
||||||
|
rjmp BeeperSimple_Tick_isOff
|
||||||
|
; is on
|
||||||
|
cbi BEEPER_SIMPLE_PORT, BEEPER_SIMPLE_PINNUM ; off
|
||||||
|
lds r16, beeperSimpleOffTime
|
||||||
|
rjmp BeeperSimple_Every100ms_setTimer
|
||||||
|
BeeperSimple_Tick_isOff:
|
||||||
|
sbi BEEPER_SIMPLE_PORT, BEEPER_SIMPLE_PINNUM ; on
|
||||||
|
lds r16, beeperSimpleOnTime
|
||||||
|
BeeperSimple_Every100ms_setTimer:
|
||||||
|
sts beeperSimpleTimer, r16
|
||||||
|
BeeperSimple_Every100ms_ret:
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine BeeperSimple_SetTiming @global
|
||||||
|
;
|
||||||
|
; Set blinking timing for LED. Switch LED on.
|
||||||
|
; @param r18 ontime (in 1/10s)
|
||||||
|
; @param r19 offtime (in 1/10s)
|
||||||
|
; @clobbers none
|
||||||
|
;
|
||||||
|
|
||||||
|
BeeperSimple_SetTiming:
|
||||||
|
cbi BEEPER_SIMPLE_PORT, BEEPER_SIMPLE_PINNUM ; off
|
||||||
|
sts beeperSimpleOnTime, r18
|
||||||
|
sts beeperSimpleTimer, r18
|
||||||
|
sts beeperSimpleOffTime, r19
|
||||||
|
tst r18
|
||||||
|
breq BeeperSimple_SetTiming_ret
|
||||||
|
sbi BEEPER_SIMPLE_PORT, BEEPER_SIMPLE_PINNUM ; on
|
||||||
|
BeeperSimple_SetTiming_ret:
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BEEPER_SIMPLE_END:
|
||||||
|
.equ MODULE_SIZE_BEEPER_SIMPLE = BEEPER_SIMPLE_END-BEEPER_SIMPLE_BEGIN
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
41
avr/modules/beeper_simple/recv.asm
Normal file
41
avr/modules/beeper_simple/recv.asm
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
; ***************************************************************************
|
||||||
|
; copyright : (C) 2026 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. *
|
||||||
|
; ***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine BeeperSimple_OnPacketReceived @global
|
||||||
|
;
|
||||||
|
; @clobbers any, -X
|
||||||
|
|
||||||
|
BeeperSimple_OnPacketReceived:
|
||||||
|
adiw xh:xl, NETMSG_OFFS_CMD ; command
|
||||||
|
ld r16, X
|
||||||
|
sbiw xh:xl, NETMSG_OFFS_CMD
|
||||||
|
cpi r16, NETMSG_CMD_VALUE_SET
|
||||||
|
breq BeeperSimple_OnPacketReceived_set
|
||||||
|
clc ; unexpected msg
|
||||||
|
ret
|
||||||
|
BeeperSimple_OnPacketReceived_set:
|
||||||
|
rcall NETMSG_ValueRead ; (none)
|
||||||
|
cpi r17, VALUE_ID_BEEPERSIMPLE_TIMING
|
||||||
|
breq BeeperSimple_OnPacketReceived_setTiming
|
||||||
|
clc
|
||||||
|
ret
|
||||||
|
BeeperSimple_OnPacketReceived_setTiming:
|
||||||
|
rcall BeeperSimple_SetTiming
|
||||||
|
BeeperSimple_OnPacketReceived_sendAck:
|
||||||
|
push xl
|
||||||
|
push xh
|
||||||
|
ldi r23, NETMSG_CMD_VALUE_SET_ACK
|
||||||
|
bigcall Main_SendValueResponse
|
||||||
|
pop xh
|
||||||
|
pop xl
|
||||||
|
sec
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
Reference in New Issue
Block a user