38 lines
1.0 KiB
C
38 lines
1.0 KiB
C
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include "FIRFilterCode.h"
|
|
// #include "FFTCode.h"
|
|
#define NUMTAPS 128
|
|
uint16_t size, i;
|
|
|
|
#define q31_float_to_int(x) ( (int32_t) ( (double)(x)*(double)0x7FFFFFFF ) )
|
|
#define DAC_SAMPLE_RATE 21875
|
|
|
|
uint32_t centerfreq;
|
|
uint32_t bw;
|
|
|
|
int main(void){
|
|
double FirCoeff[NUMTAPS + 1];
|
|
// buff[0] = '\0';
|
|
centerfreq = 1500;
|
|
bw = 500;
|
|
double normalized_center_freq, normalized_bw;
|
|
|
|
normalized_center_freq = (double)(centerfreq*2)/DAC_SAMPLE_RATE;
|
|
normalized_bw = (double)(bw*2)/DAC_SAMPLE_RATE;
|
|
|
|
TWindowType WindowType;
|
|
RectWinFIR(FirCoeff, NUMTAPS, firBPF, normalized_center_freq, normalized_bw);
|
|
printf("freq %f, bw %f", normalized_center_freq, normalized_bw);
|
|
FIRFilterWindow(FirCoeff, NUMTAPS, wtKAISER, 3.2);
|
|
printf("coeff = [");
|
|
for( int index = 0; index < NUMTAPS; index++){
|
|
// printf("%d, ", q31_float_to_int(FirCoeff[index]));
|
|
printf("%f, ", FirCoeff[index]);
|
|
}
|
|
printf("]");
|
|
|
|
}
|