forked from acco/chti23
91 lines
No EOL
1.4 KiB
ArmAsm
91 lines
No EOL
1.4 KiB
ArmAsm
PRESERVE8
|
|
THUMB
|
|
|
|
|
|
; ====================== 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 dcd 0
|
|
|
|
; ===============================================================================================
|
|
|
|
|
|
EXPORT CallbackSon ;
|
|
EXTERN bruitverre ;
|
|
EXTERN Son ;
|
|
EXTERN LongueurSon ;
|
|
EXPORT SortieSon ; //pour evaluer la variable lors des tests
|
|
EXPORT StartSon ;
|
|
include ../Driver/DriverJeuLaser.inc;
|
|
EXPORT index ; //pour evaluer la variable lors des tests
|
|
|
|
|
|
|
|
;Section ROM code (read only) :
|
|
area moncode,code,readonly
|
|
; écrire le code ici
|
|
CallbackSon proc
|
|
ldr r1, =index
|
|
ldr r2, [r1]
|
|
ldr r3, =Son
|
|
ldr r0, LongueurSon
|
|
|
|
cmp r2, r0
|
|
ble notEqual
|
|
push {R8}
|
|
push {R5}
|
|
ldr R8, =SortieSon
|
|
mov R5,#-1
|
|
strh R5,[R8]
|
|
pop {R5}
|
|
pop{R8}
|
|
|
|
bx lr
|
|
|
|
notEqual
|
|
mov r0, #2
|
|
mul r0, r2
|
|
ldrsh r0, [r3, r0]
|
|
add r0, #32768
|
|
push {r4}
|
|
mov r4, #719
|
|
mul r0, r4
|
|
mov r4, #65535
|
|
udiv r0, r4
|
|
pop {r4}
|
|
push {r7}
|
|
ldr r7, =SortieSon
|
|
strh r0, [r7]
|
|
pop {r7}
|
|
|
|
push{r2}
|
|
push {lr}
|
|
bl PWM_Set_Value_TIM3_Ch3
|
|
pop {lr}
|
|
pop{r2}
|
|
|
|
add r2, #1
|
|
push {r5}
|
|
ldr r5, =index
|
|
str r2, [r5]
|
|
|
|
pop {r5}
|
|
|
|
bx lr
|
|
|
|
endp
|
|
|
|
|
|
StartSon proc
|
|
ldr R1, =index
|
|
mov R2,#0
|
|
str R2, [R1]
|
|
bx lr
|
|
endp
|
|
END |