grpe_Magana_Brunetto/soft/PjtKEIL_StepSon/Src/GestionSon.s

79 lines
No EOL
1.2 KiB
ArmAsm

PRESERVE8
THUMB
include Driver/DriverJeuLaser.inc
; ====================== zone de réservation de données, ======================================
;Section RAM (read only) :
area mesdata,data,readonly
;Section RAM (read write):
area maram,data,readwrite
SortieSon dcw 0
Index dcw 0
; ===============================================================================================
EXPORT SortieSon
EXPORT CallbackSon
;EXPORT StartSon
IMPORT Son
IMPORT LongueurSon
IMPORT PWM_Set_Value_TIM3_Ch3
;Section ROM code (read only) :
area moncode,code,readonly
; écrire le code ici
CallbackSon proc
push {lr}
ldr r3,=Index
ldr r1,[r3]
ldr r0,=LongueurSon
ldr r2,[r0]
cmp r1,r2
beq FinSig
bge Fin
; if index < longueur son
ldr r2,=Son ; r2 = @ debut son
ldrsh r0,[r2,r1, LSL #1]
add r0,#32768
mov r2,#720
mul r0,r2
lsr r0,#16 ; division par 65536
ldr r2,=SortieSon
strh r0,[r2]
add r1,#1
strh r1,[r3]
bl PWM_Set_Value_TIM3_Ch3
b Fin
;if index = longueurSon
FinSig
mov r0,#360
ldr r2,=SortieSon
strh r0,[r2]
add r1,#1
strh r1,[r3]
bl PWM_Set_Value_TIM3_Ch3
; if index > longueurson
Fin
pop {pc}
endp
;StartSon proc
; push {lr}
; ldr r3,=Index
; mov r1, #0
; strh r1,[r3]
; pop {pc}
END