STM32F769IDiscovery  1.00
uDANTE Audio Networking with STM32F7 DISCO board
FFT.c
Go to the documentation of this file.
1 /*
2  * FFT.c
3  *
4  * Created on: May 31, 2016
5  * Author: Torsten
6  */
7 
8 /* ----------------------------------------------------------------------
9 * Copyright (C) 2010-2012 ARM Limited. All rights reserved.
10 *
11 * $Date: 17. January 2013
12 * $Revision: V1.4.0
13 *
14 * Project: CMSIS DSP Library
15 * Title: arm_fft_bin_example_f32.c
16 *
17 * Description: Example code demonstrating calculation of Max energy bin of
18 * frequency domain of input signal.
19 *
20 * Target Processor: Cortex-M4/Cortex-M3
21 *
22 * Redistribution and use in source and binary forms, with or without
23 * modification, are permitted provided that the following conditions
24 * are met:
25 * - Redistributions of source code must retain the above copyright
26 * notice, this list of conditions and the following disclaimer.
27 * - Redistributions in binary form must reproduce the above copyright
28 * notice, this list of conditions and the following disclaimer in
29 * the documentation and/or other materials provided with the
30 * distribution.
31 * - Neither the name of ARM LIMITED nor the names of its contributors
32 * may be used to endorse or promote products derived from this
33 * software without specific prior written permission.
34 *
35 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
36 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
37 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
38 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
39 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
40 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
41 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
42 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
43 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
44 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
45 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
46 * POSSIBILITY OF SUCH DAMAGE.
47 * -------------------------------------------------------------------- */
48 
103 #include <math.h>
104 
105 #include "FFT.h"
106 #include "arm_const_structs.h"
108 
109 /* ------------------------------------------------------------------
110 * Global variables for FFT Bin Example
111 * ------------------------------------------------------------------- */
112 uint32_t ifftFlag = 0; //specifies if FFT or IFFT
113 uint32_t doBitReverse = 1; //in order to get the right sequence of results
114 
115 /* Reference index at which max energy of bin occurs */
116 uint32_t refIndex = 213;
117 
118 static q31_t sFFTBuf[FFT_SAMPLES];
119 static float32_t input_f32[FFT_SAMPLES];
120 static float32_t input_c32[2 * FFT_SIZE]; //*2 due to complex R + jX as input
121 static float32_t fftResult[2 * FFT_SIZE]; //*2 due to complex R + jX as output
122 
123 static int fftResultReady = 0;
124 static float32_t sFFTmaxValue;
125 static float32_t sFFTminValue;
126 
127 //with Hanning Window we avoid Spectrum Leakage but it makes every bin larger (not so sharp with single frequency anymore)
128 static char sHanningWindow = 0; //Config: with Rectangle (0) or Hanning Window (<>0)
129 
130 static uint16_t prevFftY[2][FFT_SIZE / 2 + 1]; //append the skipFFTBins as 0 values
131 static uint8_t skipFFTBins = FFT_BIN_SKIP; //just 0..6 is valid
132 static uint8_t barType = FFT_DISP_TYPE; //which FFT graph: 0..2
133 
134 void FFT_Display_BarGraph(int ch); //forward declaration
135 void FFT_Display_Points(int ch);
136 void FFT_Display_Lines(int ch);
137 
138 /*
139  * Hanning Window Coefficients, first half only (symmetrical)
140  * w(n) = 0.5 - 0.5 * cos (2 * PI * n / N) | n = 0,1,2 ... N, L = N + 1, for 256-pt FFT 128 values
141  */
142 static const float32_t sHanningWindowCoeff[] = {
143  //0
144  0.0f,
145  0.000151774f,
146  0.0006070039f,
147  0.0013654133f,
148  0.0024265418f,
149  0.0037897452f,
150  0.0054541958f,
151  0.0074188833f,
152  0.0096826148f,
153  0.012244016f,
154  //10
155  0.015101532f,
156  0.0182534279f,
157  0.0216977902f,
158  0.025432528f,
159  0.0294553737f,
160  0.0337638853f,
161  0.0383554469f,
162  0.0432272712f,
163  0.0483764003f,
164  //20
165  0.0537997084f,
166  0.0594939029f,
167  0.0654555268f,
168  0.0716809611f,
169  0.0781664261f,
170  0.0849079846f,
171  0.0919015438f,
172  0.099142858f,
173  0.106627531f,
174  0.1143510188f,
175  //30
176  0.1223086326f,
177  0.1304955414f,
178  0.1389067748f,
179  0.1475372265f,
180  0.156381657f,
181  0.1654346968f,
182  0.1746908499f,
183  0.1841444969f,
184  0.1937898985f,
185  0.203621199f,
186  //40
187  0.21363243f,
188  0.2238175135f,
189  0.2341702664f,
190  0.2446844034f,
191  0.2553535415f,
192  0.2661712036f,
193  0.2771308221f,
194  0.2882257437f,
195  0.2994492325f,
196  0.310794475f,
197  //50
198  0.3222545833f,
199  0.3338226003f,
200  0.3454915028f,
201  0.3572542069f,
202  0.3691035713f,
203  0.3810324025f,
204  0.3930334584f,
205  0.4050994533f,
206  0.4172230619f,
207  0.4293969241f,
208  //60
209  0.4416136491f,
210  0.4538658203f,
211  0.4661459993f,
212  0.478446731f,
213  0.4907605475f,
214  0.5030799733f,
215  0.5153975293f,
216  0.5277057375f,
217  0.5399971256f,
218  0.5522642316f,
219  //70
220  0.5644996083f,
221  0.5766958274f,
222  0.5888454849f,
223  0.6009412046f,
224  0.6129756433f,
225  0.6249414949f,
226  0.636831495f,
227  0.6486384253f,
228  0.6603551178f,
229  0.6719744593f,
230  //80
231  0.6834893958f,
232  0.6948929366f,
233  0.7061781587f,
234  0.7173382109f,
235  0.7283663179f,
236  0.7392557846f,
237  0.75f,
238  0.7605924414f,
239  0.7710266782f,
240  0.7812963758f,
241  //90
242  0.7913952995f,
243  0.8013173182f,
244  0.8110564084f,
245  0.8206066574f,
246  0.8299622674f,
247  0.8391175587f,
248  0.848066973f,
249  0.8568050772f,
250  0.8653265665f,
251  0.8736262674f,
252  //100
253  0.8816991414f,
254  0.8895402873f,
255  0.8971449448f,
256  0.9045084972f,
257  0.9116264741f,
258  0.9184945542f,
259  0.9314644998f,
260  0.9375584914f,
261  0.943386843f,
262  0.9489460161f,
263  //110
264  0.9542326359f,
265  0.9592434929f,
266  0.9639755449f,
267  0.9684259193f,
268  0.9725919141f,
269  0.9764710002f,
270  0.9800608227f,
271  0.9833592021f,
272  0.9863641361f,
273  0.9890738004f,
274  //120
275  0.9914865498f,
276  0.9936009198f,
277  0.9954156265f,
278  0.9969295684f,
279  0.9981418264f,
280  0.9990516644f,
281  0.9996585301f,
282  0.9999620551f
283 };
284 /* ----------------------------------------------------------------------
285 * Max magnitude FFT Bin test
286 * ------------------------------------------------------------------- */
287 
288 int32_t FFT_Init(void)
289 {
290  //just reset the index
291  fftResultReady = 0;
292 
293  return 0;
294 }
295 
296 int32_t FFT_Ready(float32_t **result, int *numResults)
297 {
298  if (fftResultReady)
299  {
300  *result = fftResult + (FFT_SIZE / 2);
301  *numResults = (FFT_SIZE / 2);
302  return 1; //available, ready
303  }
304  else
305  return 0; //not yet ready, available
306 }
307 
315 static void DC_BlockerSample(int32_t *inOutPtr, int ch)
316 {
317 //define float -> uint32_t conversion with rounding handling,
318 //make sure not to use LIB function round which is different
319 //ATT: use suffix f for 0.5, otherwise converted to double internally
320 #define ROUND(x) ((x)>=0?(q31_t)((x)+0.5):(q31_t)((x)-0.5))
321 #define ALPHA 0.9999 //the factor - the larger the faster to reach DC free signal: 0.999 results in -3dB @ 10Hz
322 
323  static double lastIn[2] = {0.0, 0.0};
324  static double lastOut[2] = {0.0, 0.0};
325  register double tmp, res;
326 
327  tmp = (double)*inOutPtr;
328 
329  res = tmp - lastIn[ch] + ALPHA * lastOut[ch];
330  lastIn[ch] = tmp;
331  lastOut[ch] = res;
332 
333  *inOutPtr = ROUND(res);
334 }
335 
336 int32_t FFT_Filter(int ch)
337 {
338  int i, j;
339  q31_t *inBuf = sFFTBuf;
340  int16_t *sampleBuf;
341  int bufLen;
342  uint32_t testIndex;
343 
344  //get the buffer for the audio to analyze
345  bufLen = AUDIO_PLAYER_GetBuffer((uint8_t **)&sampleBuf);
346  if (AUDIO_PLAYER_GetState())
347  {
348  //second buffer was played - now the first is active
349  sampleBuf += bufLen / (2 + sizeof(int16_t));
350  }
351  else
352  {
353  //first buffer was played - now the second is active
354  //sampleBuf += bufLen / (2 + sizeof(int16_t));
355  }
356 
357  if (ch)
358  sampleBuf++;
359 
360  bufLen = FFT_SAMPLES; //in 16bit words, for half-buffer mono
361 
362  //prepare buffer for FFT: as 32bit signed, single channel
363  while (bufLen--)
364  {
365  *inBuf = (q31_t)(*sampleBuf++) << 16; //scale up into highest value range for q31
366  sampleBuf++; //skip the other stereo channel
367  DC_BlockerSample(inBuf++, ch); //remove DC from samples
368  }
369  inBuf = sFFTBuf;
370 
371  //convert as Q31 (as int32_t) to float for FFT
372  arm_q31_to_float(inBuf, input_f32, FFT_SAMPLES);
373 
374  {
375  //convert the float buffer into complex value buffer (store just real part, the other imaginary part remains 0)
376  for (i = 0, j = 0; i < FFT_SIZE; i++)
377  {
378  if (sHanningWindow)
379  {
380  input_c32[2 * i] = input_f32[i] * sHanningWindowCoeff[j];
381  if (j != 127)
382  {
383  if (j < 127)
384  j++;
385  else
386  j--;
387  }
388  }
389  else
390  input_c32[2 * i] = input_f32[i];
391 
392  input_c32[2 * i + 1] = 0.0f;
393  }
394 
395  /* Process the data through the CFFT/CIFFT module - depends on FFT size */
396 #if FFT_SIZE == 1024
398 #elif FFT_SIZE == 512
400 #elif FFT_SIZE == 256
402 #else
403 #warning "Error: NOT supported FFT size"
404 #endif
405 
406  /* Process the data through the Complex Magnitude Module for calculating the magnitude at each bin */
407  arm_cmplx_mag_f32(input_c32, fftResult, FFT_SIZE);
408 
409  {
410  //correct low frequency bins
411  int i;
412  for (i = 0; i < 8; i++)
413  {
414  fftResult[i] = fftResult[i] * sHanningWindowCoeff[i + 120-1];
415  }
416  }
417  fftResultReady = 0;
418  /* Calculates maxValue and returns corresponding BIN value */
419  arm_max_f32(&fftResult[skipFFTBins], FFT_SIZE / 2 - skipFFTBins, &sFFTmaxValue, &testIndex);
420  arm_min_f32(&fftResult[skipFFTBins], FFT_SIZE / 2 - skipFFTBins, &sFFTminValue, &testIndex);
421 
422  fftResultReady = 1;
423 
424  if(testIndex != refIndex)
425  return 1; //error
426 
427  return 0; //no error
428  }
429 }
430 
437 {
438  switch (barType)
439  {
440  case 0 : FFT_Display_BarGraph(ch); break;
441  case 1 : FFT_Display_Points(ch); break;
442  default : FFT_Display_Lines(ch);
443  }
444 }
445 
446 static void FFT_DisplayMagnitude(int ch, float32_t FFTmaxValue, float32_t FFTminValue)
447 {
448  //display magnitude in dB
451 
452  if (ch)
454  else
456  {
457  float32_t dB;
458  int dBInt;
459  char s[20];
460 
461  //display magnitude in dB
462  if (FFTmaxValue > 0.00005f)
463  {
464  dB = sFFTmaxValue / (float32_t)(256.0f);
465  dB = log(dB) * 10;
466  dBInt = (int)(dB * 100.0);
467  sprintf(s, "%4d.%2ddB", dBInt / 100, dBInt % 100);
468  if (ch)
469  BSP_LCD_DisplayStringAt(705, FFT_Y_BORDER_TOP + 50, (uint8_t *)s, LEFT_MODE);
470  else
471  BSP_LCD_DisplayStringAt(705, FFT_Y_BORDER_TOP + 30, (uint8_t *)s, LEFT_MODE);
472  }
473 
474  //display DNR in dB
475  if (FFTminValue > 0.00001f)
476  {
477  dB = sFFTmaxValue / sFFTminValue;
478  dB = log(dB) * 10;
479  dBInt = (int)(dB * 100.0);
480  sprintf(s, "%4d.%2ddB", dBInt / 100, dBInt % 100);
481  if (ch)
482  BSP_LCD_DisplayStringAt(705, FFT_Y_BORDER_TOP + 90, (uint8_t *)s, LEFT_MODE);
483  else
484  BSP_LCD_DisplayStringAt(705, FFT_Y_BORDER_TOP + 70, (uint8_t *)s, LEFT_MODE);
485  }
486  }
487 }
488 
492 const uint8_t lookupInd[] = {25, 27, 30, 34, 39, 45, 52, 60, 69, 79, 90, 102, 115, 127};
493 
500 {
501  float32_t *fft= fftResult;
502  int valInd, x;
503  int fftVal;
504  float fFftVal;
505  TS_StateTypeDef tsState;
506 
507  x = 16;
508  valInd = 0;
509 
510  fft += skipFFTBins;
511  valInd = skipFFTBins;
512 
513  while (x < 800)
514  {
515  if (valInd >= (FFT_SIZE / 2 - 1))
516  break;
517 
518  if (valInd < (lookupInd[0] - 1))
519  {
520  //the first bins without decimation
521  fFftVal = *fft++;
522  valInd++;
523 
524  //auto-scale to maximal value
525  fFftVal *= (480.0f - FFT_Y_BORDER_TOP - FFT_Y_BORDER);
526  fFftVal /= sFFTmaxValue;
527  fftVal = (int)fFftVal;
528 
529  //clear the upper part
532  //draw the active, lower part
533  if (ch)
535  else
537  BSP_LCD_FillRect(x, 480 - FFT_Y_BORDER - fftVal, FFT_X_W_RECT, fftVal);
538 
539  x += FFT_X_WIDTH;
540  }
541  else
542  {
543  //now we iterate with decimation
544  uint8_t nextInd;
545  int i;
546  float maxFftVal;
547 
548  i = 0;
549  while (i < sizeof(lookupInd))
550  {
551  fFftVal = 0.0f; //just to avoid warning
552  maxFftVal = 0.0f;
553  nextInd = lookupInd[i];
554  while (valInd < nextInd)
555  {
556  //decimation
557  fFftVal = *fft++;
558  if (maxFftVal < fFftVal)
559  maxFftVal = fFftVal;
560  valInd++;
561  }
562 
563  //auto-scale to maximal value
564  maxFftVal *= (480.0f - FFT_Y_BORDER_TOP - FFT_Y_BORDER);
565  maxFftVal /= sFFTmaxValue;
566  fftVal = (int)maxFftVal;
567 
568  //clear the upper part
571  //draw the active, lower part
572  if (ch)
574  else
576  BSP_LCD_FillRect(x, 480 - FFT_Y_BORDER - fftVal, FFT_X_W_RECT, fftVal);
577 
578  x += FFT_X_WIDTH;
579  i++;
580  }
581  }
582  }
583 
584  //check if we have a touch - change the window function for Rectangle (left touch) or Hanning (right touch)
585  BSP_TS_GetState(&tsState);
586  if (tsState.touchDetected)
587  {
588  if (tsState.touchY[0] > FFT_Y_BORDER_TOP)
589  {
590  if (tsState.touchX[0] < 100)
591  {
592  sHanningWindow = 0;
593  }
594  if (tsState.touchX[0] > (800 - 100))
595  {
596  sHanningWindow = 1;
597  }
598  }
599  }
600 
601  //display magnitude in dB
602  if (ch)
603  FFT_DisplayMagnitude(ch, sFFTmaxValue, sFFTminValue);
604 }
605 
612 {
613  float32_t *fft= fftResult;
614  int valInd, x;
615  int fftVal;
616  float fFftVal;
617  TS_StateTypeDef tsState;
618 
619  x = 16;
620  valInd = 0;
621 
622  fft += skipFFTBins;
623  valInd = skipFFTBins;
624 
625  while (x < 800)
626  {
627  if (valInd >= (FFT_SIZE / 2 - 1))
628  break;
629 
630  fFftVal = *fft++;
631 
632  //auto-scale to maximal value
633  fFftVal *= (480.0f - FFT_Y_BORDER_TOP - FFT_Y_BORDER);
634  fFftVal /= sFFTmaxValue;
635  fftVal = (int)fFftVal;
636 
637  //clear the old pixels
639  BSP_LCD_FillRect(x, 480 - FFT_Y_BORDER - prevFftY[ch][valInd], X_STEPS-1, X_STEPS-1);
640 
641  //draw a rectangle for the FFT value
642  if (ch)
644  else
646  BSP_LCD_FillRect(x, 480 - FFT_Y_BORDER - fftVal, X_STEPS-1, X_STEPS-1);
647 
648  //store the Y coordinate to clear later
649  prevFftY[ch][valInd] = fftVal;
650 
651  x += X_STEPS;
652  valInd++;
653  }
654 
655  //clear the last
656  //BSP_LCD_SetTextColor(LCD_COLOR_BLACK);
657  //BSP_LCD_FillRect(x, 480 - FFT_Y_BORDER - prevFftY[ch][valInd], X_STEPS-1, X_STEPS-1);
658 
659  //check if we have a touch - change the window function for Rectangle (left touch) or Hanning (right touch)
660  BSP_TS_GetState(&tsState);
661  if (tsState.touchDetected)
662  {
663  if (tsState.touchY[0] > FFT_Y_BORDER_TOP)
664  {
665  if (tsState.touchX[0] < 100)
666  {
667  sHanningWindow = 0;
668  }
669  if (tsState.touchX[0] > (800 - 100))
670  {
671  sHanningWindow = 1;
672  }
673  }
674  }
675 
676  //display magnitude in dB
677  FFT_DisplayMagnitude(ch, sFFTmaxValue, sFFTminValue);
678 }
679 
686 {
687  float32_t *fft = fftResult;
688  int valInd, x;
689  int fftVal, fftValNext;
690  float fFftVal, fFftValNext;
691  TS_StateTypeDef tsState;
692 
693  //if we push the center - we stop updating FFT
694  BSP_TS_GetState(&tsState);
695  if (tsState.touchDetected)
696  {
697  if (tsState.touchY[0] > FFT_Y_BORDER_TOP)
698  {
699  if ((tsState.touchX[0] > 100) && (tsState.touchX[0] < (800 - 100)))
700  {
701 #if 1
703 #endif
704  return;
705  }
706  }
707  }
708 
709  x = 16;
710  valInd = 0;
711 
712  fft += skipFFTBins;
713  valInd = skipFFTBins;
714 
715  while (x < (800 - X_STEPS))
716  {
717  fFftVal = *fft++;
718  fFftValNext = *fft;
719 
720  //auto-scale to maximal value
721  fFftVal *= (480.0f - FFT_Y_BORDER_TOP - FFT_Y_BORDER);
722  fFftVal /= sFFTmaxValue;
723  fftVal = (int)fFftVal;
724 
725  fFftValNext *= (480.0f - FFT_Y_BORDER_TOP - FFT_Y_BORDER);
726  fFftValNext /= sFFTmaxValue;
727  fftValNext = (int)fFftValNext;
728 
729  //clear the old line
731  BSP_LCD_DrawLine(x, 480 - FFT_Y_BORDER - prevFftY[ch][valInd], x + X_STEPS, 480 - FFT_Y_BORDER - prevFftY[ch][valInd + 1]);
732 
733  //draw a line for the FFT value
734  if (ch)
736  else
738  BSP_LCD_DrawLine(x, 480 - FFT_Y_BORDER - fftVal, x + X_STEPS, 480 - FFT_Y_BORDER - fftValNext);
739 
740  //store the Y coordinate to clear later
741  prevFftY[ch][valInd] = fftVal;
742 
743  valInd++;
744 
745  if (valInd >= (FFT_SIZE / 2))
746  break;
747 
748  x += X_STEPS;
749  }
750 
751  prevFftY[ch][valInd] = fftValNext;
752 
753  //check if we have a touch - change the window function for Rectangle (left touch) or Hanning (right touch)
754  BSP_TS_GetState(&tsState);
755  if (tsState.touchDetected)
756  {
757  if (tsState.touchY[0] > FFT_Y_BORDER_TOP)
758  {
759  if (tsState.touchX[0] < 100)
760  {
761  sHanningWindow = 0;
762  }
763  if (tsState.touchX[0] > (800 - 100))
764  {
765  sHanningWindow = 1;
766  }
767  }
768  }
769 
770  //display magnitude in dB
771  FFT_DisplayMagnitude(ch, sFFTmaxValue, sFFTminValue);
772 }
773 
void FFT_Display_Lines(int ch)
Draw FFT as (connected) lines (default)
Definition: FFT.c:685
void arm_cfft_f32(const arm_cfft_instance_f32 *S, float32_t *p1, uint8_t ifftFlag, uint8_t bitReverseFlag)
Processing function for the floating-point complex FFT.
Definition: arm_cfft_f32.c:574
void BSP_LCD_SetFont(sFONT *fonts)
Sets the LCD text font.
float float32_t
32-bit floating-point type definition.
Definition: arm_math.h:407
return ch
Definition: lcd_log.c:311
TS_StateTypeDef Define TS State structure.
void BSP_LCD_FillRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height)
Draws a full rectangle in currently active layer.
const arm_cfft_instance_f32 arm_cfft_sR_f32_len256
uint32_t doBitReverse
Definition: FFT.c:113
#define FFT_BIN_SKIP
Definition: FFT.h:24
void BSP_LCD_SetBackColor(uint32_t Color)
Sets the LCD background color.
int32_t FFT_Init(void)
Definition: FFT.c:288
void BSP_LCD_DisplayStringAt(uint16_t Xpos, uint16_t Ypos, uint8_t *Text, Text_AlignModeTypdef Mode)
Displays characters in currently active layer.
int32_t FFT_Filter(int ch)
Definition: FFT.c:336
#define FFT_DISP_TYPE
Definition: FFT.h:25
#define FFT_Y_BORDER
Definition: FFT.h:16
#define X_STEPS
Definition: FFT.h:22
void arm_min_f32(float32_t *pSrc, uint32_t blockSize, float32_t *pResult, uint32_t *pIndex)
Minimum value of a floating-point vector.
Definition: arm_min_f32.c:71
This file contains the common defines and functions prototypes for the stm32469i_discovery_lcd.c driver.
void arm_q31_to_float(q31_t *pSrc, float32_t *pDst, uint32_t blockSize)
Converts the elements of the Q31 vector to floating-point vector.
#define FFT_X_WIDTH
Definition: FFT.h:18
void BSP_LCD_DrawLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2)
Draws an uni-line (between two points) in currently active layer.
#define FFT_SAMPLES
Definition: FFT.h:14
#define LCD_COLOR_BLACK
Black value in ARGB8888 format.
const arm_cfft_instance_f32 arm_cfft_sR_f32_len512
const arm_cfft_instance_f32 arm_cfft_sR_f32_len1024
#define COLOR_RIGHT
Definition: FFT.h:29
void BSP_LCD_SetTextColor(uint32_t Color)
Sets the LCD text color.
#define FFT_X_W_RECT
Definition: FFT.h:19
#define COLOR_LEFT
Definition: FFT.h:28
uint8_t BSP_TS_GetState(TS_StateTypeDef *TS_State)
Returns status and positions of the touch screen.
#define ROUND(x)
uint16_t touchY[TS_MAX_NB_TOUCH]
#define ALPHA
int AUDIO_PLAYER_GetState(void)
Definition: AudioPlayer.c:109
void AUDIO_Player_UDANTERestart(void)
Restart and sync audio for Network Audio.
Definition: AudioPlayer.c:342
int32_t q31_t
32-bit fractional data type in 1.31 format.
Definition: arm_math.h:397
#define COLOR_INACTIVE
Definition: FFT.h:27
const uint8_t lookupInd[]
Definition: FFT.c:492
void arm_cmplx_mag_f32(float32_t *pSrc, float32_t *pDst, uint32_t numSamples)
Floating-point complex magnitude.
void FFT_DisplayGraph(int ch)
Display the FFT, depending on the barType - which type we want to display.
Definition: FFT.c:436
int AUDIO_PLAYER_GetBuffer(uint8_t **out_BufAddr)
Definition: AudioPlayer.c:117
void FFT_Display_BarGraph(int ch)
Draw FFT as bar graph.
Definition: FFT.c:499
uint32_t refIndex
Definition: FFT.c:116
void arm_max_f32(float32_t *pSrc, uint32_t blockSize, float32_t *pResult, uint32_t *pIndex)
Maximum value of a floating-point vector.
Definition: arm_max_f32.c:70
#define FFT_SIZE
Definition: FFT.h:13
void FFT_Display_Points(int ch)
Draw FFT as points.
Definition: FFT.c:611
int32_t FFT_Ready(float32_t **result, int *numResults)
Definition: FFT.c:296
uint32_t ifftFlag
Definition: FFT.c:112
sFONT Font16
Definition: font16.c:1802
#define FFT_Y_BORDER_TOP
Definition: FFT.h:17
uint16_t touchX[TS_MAX_NB_TOUCH]