Raphael_lacroix-Aurelia_lej.../PjtKEIL_DFT_Signal_Reel/Src/principal.c

56 lines
1.2 KiB
C

#include "DriverJeuLaser.h"
extern int DFT_ModuleAuCarre(short int * LeSignal, int k);
extern short int LeSignal[];
int tab[64];
short int dma_buf[64];
//int testPeriod=0;
void fTick(){
//testPeriod = 1;
// Démarrage de la DMA sur 64 échantillons
Start_DMA1(64);
// Attente de la fin de DMA
Wait_On_End_Of_DMA1();
// Arrêter la DM
Stop_DMA1;
for (int k=0; k < 64; k++){
tab[k] = DFT_ModuleAuCarre((short *) &dma_buf[0], k);
}
//testPeriod = 0;
}
int main(void)
{
// ===========================================================================
// ============= INIT PERIPH (faites qu'une seule fois) =====================
// ===========================================================================
// Après exécution : le coeur CPU est clocké à 72MHz ainsi que tous les timers
CLOCK_Configure();
Systick_Period_ff( 360000 ); // 5ms pour une clock a 72 MhHz
Systick_Prio_IT(1, fTick);
Init_TimingADC_ActiveADC_ff( ADC1, 72 );
Single_Channel_ADC( ADC1, 2 );
Init_Conversion_On_Trig_Timer_ff( ADC1, TIM2_CC2, 225 );
Init_ADC1_DMA1( 0, dma_buf );
SysTick_On;
SysTick_Enable_IT;
//============================================================================
while (1)
{
}
}