avr: finalized label names.

This commit is contained in:
Martin Preuss
2024-09-13 01:08:07 +02:00
parent 4ba0e01c9f
commit ee94d8a583
5 changed files with 104 additions and 44 deletions

View File

@@ -71,14 +71,16 @@
; ---------------------------------------------------------------------------
; defines for values
.equ VALUE_ID_TEMP1 = 0x01
.equ VALUE_ID_HUM1 = 0x02
.equ VALUE_ID_SI7021_TEMP = 0x01
.equ VALUE_ID_SI7021_HUM = 0x02
.equ VALUE_ID_ADC = 0x03
.equ VALUE_ID_REED1 = 0x04
.equ VALUE_ID_REED2 = 0x05
.equ VALUE_ID_DS18B20_TEMP = 0x06
.equ VALUE_ID_REED_CONF = 0x81
; ***************************************************************************
@@ -216,10 +218,11 @@ sramTimerEnqueueValues: .byte 2
.cseg
#ifdef MODULES_LED
ledA3Flash: .db DDRA+0x20, PORTA+0x20, PINA+0x20, (1<<PORTA3)
blinkPattern: .db 2, 50, 0xff, 0xff ; 1 short blink, 5s pause, restart
;blinkPattern2: .db 2, 2, 0xff, 0xff ; 1 short blink, short pause, restart
#endif
@@ -274,10 +277,7 @@ periodicalLcdMark:
writeStats:
#ifdef MODULES_DS18B20
rcall printDs
#endif
; rcall printSendStats
rcall printSendStats
ret
#endif
@@ -304,7 +304,6 @@ sendSI7021Temp:
rjmp Timer_SetValueTo1s
sendSI7021Temp_okay:
ret
#endif
@@ -347,20 +346,63 @@ onEvery100ms:
; ---------------------------------------------------------------------------
; onPacketReceived:
; @routine onPacketReceived:
;
; Called after a packet was received via COM module. Add your routine calls here.
;
; The packet will be released in any case after return from this call.
; IN:
; - X : pointer to received buffer
; OUT:
; - CFLAG: set if handled, cleared otherwise
; USED: depending on called routines
;
; @return CFLAG set if message handled, cleared otherwise
; @param X pointer to received buffer
; @clobbers all
onPacketReceived:
rcall CPRO_OnPacketReceived
; get msg code
adiw xh:xl, COM2_MSG_OFFS_CMD
ld r16, x
sbiw xh:xl, COM2_MSG_OFFS_CMD
cpi r16, CPRO_CMD_VALUE_SET
brne onPacketReceived_l1
; msg code is CPRO_CMD_VALUE_SET
rjmp onSetValueReceived
onPacketReceived_l1:
rjmp CPRO_OnPacketReceived
; @end
onSetValueReceived:
adiw xh:xl, CPRO_PACKET_VALUE_OFFS_VALUEID
ld r16, X
sbiw xh:xl, CPRO_PACKET_VALUE_OFFS_VALUEID
cpi r16, VALUE_ID_REED_CONF
brne onSetValueReceived_l1
#ifdef MODULES_REED
rjmp onSetReedConf
#else
ret
#endif
onSetValueReceived_l1:
clc
ret
#ifdef MODULES_REED
onSetReedConf:
; get new value
adiw xh:xl, CPRO_PACKET_VALUE_OFFS_VALUE
ld r16, X
sbiw xh:xl, CPRO_PACKET_VALUE_OFFS_VALUE
; set config
rcall REED_SetConfig
; send ACK
ldi r16, CPRO_CMD_VALUE_SET_ACK
rcall CPRO_SendSetValueResponse
sec
ret
#endif