From dbe899586d0efccade7a0fc53c74b9b77b5e9e9e Mon Sep 17 00:00:00 2001 From: Clement Mauperon <47110246+tensaiji@users.noreply.github.com> Date: Tue, 21 Mar 2023 18:18:30 +0100 Subject: [PATCH] =?UTF-8?q?fin=20s=C3=A9ance?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- soft/PjtKEIL_StepSon/Src/GestionSon.s | 52 ++++++++++++++++--- soft/PjtKEIL_StepSon/Src/principal.c | 7 +++ soft/PjtKEIL_StepSon/StepSon.uvoptx | 72 +++++++++++++++++++++++---- soft/PjtKEIL_StepSon/StepSon.uvprojx | 39 ++++++++++++--- 4 files changed, 146 insertions(+), 24 deletions(-) diff --git a/soft/PjtKEIL_StepSon/Src/GestionSon.s b/soft/PjtKEIL_StepSon/Src/GestionSon.s index 8a75b7a..661a873 100644 --- a/soft/PjtKEIL_StepSon/Src/GestionSon.s +++ b/soft/PjtKEIL_StepSon/Src/GestionSon.s @@ -10,21 +10,57 @@ ;Section RAM (read write): area maram,data,readwrite - +SortieSon dcw 0 +Index dcb 0 +ResolutionEntree equ 32768 +ResolutionSortie equ 720 + ; =============================================================================================== - + IMPORT Son + IMPORT LongueurSon + EXPORT SortieSon + EXPORT CallbackSon + EXPORT Index ;Section ROM code (read only) : area moncode,code,readonly -; écrire le code ici - - - - - +CallbackSon proc + ; int* indexAdress = &Index + ldr r5,=Index + ; int index = *indexAdress + ldr r6,[r5] + ; if (index < LongueurSon) return; + ldr r7,=LongueurSon + ldr r7,[r7] + cmp r6,r7 + blt LireEchantillon + bx lr +LireEchantillon + ; long* son = &Son + ldr r7,=Son + ; long echantillon = son[index] + ldr r7,[r6] + ; index += 1 + add r6,r6,#1 + ; *indexAdresse = index + str r6,[r5] + ; int resolutionEntree = ResolutionEntree + ldr r5,=ResolutionEntree + ; son = son + ResolutionEntree + adds r7,r7,r5 + ; int resolutionSortie = ResolutionSortie + ldr r5,=ResolutionSortie + ; son = son / resolutionSortie + sdiv r7,r7,r5 + ; long* sortieSon = &SortieSon + ldr r5,=SortieSon + ; *sortieSon = son + str r7,[r5] + bx lr + endp END \ No newline at end of file diff --git a/soft/PjtKEIL_StepSon/Src/principal.c b/soft/PjtKEIL_StepSon/Src/principal.c index d09be75..df994ef 100644 --- a/soft/PjtKEIL_StepSon/Src/principal.c +++ b/soft/PjtKEIL_StepSon/Src/principal.c @@ -2,7 +2,10 @@ #include "DriverJeuLaser.h" +#define CLOCK_FREQ 72000 // kHz +extern int PeriodeSonMicroSec; +extern void CallbackSon(void); int main(void) { @@ -15,9 +18,13 @@ int main(void) CLOCK_Configure(); +Timer_1234_Init_ff(TIM4, PeriodeSonMicroSec * CLOCK_FREQ); +GPIO_Configure(GPIOB, 1, OUTPUT, OUTPUT_PPULL); +Active_IT_Debordement_Timer(TIM4, 2, CallbackSon); + //============================================================================ diff --git a/soft/PjtKEIL_StepSon/StepSon.uvoptx b/soft/PjtKEIL_StepSon/StepSon.uvoptx index a13d7da..a440d05 100644 --- a/soft/PjtKEIL_StepSon/StepSon.uvoptx +++ b/soft/PjtKEIL_StepSon/StepSon.uvoptx @@ -10,7 +10,7 @@ *.s*; *.src; *.a* *.obj; *.o *.lib - *.txt; *.h; *.inc + *.txt; *.h; *.inc; *.md *.plm *.cpp 0 @@ -75,7 +75,7 @@ 1 0 - 0 + 1 18 @@ -154,6 +154,14 @@ + + + 1 + 0 + 0x08000A38 + 0 + + 0 @@ -174,7 +182,7 @@ 0 0 0 - 0 + 1 0 0 0 @@ -199,8 +207,13 @@ 0 - ((portb & 0x00000002) >> 1 & 0x2) >> 1 - FF000000000000000000000000000000E0FFEF400100000000000000000000000000000028706F7274622026203078303030303030303229203E3E2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000F03F160000000000000000000000000000000000000096020008 + `SortieSon + 008000000000000000000000000000000000894000000000000000000000000000000000536F72746965536F6E00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000001000000000000000000E03F17000000000000000000000000000000000000009C090008 + + + 1 + `Index + 008000000000000000000000000000000070B74000000000000000000000000000000000496E6465780000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000002000000000000000000E03F17000000000000000000000000000000000000009C090008 @@ -460,7 +473,7 @@ 1 0 - 1 + 0 18 @@ -538,7 +551,24 @@ -U066CFF574857847167074929 -O2254 -S0 -C0 -A0 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC800 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM) - + + + 0 + 0 + 27 + 1 +
0
+ 0 + 0 + 0 + 0 + 0 + 0 + .\Src\GestionSon.s + + +
+
1 @@ -624,6 +654,30 @@ 0 0 + + 1 + 2 + 2 + 0 + 0 + 0 + .\Src\bruitverre.asm + bruitverre.asm + 0 + 0 + + + 1 + 3 + 2 + 0 + 0 + 0 + .\Src\GestionSon.s + GestionSon.s + 0 + 0 + @@ -634,7 +688,7 @@ 0 2 - 2 + 4 2 0 0 @@ -654,7 +708,7 @@ 0 3 - 3 + 5 4 0 0 diff --git a/soft/PjtKEIL_StepSon/StepSon.uvprojx b/soft/PjtKEIL_StepSon/StepSon.uvprojx index d0b5c10..3a1afa8 100644 --- a/soft/PjtKEIL_StepSon/StepSon.uvprojx +++ b/soft/PjtKEIL_StepSon/StepSon.uvprojx @@ -10,7 +10,7 @@ Simu 0x4 ARM-ADS - 5060750::V5.06 update 6 (build 750)::.\ARMCC + 5060960::V5.06 update 7 (build 960)::.\ARMCC 0 @@ -388,6 +388,16 @@ 1 .\Src\principal.c + + bruitverre.asm + 2 + .\Src\bruitverre.asm + + + GestionSon.s + 2 + .\Src\GestionSon.s + @@ -797,6 +807,16 @@ 1 .\Src\principal.c + + bruitverre.asm + 2 + .\Src\bruitverre.asm + + + GestionSon.s + 2 + .\Src\GestionSon.s + @@ -897,7 +917,7 @@ CibleSondeST 0x4 ARM-ADS - 5060750::V5.06 update 6 (build 750)::.\ARMCC + 5060960::V5.06 update 7 (build 960)::.\ARMCC 0 @@ -1275,6 +1295,16 @@ 1 .\Src\principal.c + + bruitverre.asm + 2 + .\Src\bruitverre.asm + + + GestionSon.s + 2 + .\Src\GestionSon.s + @@ -1323,11 +1353,6 @@ <Project Info> - - - - - 0 1