From cbede1dfc8a12bd50278863d2652b0532b3bd8ce Mon Sep 17 00:00:00 2001 From: Yu Zhang Date: Tue, 16 May 2023 18:16:36 +0200 Subject: [PATCH] Dernier step encore --- soft/PjtKEIL_Stepdernier/Src/GestionSon.s | 1 + soft/PjtKEIL_Stepdernier/Src/principal.c | 40 ++++++++++++++++++-- soft/PjtKEIL_Stepdernier/StepDFT.uvprojx | 45 +++++++++++++++++++++++ 3 files changed, 83 insertions(+), 3 deletions(-) diff --git a/soft/PjtKEIL_Stepdernier/Src/GestionSon.s b/soft/PjtKEIL_Stepdernier/Src/GestionSon.s index c9b043c..ed62b9a 100644 --- a/soft/PjtKEIL_Stepdernier/Src/GestionSon.s +++ b/soft/PjtKEIL_Stepdernier/Src/GestionSon.s @@ -84,4 +84,5 @@ StartSon proc mov r3,#0; str r3,[r1] bx lr + endp END \ No newline at end of file diff --git a/soft/PjtKEIL_Stepdernier/Src/principal.c b/soft/PjtKEIL_Stepdernier/Src/principal.c index d63d529..00ec6d7 100644 --- a/soft/PjtKEIL_Stepdernier/Src/principal.c +++ b/soft/PjtKEIL_Stepdernier/Src/principal.c @@ -1,11 +1,15 @@ - +#include "GestionSon.h" #include "DriverJeuLaser.h" extern short int LeSignal[]; extern int DFT_ModuleAuCarre( short int * Signal64ech, char k) ; int Dft_x[64]; short int dma_buf[64]; +int score[4]={0,0,0,0}; +int compteur[4]={0,0,0,0}; +int seuil =65535;//2**16-1 + void callback_Systick(void){ //démarrage de la DMA sur 64 échantillons : Start_DMA1(64); @@ -15,8 +19,37 @@ void callback_Systick(void){ Stop_DMA1; for (char k=0;k<64;k++){ Dft_x[k]=DFT_ModuleAuCarre(&dma_buf[0],k); - } + if (Dft_x[17]>seuil){ + compteur[0]++; + if (compteur[0]==20){ + score[0]++; + compteur[0]=0; + } + } + if (Dft_x[18]>seuil){ + compteur[1]++; + if (compteur[1]==20){ + score[1]++; + compteur[1]=0; + } + } + if (Dft_x[19]>seuil){ + compteur[2]++; + if (compteur[2]==20){ + score[2]++; + compteur[2]=0; + } + + } + if (Dft_x[20]>seuil){ + compteur[3]++; + if (compteur[3]==20){ + score[3]++; + compteur[3]=0; + } + } + } int main(void) @@ -53,7 +86,8 @@ Init_ADC1_DMA1( 0, dma_buf ); - +PWM_Init_ff(TIM3,3,720); +GPIO_Configure(GPIOB,0,OUTPUT,ALT_PPULL); //============================================================================ diff --git a/soft/PjtKEIL_Stepdernier/StepDFT.uvprojx b/soft/PjtKEIL_Stepdernier/StepDFT.uvprojx index 63375da..af34eff 100644 --- a/soft/PjtKEIL_Stepdernier/StepDFT.uvprojx +++ b/soft/PjtKEIL_Stepdernier/StepDFT.uvprojx @@ -398,6 +398,21 @@ 2 .\Src\Signal.asm + + bruitverre.asm + 2 + .\Src\bruitverre.asm + + + GestionSon.h + 5 + .\Src\GestionSon.h + + + GestionSon.s + 2 + .\Src\GestionSon.s + @@ -817,6 +832,21 @@ 2 .\Src\Signal.asm + + bruitverre.asm + 2 + .\Src\bruitverre.asm + + + GestionSon.h + 5 + .\Src\GestionSon.h + + + GestionSon.s + 2 + .\Src\GestionSon.s + @@ -1305,6 +1335,21 @@ 2 .\Src\Signal.asm + + bruitverre.asm + 2 + .\Src\bruitverre.asm + + + GestionSon.h + 5 + .\Src\GestionSon.h + + + GestionSon.s + 2 + .\Src\GestionSon.s +