##// END OF EJS Templates
More cleanup, added subdirectories inside include dir, cleaned include tree,...
More cleanup, added subdirectories inside include dir, cleaned include tree, Doxygen configured, started doxygen documentation.

File last commit:

r53:8299696715f8 dev_alexis
r72:6ad096835359 dev_alexis
Show More
main.c
106 lines | 3.4 KiB | text/x-c | CLexer
/* ----------------------------------------------------------------------
* Copyright (C) 2010 ARM Limited. All rights reserved.
*
* $Date: 29. November 2010
* $Revision: V1.0.3
*
* Project: CMSIS DSP Library
* Title: arm_convolution_example_f32.c
*
* Description: Example code demonstrating Convolution of two input signals using fft.
*
* Target Processor: Cortex-M4/Cortex-M3
*
*
* Version 1.0.3 2010/11/29
* Re-organized the CMSIS folders and updated documentation.
*
* Version 1.0.1 2010/10/05 KK
* Production release and review comments incorporated.
*
* Version 1.0.0 2010/09/20 KK
* Production release and review comments incorporated.
* ------------------------------------------------------------------- */
#include <arm_math.h>
#include <math.h>
#include <stdio.h>
#include <gpio.h>
#include <bsp.h>
//#include "math_helper.h"
#include <terminal.h>
/* ----------------------------------------------------------------------
* Defines each of the tests performed
* ------------------------------------------------------------------- */
//#define MAX_BLOCKSIZE 1024
#define MAX_BLOCKSIZE 16
/* ----------------------------------------------------------------------
* Declare I/O buffers
* ------------------------------------------------------------------- */
float32_t Ak[MAX_BLOCKSIZE*2]; /* Input A */
#define LCD_COLOR_WHITE 0xFFFF
#define LCD_COLOR_BLACK 0x0000
#define LCD_COLOR_GREY 0xF7DE
#define LCD_COLOR_BLUE 0x001F
#define LCD_COLOR_BLUE2 0x051F
#define LCD_COLOR_RED 0xF800
#define LCD_COLOR_MAGENTA 0xF81F
#define LCD_COLOR_GREEN 0x07E0
#define LCD_COLOR_CYAN 0x7FFF
#define LCD_COLOR_YELLOW 0xFFE0
extern streamdevice* __opnfiles__[__MAX_OPENED_FILES__];
int main()
{
arm_status status; /* Status of the example */
arm_cfft_radix4_instance_f32 cfft_instance; /* CFFT Structure instance */
/* CFFT Structure instance pointer */
arm_cfft_radix4_instance_f32 *cfft_instance_ptr =
(arm_cfft_radix4_instance_f32*) &cfft_instance;
/* Initialise the fft input buffers with all zeros */
arm_fill_f32(0.0, Ak, MAX_BLOCKSIZE);
for(int i =0;i<(MAX_BLOCKSIZE);i++)
{
Ak[2*i] = sin(4.0*PI*(float32_t)i/MAX_BLOCKSIZE);
printf("%f\n\r",Ak[i]);
}
//gpioclr(LED1);
/* Initialize the CFFT function to compute 64 point fft */
status = arm_cfft_radix4_init_f32(cfft_instance_ptr, MAX_BLOCKSIZE, 0, 1);
/* Transform input a[n] from time domain to frequency domain A[k] */
arm_cfft_radix4_f32(cfft_instance_ptr, Ak);
//gpioset(LED1);
/* Initialize the CIFFT function to compute 64 point ifft */
//status = arm_cfft_radix4_init_f32(cfft_instance_ptr, 16, 1, 1);
/* Transform the multiplication output from frequency domain to time domain,
that gives the convolved output */
//arm_cfft_radix4_f32(cfft_instance_ptr, AxB);
/* SNR Calculation */
//snr = arm_snr_f32((float32_t *)testRefOutput_f32, AxB, srcALen + srcBLen - 1);
/* Compare the SNR with threshold to test whether the
computed output is matched with the reference output values. */
printf("FFT Done!\n\r");
for(int i =0;i<(MAX_BLOCKSIZE*2);i++)
{
printf("%f %f\n\r",Ak[2*i],Ak[(2*i)+1]);
}
while(1); /* main function does not return */
}