CMSIS DSP Software Library: arm_fft_bin_example_f32.c Source File
Main Page
Modules
Data Structures
Files
Examples
File List
Globals
arm_fft_bin_example_f32.c
Go to the documentation of this file.00001 /* ----------------------------------------------------------------------
00002 * Copyright (C) 2010 ARM Limited. All rights reserved.
00003 *
00004 * $Date: 29. November 2010
00005 * $Revision: V1.0.3
00006 *
00007 * Project: CMSIS DSP Library
00008 * Title: arm_fft_bin_example_f32.c
00009 *
00010 * Description: Example code demonstrating calculation of Max energy bin of
00011 * frequency domain of input signal.
00012 *
00013 * Target Processor: Cortex-M4/Cortex-M3
00014 *
00015 *
00016 * Version 1.0.3 2010/11/29
00017 * Re-organized the CMSIS folders and updated documentation.
00018 *
00019 * Version 1.0.1 2010/10/05 KK
00020 * Production release and review comments incorporated.
00021 *
00022 * Version 1.0.0 2010/09/20 KK
00023 * Production release and review comments incorporated.
00024 * ------------------------------------------------------------------- */
00025
00082 #include "arm_math.h"
00083
00084 #define TEST_LENGTH_SAMPLES 2048
00085
00086 /* -------------------------------------------------------------------
00087 * External Input and Output buffer Declarations for FFT Bin Example
00088 * ------------------------------------------------------------------- */
00089 extern float32_t testInput_f32_10khz[TEST_LENGTH_SAMPLES];
00090 static float32_t testOutput[TEST_LENGTH_SAMPLES/2];
00091
00092 /* ------------------------------------------------------------------
00093 * Global variables for FFT Bin Example
00094 * ------------------------------------------------------------------- */
00095 uint32_t fftSize = 1024;
00096 uint32_t ifftFlag = 0;
00097 uint32_t doBitReverse = 1;
00098
00099 /* Reference index at which max energy of bin ocuurs */
00100 uint32_t refIndex = 213, testIndex = 0;
00101
00102 /* ----------------------------------------------------------------------
00103 * Max magnitude FFT Bin test
00104 * ------------------------------------------------------------------- */
00105
00106 int32_t main(void)
00107 {
00108
00109 arm_status status;
00110 arm_cfft_radix4_instance_f32 S;
00111 float32_t maxValue;
00112
00113 status = ARM_MATH_SUCCESS;
00114
00115 /* Initialize the CFFT/CIFFT module */
00116 status = arm_cfft_radix4_init_f32(&S, fftSize,
00117 ifftFlag, doBitReverse);
00118
00119 /* Process the data through the CFFT/CIFFT module */
00120 arm_cfft_radix4_f32(&S, testInput_f32_10khz);
00121
00122
00123 /* Process the data through the Complex Magnitude Module for
00124 calculating the magnitude at each bin */
00125 arm_cmplx_mag_f32(testInput_f32_10khz, testOutput,
00126 fftSize);
00127
00128 /* Calculates maxValue and returns corresponding BIN value */
00129 arm_max_f32(testOutput, fftSize, &maxValue, &testIndex);
00130
00131 if(testIndex != refIndex)
00132 {
00133 status = ARM_MATH_TEST_FAILURE;
00134 }
00135
00136 /* ----------------------------------------------------------------------
00137 ** Loop here if the signals fail the PASS check.
00138 ** This denotes a test failure
00139 ** ------------------------------------------------------------------- */
00140
00141 if( status != ARM_MATH_SUCCESS)
00142 {
00143 while(1);
00144 }
00145 }
00146
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
Generated on Mon Nov 29 2010 17:19:56 for CMSIS DSP Software Library by
1.7.2
Wyszukiwarka
Podobne podstrony:
arm ?t bin example ?2?arm linear interp example ?2? sourcearm signal converge example ?2? sourcearm class marks example ?2? sourcearm sin cos example ?2? sourcearm sin cos example ?2? sourcearm?t bin example?2? examplearm dotproduct example ?2? sourcearm fir example ?2? sourcearm convolution example ?2? sourcearm variance example ?2? sourcearm matrix example ?2? sourcearm iir lattice init ?2? sourcearm biquad ?scade ?1 ?2? sourcearm cmplx mag squared ?2? sourcearm ?ft radix4 init ?2? sourcearm cmplx mult cmplx ?2? sourcearm fir interpolate init ?2? sourcearm cmplx dot prod ?2? sourcewięcej podobnych podstron