[开发资料] MDK-ARM平台下的fft

[复制链接]
675|0
 楼主| mollylawrence 发表于 2022-12-10 22:39 | 显示全部楼层 |阅读模式

MDK-ARM平台

  1.     #include "arm_math.h"
  2. #include "arm_const_structs.h"

  3. #define N 128

  4. float32_t testInput[N][2]={0};
  5. float32_t FFT_Output[N]={0};

  6. int main(void)
  7. {
  8.         /*
  9.                 ST固件库中的启动文件已经执行了 SystemInit() 函数,该函数在 system_stm32f4xx.c 文件,主要功能是
  10.         配置CPU系统的时钟,内部Flash访问时序,配置FSMC用于外部SRAM
  11.         */
  12.         bsp_Init();                /* 硬件初始化 */
  13.        
  14.         printf("start\r\n");
  15.        
  16.         for(int i=0;i<N/4;i++)
  17.         {
  18.                 testInput[4*i][0]=1;
  19.                 testInput[4*i+1][0]=0;
  20.                 testInput[4*i+2][0]=-1;
  21.                 testInput[4*i+3][0]=0;
  22.         }
  23.        
  24.         arm_cfft_f32(&arm_cfft_sR_f32_len128,(float32_t *)testInput,0, 1);
  25.        
  26.         arm_cmplx_mag_f32((float32_t *)testInput, FFT_Output, N);
  27.        
  28.         for(int i=0;i<N;i++)
  29.         {
  30.                 printf("%d: %f\r\n",i,FFT_Output[i]);
  31.         }

  32.         /* 主程序大循环 */
  33.         while (1)
  34.         {
  35.                
  36.         }
  37. }


您需要登录后才可以回帖 登录 | 注册

本版积分规则

49

主题

1988

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部