fix: fft function type

This commit is contained in:
liuyihui 2023-04-25 19:09:55 +08:00
parent 724eb658e7
commit c1d0166c44
2 changed files with 2 additions and 4 deletions

View File

@ -8,4 +8,4 @@
#define FFT_BIN(num, re) (uint16_t)((float)(num + 0.5) * re) #define FFT_BIN(num, re) (uint16_t)((float)(num + 0.5) * re)
#define FFT_INDEX(freq, re) (uint16_t)((float)freq / re) #define FFT_INDEX(freq, re) (uint16_t)((float)freq / re)
int FFT(q15_t *data); void FFT(q15_t *data);

View File

@ -84,7 +84,7 @@ static inline void butterfly(q15_t *data) {
} }
} }
int FFT(q15_t *data) { void FFT(q15_t *data) {
for (uint16_t i = 0; i < N; i++) { for (uint16_t i = 0; i < N; i++) {
res[Re(i)] = data[i]; // real res[Re(i)] = data[i]; // real
res[Im(i)] = 0; // imaginary res[Im(i)] = 0; // imaginary
@ -93,6 +93,4 @@ int FFT(q15_t *data) {
butterfly(res); butterfly(res);
bitreversal((q31_t *)res); bitreversal((q31_t *)res);
for (uint16_t i = 0; i < N; i++) data[i] = (q15_t)abs(res[Re(i)]); for (uint16_t i = 0; i < N; i++) data[i] = (q15_t)abs(res[Re(i)]);
return 0;
} }