80 lines
No EOL
1.1 KiB
ArmAsm
80 lines
No EOL
1.1 KiB
ArmAsm
PRESERVE8
|
|
THUMB
|
|
include Driver/DriverJeuLaser.inc
|
|
|
|
|
|
; ====================== zone de réservation de données, ======================================
|
|
;Section RAM (read only) :
|
|
area mesdata,data,readonly
|
|
extern Son
|
|
extern LongueurSon
|
|
|
|
;Section RAM (read write):
|
|
area maram,data,readwrite
|
|
|
|
SortieSon dcd 0
|
|
Index dcw 0
|
|
|
|
; ===============================================================================================
|
|
|
|
|
|
|
|
|
|
;Section ROM code (read only) :
|
|
area moncode,code,readonly
|
|
; écrire le code ici
|
|
|
|
EXPORT CallbackSon
|
|
EXPORT SortieSon
|
|
;EXPORT Index
|
|
EXPORT StartSon
|
|
CallbackSon proc
|
|
|
|
push {lr}
|
|
ldr r0,=Son
|
|
ldr r1,=LongueurSon
|
|
ldr r1,[r1]
|
|
|
|
|
|
ldr r3,=Index ;on met l'adr d'Index dans r3
|
|
ldrh r2,[r3]
|
|
|
|
cmp r1,r2
|
|
ble Fin
|
|
push{r4,r5}
|
|
|
|
ldrsh r0,[r0,r2, LSL #1]; en C Son[Index]
|
|
add r2, r2, #1
|
|
strh r2,[r3] ; maj Index
|
|
mov r1, #32768
|
|
add r0, r0, r1
|
|
mov r4, #719
|
|
mul r0, r0, r4
|
|
asr r0, r0, #16
|
|
|
|
ldr r5,=SortieSon
|
|
str r0,[r5]
|
|
bl PWM_Set_Value_TIM3_Ch3
|
|
|
|
pop{r4,r5}
|
|
|
|
Fin
|
|
|
|
pop {pc}
|
|
|
|
endp
|
|
|
|
|
|
|
|
StartSon proc
|
|
|
|
push {lr}
|
|
ldr r0,=Index
|
|
mov r1, #0
|
|
strh r1,[r0]
|
|
|
|
pop {pc}
|
|
|
|
endp
|
|
|
|
END
|