forked from acco/chti23
71 lines
No EOL
1.1 KiB
ArmAsm
71 lines
No EOL
1.1 KiB
ArmAsm
PRESERVE8
|
|
THUMB
|
|
EXPORT CallbackSon
|
|
EXPORT SortieSon
|
|
EXPORT i
|
|
IMPORT Son
|
|
IMPORT LongueurSon
|
|
INCLUDE DriverJeuLaser.inc
|
|
;void CallbackSon(void){
|
|
; static int i = 0;
|
|
; if(i < 5512){
|
|
;0 SortieSon = (Son[i] + 32768) * 719 / 65535;
|
|
; i++;
|
|
; }
|
|
;}
|
|
|
|
|
|
|
|
; ====================== zone de réservation de données, ======================================
|
|
;Section RAM (read only) :
|
|
area mesdata,data,readonly
|
|
|
|
|
|
;Section RAM (read write):
|
|
area maram,data,readwrite
|
|
|
|
i dcd 0
|
|
SortieSon dcw 0
|
|
|
|
|
|
; ===============================================================================================
|
|
|
|
|
|
|
|
|
|
;Section ROM code (read only) :
|
|
area moncode,code,readonly
|
|
; écrire le code ici
|
|
|
|
CallbackSon proc
|
|
push {lr}
|
|
; static int i = 0;
|
|
ldr r0,=i
|
|
ldr r1, [r0]
|
|
ldr r2,LongueurSon
|
|
cmp r2, r1
|
|
; if(i < 5512)
|
|
ble fin
|
|
;0 SortieSon = (Son[i] + 32768) * 719 / 65535;
|
|
ldr r3,=Son
|
|
ldrsh r2, [r3,r1, LSL#1]
|
|
add r2, #32768
|
|
mov r12, #719
|
|
mul r2, r12
|
|
mov r12, #65535
|
|
udiv r2, r12
|
|
; i++;
|
|
add r1, #1
|
|
str r1, [r0]
|
|
; On stocke enfin la sortie son
|
|
ldr r0, =SortieSon
|
|
strh r2, [r0]
|
|
mov r0, r2
|
|
bl PWM_Set_Value_TIM3_Ch3
|
|
|
|
fin
|
|
pop {pc}
|
|
ENDFUNC
|
|
|
|
|
|
END |