这是一个工程文件,只有注释可以参考。给大家看看主函数
#include "main.h"
#define TEST_LENGTH_SAMPLES 2048
//FFT Bin输入输出缓冲
extern float32_t testInput_f32_10khz[TEST_LENGTH_SAMPLES];
static float32_t testOutput[TEST_LENGTH_SAMPLES/2];
uint32_t fftSize=1024;
uint32_t ifftFlag=0;
uint32_t doBitReverse=1;
uint32_t refIndex=213,testIndex=0;/* Reference index at which max energy of bin ocuurs */
/*Max magnitude FFT Bin test*/
int main(void)
{
arm_status status;
arm_cfft_radix4_instance_f32 S;
float32_t maxValue;
Key_Init();
LED_Init();
LCD_Init();
LCD_Clear(BLUE);
LCD_String(20,20,"FPU process demo",RED);
status = ARM_MATH_SUCCESS;
//初始化CFFT/CIFFT单元
status = arm_cfft_radix4_init_f32(&S,fftSize,ifftFlag, doBitReverse);
//通过CFFT/CIFFT单元处理数据
arm_cfft_radix4_f32(&S, testInput_f32_10khz);
//通过复杂的幅度运算单元处理数据,以计算每个bin的幅度
arm_cmplx_mag_f32(testInput_f32_10khz, testOutput,fftSize);
//计算最大值并返回一致的BIN值
arm_max_f32(testOutput, fftSize, &maxValue, &testIndex);
if(testIndex != refIndex)status = ARM_MATH_TEST_FAILURE;
while(status != ARM_MATH_SUCCESS)LCD_String(20,50,"ARM math failed",RED);
LCD_String(20,50,"ARM math sucess",RED);
while(1);
}
|