STM32F769IDiscovery  1.00
uDANTE Audio Networking with STM32F7 DISCO board
main.c
Go to the documentation of this file.
1 
39 /* Includes ------------------------------------------------------------------*/
40 #include "cmsis_os.h"
41 #include "FreeRTOSConfig.h"
42 
43 #include "main.h"
44 #include "FFT.h"
45 #include "GUI_pages.h"
46 
47 #include <string.h>
48 #include <stdio.h>
49 
50 #include "ip_addr.h"
51 
52 /* select if USB or SPDIF Rx is input */
53 #define USB_AUDIO_INPUT
54 
63 /* Private typedef -----------------------------------------------------------*/
64 #if 0
65 static DMA2D_HandleTypeDef hdma2d;
66 #endif
67 DSI_VidCfgTypeDef hdsivideo_handle;
68 DSI_CmdCfgTypeDef CmdCfg;
69 DSI_LPCmdTypeDef LPCmd;
70 DSI_PLLInitTypeDef dsiPllInit;
73 
76 
77 /* Private define ------------------------------------------------------------*/
78 
79 #define VSYNC 1
80 #define VBP 1
81 #define VFP 1
82 #define VACT 480
83 #define HSYNC 1
84 #define HBP 1
85 #define HFP 1
86 #define HACT 800
87 
88 #define LAYER0_ADDRESS (LCD_FB_START_ADDRESS)
89 
90 /* Private macro -------------------------------------------------------------*/
91 #define DEFAULT_THREAD_STACKSIZE 500
92 #define AUDIO_THREAD_PRIO (tskIDLE_PRIORITY+2) //osPriorityNormal
93 #define UARTCMD_THREAD_PRIO (tskIDLE_PRIORITY+1) //osPriorityNormal
94 
95 /* Private variables ---------------------------------------------------------*/
96 static __IO int32_t front_buffer = 0;
97 static __IO int32_t pend_buffer = -1;
98 
99 static const uint32_t Buffers[] =
100 {
102  LAYER0_ADDRESS + (800*480*4),
103 };
104 
105 /* Private function prototypes -----------------------------------------------*/
106 void SystemClock_Config(void);
107 void MPU_Config(void);
108 void CPU_CACHE_Enable(void);
109 
110 static void OnError_Handler(uint32_t condition);
111 #if 0
112 static void CopyBuffer(uint32_t *pSrc,
113  uint32_t *pDst,
114  uint16_t x,
115  uint16_t y,
116  uint16_t xsize,
117  uint16_t ysize);
118 #endif
119 static uint8_t LCD_Init(void);
120 void LTDC_Init(void);
121 static int GetInterfaceSelection(int *outSelection, int *sampleRate);
122 static void LCD_Config(void);
123 
124 static void MX_GPIO_Init(void);
125 static void MX_DMA_Init(void);
126 static void MX_SPDIFRX_Init(void);
127 
128 static void Audio_Thread(void const * argument);
129 
130 extern void http_taskCreate(void);
131 
134 
135 #ifdef UART_THREAD
136 static void UARTCmd_Thread(void const * argument);
137 SemaphoreHandle_t xSemaphoreUART;
138 xTaskHandle CreatedTaskUART;
139 #endif
140 
141 #define SCRATCH_BUFF_SIZE (AUDIO_OUT_BUFFER_SIZE/sizeof(int32_t))
143 
144 /* Private functions ---------------------------------------------------------*/
145 
151 static void OnError_Handler(uint32_t condition)
152 {
153  if(condition)
154  {
155  BSP_LED_On(LED1);
156  while(1) { ; } /* Blocking on error */
157  }
158 }
159 
160 static void TIM_Start(void)
161 {
162  /* for stop watch */
165  hTim2.Instance = TIM2;
166  hTim2.Instance->ARR = 0xFFFFFFFF;
168 }
169 
175 int main_audio(void)
176 {
177  /* Enable the MPU */
178  MPU_Config();
179 
180  /* Enable the CPU Cache */
182 
183  /* Configure the system clock to 216 or 200 MHz if with DDR RAM */
186 
187  /* STM32F7xx HAL library initialization:
188  - Configure the Flash prefetch
189  - Systick timer is configured by default as source of time base, but user
190  can eventually implement his proper time base source (a general purpose
191  timer for example or other time source), keeping in mind that Time base
192  duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and
193  handled in milliseconds basis.
194  - Set NVIC Group Priority to 4
195  - Low Level Initialization
196  */
197  HAL_Init();
198 
199  /* Initialize used Leds */
201 
202  /* Initialize the SDRAM - needed for DSI LCD */
203  BSP_SDRAM_Init();
204 
205  //initialize QSPI
206  BSP_QSPI_Init();
207 
208  //Enable QSPI memory mapped mode
210 
211  /* Initialize the LCD */
212  LCD_Config();
213 
214  BSP_TS_Init(800, 480);
215 
216  /* create semaphores for the threads - we have to do before we start scheduler! */ //Give must be called, otherwise semaphore is empty
218 #ifdef UART_THREAD
219  vSemaphoreCreateBinary(xSemaphoreUART);
220 #endif
221 
222 #if 0
223  /* Init threads - we have to create all tasks before scheduler launched! */
225 #ifdef UART_THREAD
226  UART_cmd_init();
227  xTaskCreate((TaskFunction_t)UARTCmd_Thread, (const portCHAR *)"UARTCmd", DEFAULT_THREAD_STACKSIZE, NULL, UARTCMD_THREAD_PRIO, &CreatedTaskUART);
228 #endif
229 
230  /* Start scheduler */
232 #else
233 #if defined(__GNUC__)
234  osThreadDef(Audio, Audio_Thread, AUDIO_THREAD_PRIO, 0, configMINIMAL_STACK_SIZE * 6);
235 #else
236  osThreadDef(Start, Audio_Thread, AUDIO_THREAD_PRIO, 0, configMINIMAL_STACK_SIZE * 6);
237 #endif
238 
239  osThreadCreate(osThread(Audio), NULL);
240 
241  http_taskCreate();
242 
243  /* Start scheduler */
244  osKernelStart();
245 #endif
246 
247  /* We should never get here as control is now taken by the scheduler */
248  for( ;; );
249 }
250 
256 static void Audio_Thread(void const * argument)
257 {
258  int ifSelection, outSelection;
259  int sampleFreq = 48000; //will be changed by config
260 
261  /* after Touch init - get the selection but before DSI_Refresh because it displays text */
262  ifSelection = GetInterfaceSelection(&outSelection, &sampleFreq);
263 
264  /*Refresh the LCD display*/
265  HAL_DSI_Refresh(&hdsi_discovery);
266 
267  /* Init Audio interface - important to do in this order */
268  AUDIO_PLAYER_Init(outSelection, sampleFreq);
269 
270  /* SPDIF Tx Out - always active */
271  SPDIF_Tx_Init();
272 
273  /* Network Audio selection: 48KHz, 16bit */
274  if (ifSelection == 4)
275  {
276  //similar to USB but nothing else to do here
277  }
278 
279  /* select here between USB, SPDIF_Rx, MIC, ... as input */
280  if (ifSelection == 3)
281  {
282  /* Line In Init */
283  int bufSize;
284  uint8_t *buffer;
285 
287  bufSize = AUDIO_PLAYER_GetBuffer(&buffer);
288  BSP_AUDIO_IN_Record((uint16_t*)buffer, bufSize /(sizeof(uint16_t)));
289  }
290 
291  if (ifSelection == 2)
292  {
293  //use onboard MICs
294  int bufSize;
295  uint8_t *buffer;
296 
298  BSP_AUDIO_IN_AllocScratch(Scratch, SCRATCH_BUFF_SIZE); //it is needed but what is the size of the buffer?
299  bufSize = AUDIO_PLAYER_GetBuffer(&buffer);
300  BSP_AUDIO_IN_Record((uint16_t*)buffer, bufSize / (sizeof(uint16_t)));
301  }
302 
303  if (ifSelection == 1)
304  {
305  /* USB Audio Init */
306  USB_Interface(0);
307  }
308 
309  if (ifSelection == 0)
310  {
311  /* Init SPDIF Rx */
312  MX_GPIO_Init();
313  MX_DMA_Init();
314  MX_SPDIFRX_Init();
315 
316  /* start SPDIF Rx */
317  SPDIF_RX_Start();
318  }
319 
320  //now start the audio output functions
322 
323  /* SPDIF Tx Out - always active */
324  SPDIF_Tx_Start();
325 
326  /* init FFT */
327  FFT_Init();
328 
329  /* TIM for CPU load measurement */
330  TIM_Start();
331 
332  /* Infinite loop */
333  while (1)
334  {
336 
337  if (AUDIO_PLAYER_GetClock())
338  {
339  TIM_MEASURE_START; // start stop watch
340 
341  //check if we have audio in received - if not - clear the buffers
343 
344  {
345  extern ip_addr_t UDANTE_IPAddr;
346  extern u16_t UDANTE_UDPPort;
347  extern void Netif_AddUDANTE(ip_addr_t ipAddr);
348  extern void main_UDanteUDP(void);
349 
350  static int done = 0;
351  if ((UDANTE_IPAddr.addr != 0) && ( ! done))
352  {
353  Netif_AddUDANTE(UDANTE_IPAddr);
354  main_UDanteUDP();
355  done = 1;
356 
357  {
358  //print where found DANTE audio stream
359  uint8_t iptxt[20];
360  sprintf((char*)iptxt, "uDANTE: %ld.%ld.%ld.%ld | %d", UDANTE_IPAddr.addr & 0xFF, UDANTE_IPAddr.addr >> 8 & 0xFF, UDANTE_IPAddr.addr >> 16 & 0xFF, UDANTE_IPAddr.addr >> 24 & 0xFF,
361  UDANTE_UDPPort);
362 
364  BSP_LCD_DisplayStringAt(380, 100, (uint8_t *)iptxt, LEFT_MODE);
365  }
366  }
367  }
368 
369  //if we touch Peak Meter - stop all
370  {
371  TS_StateTypeDef tsState;
372 
373  BSP_TS_GetState(&tsState);
374  if (tsState.touchDetected)
375  {
376  if (tsState.touchY[0] < FFT_Y_BORDER_TOP)
377  goto END;
378  }
379  }
380 
381  VUMETER_Analyse();
382  VUMETER_Input(0);
383  VUMETER_Input(1);
384  VUMETER_Display(0);
385  VUMETER_Display(1);
386 
387  FFT_Filter(0);
388  FFT_DisplayGraph(0);
389 
390  FFT_Filter(1);
391  FFT_DisplayGraph(1);
392 
393 END:
394  //display CPU load in percentage
395  {
396  static float sMaxLoad = 0.0f;
397  int sMaxLoadInt;
398  float load;
399  char text [10];
400 
401  load = (float)((100.0 * (float)time_diff) / (float)time_total);
402  if (sMaxLoad < load)
403  sMaxLoad = load;
404  sMaxLoadInt = (int)(sMaxLoad * 10.0);
405  sprintf(text, "%3d.%1d%%", sMaxLoadInt / 10, sMaxLoadInt % 10); //keep text shortest as possible
406  //BSP_LCD_SetFont(&Font16); //use smaller font here
407  if (sMaxLoad > 30.0f)
409  else
411  BSP_LCD_DisplayStringAt(715, FFT_Y_BORDER_TOP + 130, (uint8_t *)text, LEFT_MODE);
412  if (sMaxLoad > 0.05f)
413  sMaxLoad -= 0.05f;
414  }
415 
416  /*Refresh the LCD display*/
417  HAL_DSI_Refresh(&hdsi_discovery);
418 
419  TIM_MEASURE_END; // stop stop watch for audio processing
420  TIM_MEASURE_TOTAL; //total time for audio sample loops
421  }
422  }
423 }
429 void LCD_Config(void)
430 {
431  uint8_t lcd_status = LCD_OK;
432 
433  /* LCD Initialization Layer 0 */
434  lcd_status = LCD_Init();
435  OnError_Handler(lcd_status != LCD_OK);
436 
439 
440  /* Enable the LCD */
442 }
443 
450 int GetInterfaceSelection(int *outSelection, int *sampleRate)
451 {
452  TS_StateTypeDef tsState;
453  int ret = -1;
454 
455  *outSelection = 1; //default, in case we do not select
456  *sampleRate = I2S_AUDIOFREQ_48K;
457 
458  /* set the background layer */
459  //BSP_LCD_SelectLayer(0);
460  //BSP_LCD_SelectLayer(1);
461  BSP_LCD_DrawBitmap(0, 0, (uint8_t *)PAGE_SPLASH);
462 
463  /*Refresh the LCD display*/
464  HAL_DSI_Refresh(&hdsi_discovery);
465 
466  HAL_Delay(100); /* let us see the splash screen */
467 
468  //with BMP as background
469  while (1)
470  {
471  BSP_TS_GetState(&tsState);
472  if (tsState.touchDetected)
473  {
474  if ((tsState.touchY[0] > 44) && (tsState.touchY[0] < 144))
475  {
476  if ((tsState.touchX[0] > 260) && (tsState.touchX[0] < 360))
477  {
478  *sampleRate = I2S_AUDIOFREQ_48K;
479  }
480  if ((tsState.touchX[0] > 660) && (tsState.touchX[0] < 760))
481  {
482  *sampleRate = I2S_AUDIOFREQ_44K;
483  }
484  }
485 
486  if ((tsState.touchY[0] > 200) && (tsState.touchY[0] < 300))
487  {
488  if ((tsState.touchX[0] > 260) && (tsState.touchX[0] < 360))
489  {
490  *outSelection = 0;
491  }
492  if ((tsState.touchX[0] > 660) && (tsState.touchX[0] < 760))
493  {
494  *outSelection = 1;
495  }
496  if ((tsState.touchX[0] > 390) && (tsState.touchX[0] < 620))
497  {
498  //Network Audio selection
499  *sampleRate = I2S_AUDIOFREQ_48K;
500  ret = 4;
501  break;
502  }
503  }
504 
505  if ((tsState.touchY[0] > 356) && (tsState.touchY[0] < 456))
506  {
507  if ((tsState.touchX[0] > 60) && (tsState.touchX[0] < 160))
508  {
509  ret = 0;
510  break;
511  }
512  if ((tsState.touchX[0] > 260) && (tsState.touchX[0] < 360))
513  {
514  ret = 2;
515  break;
516  }
517  if ((tsState.touchX[0] > 460) && (tsState.touchX[0] < 560))
518  {
519  ret = 1;
520  break;
521  }
522  if ((tsState.touchX[0] > 660) && (tsState.touchX[0] < 760))
523  {
524  ret = 3;
525  break;
526  }
527  }
528  }
529  }
530 
531  //BSP_LCD_SelectLayer(1);
532 
534  //BSP_LCD_SetBackColor(LCD_COLOR_TRANSPARENT);
536 
537  //clear all
538  BSP_LCD_FillRect(0, 0, 800, 480);
539 
540  //display left and right
542  BSP_LCD_DisplayStringAt( 2, 0, (uint8_t *)"LEFT", LEFT_MODE);
544  BSP_LCD_DisplayStringAt( 2, 60, (uint8_t *)"RIGHT", LEFT_MODE);
545 
547 
548  //create labels for the Peak Meter
549  BSP_LCD_DisplayStringAt( 45, 0, (uint8_t *)"-30", LEFT_MODE);
550  BSP_LCD_DisplayStringAt( 168, 0, (uint8_t *)"-20", LEFT_MODE);
551  BSP_LCD_DisplayStringAt( 478, 0, (uint8_t *)"-10", LEFT_MODE);
552  BSP_LCD_DisplayStringAt( 697, 0, (uint8_t *)"-7", LEFT_MODE);
553  BSP_LCD_DisplayStringAt( 760, 0, (uint8_t *)"-6dB", LEFT_MODE);
554 
555  //create X, Y axis labels for FFT
556  BSP_LCD_DisplayStringAt( 46, FFT_Y_BORDER_TOP - 10, (uint8_t *)"1K", LEFT_MODE);
557  BSP_LCD_DisplayStringAt( 88, FFT_Y_BORDER_TOP - 10, (uint8_t *)"|", LEFT_MODE);
558  BSP_LCD_DisplayStringAt(124, FFT_Y_BORDER_TOP - 10, (uint8_t *)"|", LEFT_MODE);
559  BSP_LCD_DisplayStringAt(160, FFT_Y_BORDER_TOP - 10, (uint8_t *)"|", LEFT_MODE);
560  BSP_LCD_DisplayStringAt(197, FFT_Y_BORDER_TOP - 10, (uint8_t *)"5K", LEFT_MODE);
561  BSP_LCD_DisplayStringAt(236, FFT_Y_BORDER_TOP - 10, (uint8_t *)"|", LEFT_MODE);
562  BSP_LCD_DisplayStringAt(272, FFT_Y_BORDER_TOP - 10, (uint8_t *)"|", LEFT_MODE);
563  BSP_LCD_DisplayStringAt(313, FFT_Y_BORDER_TOP - 10, (uint8_t *)"|", LEFT_MODE);
564  BSP_LCD_DisplayStringAt(349, FFT_Y_BORDER_TOP - 10, (uint8_t *)"|", LEFT_MODE);
565  BSP_LCD_DisplayStringAt(380, FFT_Y_BORDER_TOP - 10, (uint8_t *)"10K", LEFT_MODE);
566  BSP_LCD_DisplayStringAt(424, FFT_Y_BORDER_TOP - 10, (uint8_t *)"|", LEFT_MODE);
567  BSP_LCD_DisplayStringAt(460, FFT_Y_BORDER_TOP - 10, (uint8_t *)"|", LEFT_MODE);
568  BSP_LCD_DisplayStringAt(495, FFT_Y_BORDER_TOP - 10, (uint8_t *)"|", LEFT_MODE);
569  BSP_LCD_DisplayStringAt(535, FFT_Y_BORDER_TOP - 10, (uint8_t *)"|", LEFT_MODE);
570  BSP_LCD_DisplayStringAt(569, FFT_Y_BORDER_TOP - 10, (uint8_t *)"15K", LEFT_MODE);
571  BSP_LCD_DisplayStringAt(608, FFT_Y_BORDER_TOP - 10, (uint8_t *)"|", LEFT_MODE);
572  BSP_LCD_DisplayStringAt(644, FFT_Y_BORDER_TOP - 10, (uint8_t *)"|", LEFT_MODE);
573  BSP_LCD_DisplayStringAt(684, FFT_Y_BORDER_TOP - 10, (uint8_t *)"|", LEFT_MODE);
574  BSP_LCD_DisplayStringAt(721, FFT_Y_BORDER_TOP - 10, (uint8_t *)"|", LEFT_MODE);
575  BSP_LCD_DisplayStringAt(758, FFT_Y_BORDER_TOP - 10, (uint8_t *)"20KHz", LEFT_MODE);
576 
577 #if 0
578  /* Copy Buffer 0 into buffer 1, so only image area to be redrawn later */
579  CopyBuffer((uint32_t *)Buffers[0], (uint32_t *)Buffers[1], 0, 0, 800, 480);
580 #endif
581 
582  return ret;
583 }
584 
591 void HAL_DSI_EndOfRefreshCallback(DSI_HandleTypeDef *hdsi)
592 {
593  if(pend_buffer >= 0)
594  {
595  /* Disable DSI Wrapper */
596  __HAL_DSI_WRAPPER_DISABLE(&hdsi_discovery);
597  /* Update LTDC configuration */
598  LTDC_LAYER(&hltdc_discovery, 0)->CFBAR = ((uint32_t)Buffers[pend_buffer]);
599  __HAL_LTDC_RELOAD_CONFIG(&hltdc_discovery);
600  /* Enable DSI Wrapper */
601  __HAL_DSI_WRAPPER_ENABLE(&hdsi_discovery);
602 
603  front_buffer = pend_buffer;
604  pend_buffer = -1;
605  }
606 }
607 
618 static uint8_t LCD_Init(void)
619 {
620  /* Toggle Hardware Reset of the DSI LCD using
621  * its XRES signal (active low) */
622  BSP_LCD_Reset();
623 
624  /* Call first MSP Initialize only in case of first initialization
625  * This will set IP blocks LTDC, DSI and DMA2D
626  * - out of reset
627  * - clocked
628  * - NVIC IRQ related to IP blocks enabled
629  */
630  BSP_LCD_MspInit();
631 
632  /* LCD clock configuration */
633  /* PLLSAI_VCO Input = HSE_VALUE/PLL_M = 1 Mhz */
634  /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN = 417 Mhz */
635  /* PLLLCDCLK = PLLSAI_VCO Output/PLLSAIR = 417 MHz / 5 = 83.4 MHz */
636  /* LTDC clock frequency = PLLLCDCLK / LTDC_PLLSAI_DIVR_2 = 83.4 / 2 = 41.7 MHz */
637  PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
638  PeriphClkInitStruct.PLLSAI.PLLSAIN = 417;
639  PeriphClkInitStruct.PLLSAI.PLLSAIR = 5;
640  PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2;
641  HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
642 
643  /* Base address of DSI Host/Wrapper registers to be set before calling De-Init */
644  hdsi_discovery.Instance = DSI;
645 
646  HAL_DSI_DeInit(&(hdsi_discovery));
647 
648  dsiPllInit.PLLNDIV = 100;
649  dsiPllInit.PLLIDF = DSI_PLL_IN_DIV5;
650  dsiPllInit.PLLODF = DSI_PLL_OUT_DIV1;
651 
652  hdsi_discovery.Init.NumberOfLanes = DSI_TWO_DATA_LANES;
653  hdsi_discovery.Init.TXEscapeCkdiv = 0x4;
654  HAL_DSI_Init(&(hdsi_discovery), &(dsiPllInit));
655 
656  /* Configure the DSI for Command mode */
657  CmdCfg.VirtualChannelID = 0;
658  CmdCfg.HSPolarity = DSI_HSYNC_ACTIVE_HIGH;
659  CmdCfg.VSPolarity = DSI_VSYNC_ACTIVE_HIGH;
660  CmdCfg.DEPolarity = DSI_DATA_ENABLE_ACTIVE_HIGH;
661  CmdCfg.ColorCoding = DSI_RGB888;
662  CmdCfg.CommandSize = HACT;
663  CmdCfg.TearingEffectSource = DSI_TE_DSILINK;
664  CmdCfg.TearingEffectPolarity = DSI_TE_RISING_EDGE;
665  CmdCfg.VSyncPol = DSI_VSYNC_FALLING;
666  CmdCfg.AutomaticRefresh = DSI_AR_DISABLE;
667  CmdCfg.TEAcknowledgeRequest = DSI_TE_ACKNOWLEDGE_ENABLE;
668  HAL_DSI_ConfigAdaptedCommandMode(&hdsi_discovery, &CmdCfg);
669 
670  LPCmd.LPGenShortWriteNoP = DSI_LP_GSW0P_ENABLE;
671  LPCmd.LPGenShortWriteOneP = DSI_LP_GSW1P_ENABLE;
672  LPCmd.LPGenShortWriteTwoP = DSI_LP_GSW2P_ENABLE;
673  LPCmd.LPGenShortReadNoP = DSI_LP_GSR0P_ENABLE;
674  LPCmd.LPGenShortReadOneP = DSI_LP_GSR1P_ENABLE;
675  LPCmd.LPGenShortReadTwoP = DSI_LP_GSR2P_ENABLE;
676  LPCmd.LPGenLongWrite = DSI_LP_GLW_ENABLE;
677  LPCmd.LPDcsShortWriteNoP = DSI_LP_DSW0P_ENABLE;
678  LPCmd.LPDcsShortWriteOneP = DSI_LP_DSW1P_ENABLE;
679  LPCmd.LPDcsShortReadNoP = DSI_LP_DSR0P_ENABLE;
680  LPCmd.LPDcsLongWrite = DSI_LP_DLW_ENABLE;
681  HAL_DSI_ConfigCommand(&hdsi_discovery, &LPCmd);
682 
683  /* Initialize LTDC */
684  LTDC_Init();
685 
686  /* Start DSI */
687  HAL_DSI_Start(&(hdsi_discovery));
688 
689  /* Initialize the OTM8009A LCD Display IC Driver (KoD LCD IC Driver)
690  * depending on configuration set in 'hdsivideo_handle'.
691  */
693 
694  LPCmd.LPGenShortWriteNoP = DSI_LP_GSW0P_DISABLE;
695  LPCmd.LPGenShortWriteOneP = DSI_LP_GSW1P_DISABLE;
696  LPCmd.LPGenShortWriteTwoP = DSI_LP_GSW2P_DISABLE;
697  LPCmd.LPGenShortReadNoP = DSI_LP_GSR0P_DISABLE;
698  LPCmd.LPGenShortReadOneP = DSI_LP_GSR1P_DISABLE;
699  LPCmd.LPGenShortReadTwoP = DSI_LP_GSR2P_DISABLE;
700  LPCmd.LPGenLongWrite = DSI_LP_GLW_DISABLE;
701  LPCmd.LPDcsShortWriteNoP = DSI_LP_DSW0P_DISABLE;
702  LPCmd.LPDcsShortWriteOneP = DSI_LP_DSW1P_DISABLE;
703  LPCmd.LPDcsShortReadNoP = DSI_LP_DSR0P_DISABLE;
704  LPCmd.LPDcsLongWrite = DSI_LP_DLW_DISABLE;
705  HAL_DSI_ConfigCommand(&hdsi_discovery, &LPCmd);
706 
707  HAL_DSI_ConfigFlowControl(&hdsi_discovery, DSI_FLOW_CONTROL_BTA);
708  /* Refresh the display */
709  HAL_DSI_Refresh(&hdsi_discovery);
710 
711  return LCD_OK;
712 }
713 
719 void LTDC_Init(void)
720 {
721  /* DeInit */
722  HAL_LTDC_DeInit(&hltdc_discovery);
723 
724  /* LTDC Config */
725  /* Timing and polarity */
726  hltdc_discovery.Init.HorizontalSync = HSYNC;
727  hltdc_discovery.Init.VerticalSync = VSYNC;
728  hltdc_discovery.Init.AccumulatedHBP = HSYNC+HBP;
729  hltdc_discovery.Init.AccumulatedVBP = VSYNC+VBP;
730  hltdc_discovery.Init.AccumulatedActiveH = VSYNC+VBP+VACT;
731  hltdc_discovery.Init.AccumulatedActiveW = HSYNC+HBP+HACT;
732  hltdc_discovery.Init.TotalHeigh = VSYNC+VBP+VACT+VFP;
733  hltdc_discovery.Init.TotalWidth = HSYNC+HBP+HACT+HFP;
734 
735  /* background value */
736  hltdc_discovery.Init.Backcolor.Blue = 0;
737  hltdc_discovery.Init.Backcolor.Green = 0;
738  hltdc_discovery.Init.Backcolor.Red = 0;
739 
740  /* Polarity */
741  hltdc_discovery.Init.HSPolarity = LTDC_HSPOLARITY_AL;
742  hltdc_discovery.Init.VSPolarity = LTDC_VSPOLARITY_AL;
743  hltdc_discovery.Init.DEPolarity = LTDC_DEPOLARITY_AL;
744  hltdc_discovery.Init.PCPolarity = LTDC_PCPOLARITY_IPC;
745  hltdc_discovery.Instance = LTDC;
746 
747  HAL_LTDC_Init(&hltdc_discovery);
748 }
749 
750 #if 0
751 
759 static void CopyBuffer(uint32_t *pSrc, uint32_t *pDst, uint16_t x, uint16_t y, uint16_t xsize, uint16_t ysize)
760 {
761  uint32_t destination = (uint32_t)pDst + (y * 800 + x) * 4;
762  uint32_t source = (uint32_t)pSrc;
763 
764  /*##-1- Configure the DMA2D Mode, Color Mode and output offset #############*/
765  hdma2d.Init.Mode = DMA2D_M2M;
767  hdma2d.Init.OutputOffset = 800 - xsize;
768  hdma2d.Init.AlphaInverted = DMA2D_REGULAR_ALPHA; /* No Output Alpha Inversion*/
769  hdma2d.Init.RedBlueSwap = DMA2D_RB_REGULAR; /* No Output Red & Blue swap */
770 
771  /*##-2- DMA2D Callbacks Configuration ######################################*/
772  hdma2d.XferCpltCallback = NULL;
773 
774  /*##-3- Foreground Configuration ###########################################*/
776  hdma2d.LayerCfg[1].InputAlpha = 0xFF;
778  hdma2d.LayerCfg[1].InputOffset = 0;
779  hdma2d.LayerCfg[1].RedBlueSwap = DMA2D_RB_REGULAR; /* No ForeGround Red/Blue swap */
780  hdma2d.LayerCfg[1].AlphaInverted = DMA2D_REGULAR_ALPHA; /* No ForeGround Alpha inversion */
781 
782  hdma2d.Instance = DMA2D;
783 
784  /* DMA2D Initialization */
785  if(HAL_DMA2D_Init(&hdma2d) == HAL_OK)
786  {
787  if(HAL_DMA2D_ConfigLayer(&hdma2d, 1) == HAL_OK)
788  {
789  if (HAL_DMA2D_Start(&hdma2d, source, destination, xsize, ysize) == HAL_OK)
790  {
791  /* Polling For DMA transfer */
792  HAL_DMA2D_PollForTransfer(&hdma2d, 100);
793  }
794  }
795  }
796 }
797 #endif
798 
806 void MPU_Config(void)
807 {
808  MPU_Region_InitTypeDef MPU_InitStruct;
809 
810  /* Disable the MPU */
811  HAL_MPU_Disable();
812 
813  /* Configure the MPU attributes as WT for SRAM */
814  MPU_InitStruct.Enable = MPU_REGION_ENABLE;
815  MPU_InitStruct.BaseAddress = 0x20010000; //0x20020000
816  MPU_InitStruct.Size = MPU_REGION_SIZE_512KB;
817  MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
818  MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
819  MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE;
820  MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
821  MPU_InitStruct.Number = MPU_REGION_NUMBER0;
822  MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
823  MPU_InitStruct.SubRegionDisable = 0x00;
824  MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
825 
826  HAL_MPU_ConfigRegion(&MPU_InitStruct);
827 
828  /* Configure the MPU attributes as WT for SDRAM */
829  MPU_InitStruct.Enable = MPU_REGION_ENABLE;
830  MPU_InitStruct.BaseAddress = 0xC0000000;
831  MPU_InitStruct.Size = MPU_REGION_SIZE_256MB;
832  MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
833  MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
834  MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE;
835  MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
836  MPU_InitStruct.Number = MPU_REGION_NUMBER2;
837  MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
838  MPU_InitStruct.SubRegionDisable = 0x00;
839  MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
840 
841  HAL_MPU_ConfigRegion(&MPU_InitStruct);
842 
843  /* Configure the MPU attributes as WT for SDRAM */
844  MPU_InitStruct.Enable = MPU_REGION_ENABLE;
845  MPU_InitStruct.BaseAddress = 0xC0000000;
846  MPU_InitStruct.Size = MPU_REGION_SIZE_8MB;
847  MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
848  MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
849  MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE;
850  MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
851  MPU_InitStruct.Number = MPU_REGION_NUMBER3;
852  MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
853  MPU_InitStruct.SubRegionDisable = 0x00;
854  MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
855 
856  HAL_MPU_ConfigRegion(&MPU_InitStruct);
857 
858  /* Configure the MPU attributes as strongly ordred for QSPI (unused zone) */
859  MPU_InitStruct.Enable = MPU_REGION_ENABLE;
860  MPU_InitStruct.BaseAddress = 0x90000000;
861  MPU_InitStruct.Size = MPU_REGION_SIZE_256MB;
862  MPU_InitStruct.AccessPermission = MPU_REGION_PRIV_RO;
863  MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
864  MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE;
865  MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
866  MPU_InitStruct.Number = MPU_REGION_NUMBER4;
867  MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
868  MPU_InitStruct.SubRegionDisable = 0x00;
869  MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
870 
871  HAL_MPU_ConfigRegion(&MPU_InitStruct);
872 
873  /* Configure the MPU attributes as WT for QSPI (used 16Mbytes) */
874  MPU_InitStruct.Enable = MPU_REGION_ENABLE;
875  MPU_InitStruct.BaseAddress = 0x90000000;
876  MPU_InitStruct.Size = MPU_REGION_SIZE_16MB;
877  MPU_InitStruct.AccessPermission = MPU_REGION_PRIV_RO;
878  MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
879  MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE;
880  MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
881  MPU_InitStruct.Number = MPU_REGION_NUMBER5;
882  MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
883  MPU_InitStruct.SubRegionDisable = 0x00;
884  MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
885 
886  HAL_MPU_ConfigRegion(&MPU_InitStruct);
887 
888  /* Enable the MPU */
889  HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);
890 }
891 
914 {
915  RCC_ClkInitTypeDef RCC_ClkInitStruct;
916  RCC_OscInitTypeDef RCC_OscInitStruct;
918 
919  /* Enable HSE Oscillator and activate PLL with HSE as source */
920  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
921  RCC_OscInitStruct.HSEState = RCC_HSE_ON;
922  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
923  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
924  RCC_OscInitStruct.PLL.PLLM = 25;
925  RCC_OscInitStruct.PLL.PLLN = 400; //was 400, for 200 MHz - needed if DDR RAM!, otherwise 432 for 216 MHz
926  RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
927  RCC_OscInitStruct.PLL.PLLQ = 8; //9 for 216MHz, 8 for 200 MHz with PLLN 400;
928  //RCC_OscInitStruct.PLL.PLLR = 7; //should be default 2
929 
930  ret = HAL_RCC_OscConfig(&RCC_OscInitStruct);
931  if(ret != HAL_OK)
932  {
933  while(1) { ; }
934  }
935 
936  /* Activate the OverDrive to reach the 216/200 MHz Frequency */
938  if(ret != HAL_OK)
939  {
940  while(1) { ; }
941  }
942 
943  //if with 200 MHz HSE Clock - USB needs other clock setting for 48MHz on USB
944  /* Select PLLSAI output as USB clock source */
945  PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_CLK48;
946  PeriphClkInitStruct.Clk48ClockSelection = RCC_CLK48SOURCE_PLLSAIP;
947  PeriphClkInitStruct.PLLSAI.PLLSAIN = 384;
948  PeriphClkInitStruct.PLLSAI.PLLSAIQ = 7;
949  PeriphClkInitStruct.PLLSAI.PLLSAIP = RCC_PLLSAIP_DIV8;
950  if(HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
951  {
952  while(1) { ; }
953  }
954 
955  /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 clocks dividers */
957  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
958  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
959  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
960  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
961 
962  ret = HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4); //FLASH_LATENCY_5 or _6 - unreliable with _5?
963  if(ret != HAL_OK)
964  {
965  while(1) { ; }
966  }
967 
968  //it results in 96KHz SPDIFRX clock - but for 48KHz SPDIF Rx
969  PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_SPDIFRX;
970  PeriphClkInitStruct.PLLI2S.PLLI2SN = 192;
971  PeriphClkInitStruct.PLLI2S.PLLI2SP = RCC_PLLP_DIV2;
972  PeriphClkInitStruct.PLLI2S.PLLI2SR = 2;
973  PeriphClkInitStruct.PLLI2S.PLLI2SQ = 2;
974  PeriphClkInitStruct.PLLI2SDivQ = 1;
975  if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
976  {
977  return;
978  }
979 }
980 
987 {
988  /* Enable I-Cache */
990 
991  /* Enable D-Cache */
993 }
994 
995 /* SPDIFRX init function */
996 static void MX_SPDIFRX_Init(void)
997 {
998  hspdif.Instance = SPDIFRX;
1001  hspdif.Init.WaitForActivity = SPDIFRX_WAITFORACTIVITY_ON; //SPDIFRX_WAITFORACTIVITY_OFF;
1003  hspdif.Init.DataFormat = SPDIFRX_DATAFORMAT_32BITS; //SPDIFRX_DATAFORMAT_LSB;
1004  hspdif.Init.StereoMode = SPDIFRX_STEREOMODE_ENABLE; //SPDIFRX_STEREOMODE_DISABLE;
1009  if (HAL_SPDIFRX_Init(&hspdif) != HAL_OK)
1010  {
1011  return;
1012  }
1013 }
1014 
1018 static void MX_DMA_Init(void)
1019 {
1020  /* DMA controller clock enable */
1022 
1023  /* DMA interrupt init */
1024  /* DMA1_Stream1_IRQn interrupt configuration */
1027 }
1028 
1031 static void MX_GPIO_Init(void)
1032 {
1033  /* GPIO Ports Clock Enable */
1035 
1036 }
1037 
1039 {
1040 
1041 }
1042 
1044 {
1045 
1046 }
1047 
1048 #ifdef USE_FULL_ASSERT
1049 
1057 void assert_failed(uint8_t *file, uint32_t line)
1058 {
1059  /* User can add his own implementation to report the file name and line number,
1060  ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
1061 
1062  /* Infinite loop */
1063  while (1)
1064  {
1065  }
1066 }
1067 #endif
1068 
1077 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
#define HSYNC
Definition: main.c:83
Header of cmsis_os.c A new set of APIs are added in addition to existing ones, these APIs are specifi...
#define RCC_TIMPRES_ACTIVATED
osStatus osKernelStart(void)
Start the RTOS Kernel with executing the specified thread.
Definition: cmsis_os.c:152
#define I2S_AUDIOFREQ_44K
#define VACT
Definition: main.c:82
#define RCC_CLOCKTYPE_PCLK1
#define __HAL_RCC_DMA1_CLK_ENABLE()
#define LCD_COLOR_GREEN
Green value in ARGB8888 format.
void VUMETER_Input(int channel)
Analyze the peak meter for the audio input.
Definition: VUMeter.c:60
void SPDIF_Tx_Init(void)
Initialize the SPDIF Tx transmission, forward as SPDIF out.
Definition: SPDIF_Tx.c:25
#define RCC_SYSCLKSOURCE_PLLCLK
void http_taskCreate(void)
Definition: main_http.c:88
RCC_PLLI2SInitTypeDef PLLI2S
void SystemClock_Config(void)
System Clock Configuration The system Clock is configured as follow : System Clock source = PLL (HSE)...
Definition: main.c:913
#define LTDC
Definition: stm32f746xx.h:1365
void BSP_LCD_LayerDefaultInit(uint16_t LayerIndex, uint32_t FB_Address)
Initializes the LCD layers.
int main_audio(void)
Main program.
Definition: main.c:175
SPDIFRX handle Structure definition.
volatile uint32_t time_total
Definition: main.h:70
RCC System, AHB and APB busses clock configuration structure definition.
void BSP_LED_Init(Led_TypeDef Led)
Configures LED GPIO.
void BSP_LCD_SelectLayer(uint32_t LayerIndex)
Selects the LCD Layer.
#define LCD_COLOR_YELLOW
Yellow value in ARGB8888 format.
#define RCC_CLOCKTYPE_HCLK
void LTDC_Init(void)
LTDC initialization.
Definition: main.c:719
void BSP_LCD_SetFont(sFONT *fonts)
Sets the LCD text font.
HAL_StatusTypeDef HAL_DMA2D_Start(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Height)
#define HBP
Definition: main.c:84
#define TIM_MEASURE_TOTAL
Definition: main.h:81
void CPU_CACHE_Enable(void)
CPU L1-Cache enable.
Definition: main.c:986
void HAL_Delay(__IO uint32_t Delay)
This function provides accurate delay (in milliseconds) based on variable incremented.
#define RCC_CLOCKTYPE_SYSCLK
void BSP_LCD_Reset(void)
BSP LCD Reset Hw reset the LCD DSI activating its XRES signal (active low for some time) and desactiv...
void VUMETER_Display(int channel)
Display the peak meter.
Definition: VUMeter.c:100
xTaskHandle CreatedTaskAudio
Definition: main.c:133
#define RCC_PLLP_DIV2
#define SPDIFRX_PARITYERRORMASK_OFF
void main_UDanteUDP(void)
Definition: main_http.c:202
HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit)
int32_t Scratch[SCRATCH_BUFF_SIZE]
Definition: main.c:142
#define LCD_OK
LCD status structure definition.
#define RCC_SYSCLK_DIV1
DSI_HandleTypeDef hdsi_discovery
uint8_t BSP_QSPI_EnableMemoryMappedMode(void)
Configure the QSPI in memory-mapped mode.
SemaphoreHandle_t xSemaphoreAudio
Definition: main.c:132
#define __HAL_RCC_TIMCLKPRESCALER(__PRESC__)
Macro to configure the Timers clocks prescalers.
#define LCD_COLOR_WHITE
White value in ARGB8888 format.
#define SPDIFRX_WAITFORACTIVITY_ON
__IO uint32_t ARR
Definition: stm32f745xx.h:892
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.
#define SPDIFRX_INPUT_IN1
#define UARTCMD_THREAD_PRIO
Definition: main.c:93
DSI_LPCmdTypeDef LPCmd
Definition: main.c:69
void VUMETER_Analyse(void)
Analyse the peak meter value.
Definition: VUMeter.c:19
uint8_t BSP_AUDIO_IN_AllocScratch(int32_t *pScratch, uint32_t size)
Allocate channel buffer scratch.
#define RCC_PERIPHCLK_CLK48
#define DEFAULT_AUDIO_IN_BIT_RESOLUTION
DSI_CmdCfgTypeDef CmdCfg
Definition: main.c:68
AUDIO_ErrorTypeDef AUDIO_PLAYER_Start(void)
Starts Audio streaming.
Definition: AudioPlayer.c:161
#define HFP
Definition: main.c:85
RCC_PLLInitTypeDef PLL
#define LAYER0_ADDRESS
Definition: main.c:88
#define RCC_PLL_ON
#define FLASH_LATENCY_4
#define SPDIFRX_DATAFORMAT_32BITS
#define DEFAULT_AUDIO_IN_CHANNEL_NBR
int SPDIF_RX_Start(void)
Start the SPDIF Rx reception.
Definition: SPDIF_Rx.c:20
#define PAGE_SPLASH
Definition: GUI_pages.h:30
#define DEFAULT_THREAD_STACKSIZE
Definition: main.c:91
#define RCC_CLK48SOURCE_PLLSAIP
void BSP_LCD_SetBackColor(uint32_t Color)
Sets the LCD background color.
AUDIO_ErrorTypeDef AUDIO_PLAYER_Init(int outSelection, int sampleFreq)
Initializes Audio Interface.
Definition: AudioPlayer.c:128
void BSP_LCD_DisplayStringAt(uint16_t Xpos, uint16_t Ypos, uint8_t *Text, Text_AlignModeTypdef Mode)
Displays characters in currently active layer.
void BSP_AUDIO_IN_TransferComplete_CallBack(void)
Definition: main.c:1038
HAL_StatusTypeDef HAL_DMA2D_ConfigLayer(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx)
#define RCC_PLLSAIP_DIV8
void HAL_DSI_EndOfRefreshCallback(DSI_HandleTypeDef *hdsi)
End of Refresh DSI callback.
Definition: main.c:591
#define I2S_AUDIOFREQ_48K
int32_t FFT_Init(void)
Definition: FFT.c:288
#define osThreadDef(name, thread, priority, instances, stacksz)
Definition: cmsis_os.h:445
#define HACT
Definition: main.c:86
void vTaskStartScheduler(void) PRIVILEGED_FUNCTION
Definition: tasks.c:1543
#define SPDIFRX_PREAMBLETYPEMASK_OFF
#define RCC_HCLK_DIV2
#define TIM2
Definition: stm32f745xx.h:1258
HAL_StatusTypeDef HAL_DMA2D_Init(DMA2D_HandleTypeDef *hdma2d)
#define NULL
Definition: usbd_def.h:53
TIM_HandleTypeDef hTim2
Definition: main.h:71
SPDIFRX_HandleTypeDef hspdif
Definition: main.c:74
#define __IO
Definition: core_cm0.h:213
sFONT Font12
Definition: font12.c:1422
void(* XferCpltCallback)(struct __DMA2D_HandleTypeDef *hdma2d)
RCC extended clocks structure definition.
#define DMA2D_OUTPUT_ARGB8888
#define TIM_MEASURE_END
Definition: main.h:79
#define VSYNC
Definition: main.c:79
#define TIM_MEASURE_START
Definition: main.h:78
void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority)
#define xTaskHandle
Definition: FreeRTOS.h:805
HAL_StatusTypeDef HAL_Init(void)
This function is used to initialize the HAL Library; it must be the first instruction to be executed ...
DMA_HandleTypeDef hdma_spdif_rx_dt
Definition: main.c:75
void MPU_Config(void)
Configure the MPU attributes as Write Through for SRAM1/2.
Definition: main.c:806
HAL_StatusTypeDef HAL_PWREx_EnableOverDrive(void)
void SPDIF_Tx_Start(void)
Start the SPDIF Tx transmission, output.
Definition: SPDIF_Tx.c:67
__STATIC_INLINE void SCB_EnableICache(void)
Enable I-Cache.
Definition: core_cm7.h:2073
#define SPDIFRX_CHANNEL_A
void BSP_LCD_DisplayOn(void)
Switch back on the display if was switched off by previous call of BSP_LCD_DisplayOff(). Exit DSI ULPM mode if was allowed and configured in Dsi Configuration.
#define LCD_COLOR_BLACK
Black value in ARGB8888 format.
void USB_Interface(int mode)
Definition: usbd_main.c:15
#define RCC_PERIPHCLK_SPDIFRX
unsigned long AUDIO_Player_GetHeartbeat(void)
Get the counter (heartbeat) if we have audio reception.
Definition: AudioPlayer.c:353
void HAL_NVIC_EnableIRQ(IRQn_Type IRQn)
#define VFP
Definition: main.c:81
uint8_t BSP_TS_Init(uint16_t ts_SizeX, uint16_t ts_SizeY)
Initializes and configures the touch screen functionalities and configures all necessary hardware res...
void BSP_LED_On(Led_TypeDef Led)
Turns selected LED On.
uint8_t BSP_AUDIO_IN_InitEx(uint16_t InputDevice, uint32_t AudioFreq, uint32_t BitRes, uint32_t ChnlNbr)
Initialize wave recording.
LTDC_HandleTypeDef hltdc_discovery
void BSP_LCD_SetTextColor(uint32_t Color)
Sets the LCD text color.
#define RCC_HSE_ON
#define SPDIFRX_CHANNELSTATUS_OFF
osThreadId osThreadCreate(const osThreadDef_t *thread_def, void *argument)
Create a thread and add it to Active Threads and set it to state READY.
Definition: cmsis_os.c:204
DMA_HandleTypeDef hSaiDma
Definition: main.c:72
#define RCC_OSCILLATORTYPE_HSE
uint8_t BSP_TS_GetState(TS_StateTypeDef *TS_State)
Returns status and positions of the touch screen.
HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct)
#define RCC_PLLSOURCE_HSE
uint16_t touchY[TS_MAX_NB_TOUCH]
DSI_PLLInitTypeDef dsiPllInit
Definition: main.c:70
#define portCHAR
Definition: portmacro.h:89
DSI_VidCfgTypeDef hdsivideo_handle
Definition: main.c:67
void Netif_AddUDANTE(ip_addr_t ipAddr)
Definition: main_http.c:290
RCC Internal/External Oscillator (HSE, HSI, LSE and LSI) configuration structure definition.
#define __HAL_RCC_GPIOG_CLK_ENABLE()
#define DMA2D_M2M
#define SPDIFRX_VALIDITYMASK_OFF
uint8_t BSP_SDRAM_Init(void)
Initializes the SDRAM device.
uint8_t BSP_AUDIO_IN_Record(uint16_t *pbuf, uint32_t size)
Start audio recording.
__weak void BSP_LCD_MspInit(void)
Initialize the BSP LCD Msp. Application can surcharge if needed this function implementation.
#define DMA2D_INPUT_ARGB8888
uint8_t BSP_QSPI_Init(void)
Initializes the QSPI interface.
TIM_TypeDef * Instance
DMA handle Structure definition.
#define SPDIFRX_STEREOMODE_ENABLE
int32_t FFT_Filter(int ch)
Definition: FFT.c:336
#define TIM_MEASURE_BEGIN
Definition: main.h:73
#define DSI
Definition: stm32f769xx.h:1690
void BSP_AUDIO_IN_HalfTransfer_CallBack(void)
Definition: main.c:1043
#define RCC_PLLSAIDIVR_2
SPDIFRX_InitTypeDef Init
ip6_addr_t ip_addr_t
Definition: ip_addr.h:194
HAL_StatusTypeDef HAL_DMA2D_PollForTransfer(DMA2D_HandleTypeDef *hdma2d, uint32_t Timeout)
HAL_StatusTypeDef HAL_RCC_ClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t FLatency)
#define AUDIO_THREAD_PRIO
Definition: main.c:92
int AUDIO_PLAYER_GetBuffer(uint8_t **out_BufAddr)
Definition: AudioPlayer.c:117
#define SPDIFRX_MAXRETRIES_NONE
#define configMINIMAL_STACK_SIZE
#define RCC_HCLK_DIV4
#define vSemaphoreCreateBinary(xSemaphore)
Definition: semphr.h:131
#define osThread(name)
Definition: cmsis_os.h:454
uint8_t BSP_AUDIO_IN_Init(uint32_t AudioFreq, uint32_t BitRes, uint32_t ChnlNbr)
Initialize wave recording.
#define SCRATCH_BUFF_SIZE
Definition: main.c:141
HAL_StatusTypeDef
HAL Status structures definition.
volatile uint32_t time_diff
Definition: main.h:70
#define RCC_CLOCKTYPE_PCLK2
__STATIC_INLINE void SCB_EnableDCache(void)
Enable D-Cache.
Definition: core_cm7.h:2123
#define OTM8009A_COLMOD_RGB888
Definition: otm8009a.h:163
#define DMA2D
Definition: stm32f745xx.h:1346
#define __HAL_TIM_ENABLE(__HANDLE__)
Enable the TIM peripheral.
#define xTaskCreate(pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask)
Definition: task.h:345
#define __HAL_RCC_TIM2_CLK_ENABLE()
Enable or disable the Low Speed APB (APB1) peripheral clock.
int AUDIO_PLAYER_GetClock(void)
Definition: AudioPlayer.c:72
#define INPUT_DEVICE_INPUT_LINE_1
Definition: wm8994.h:80
void(* TaskFunction_t)(void *)
Definition: projdefs.h:77
#define VBP
Definition: main.c:80
void FFT_DisplayGraph(int ch)
Display the FFT, depending on the barType - which type we want to display.
Definition: FFT.c:436
void BSP_LCD_DrawBitmap(uint32_t Xpos, uint32_t Ypos, uint8_t *pbmp)
Draws a bitmap picture loaded in the internal Flash (32 bpp) in currently active layer.
uint8_t OTM8009A_Init(uint32_t ColorCoding, uint32_t orientation)
Initializes the LCD KoD display part by communication in DSI mode in Video Mode with IC Display Drive...
Definition: otm8009a.c:194
#define LCD_COLOR_LIGHTRED
Light Red value in ARGB8888 format.
void SystemCoreClockUpdate(void)
Update SystemCoreClock variable according to Clock Register Values. The SystemCoreClock variable cont...
unsigned short u16_t
Definition: cc.h:40
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct
HAL_StatusTypeDef HAL_SPDIFRX_Init(SPDIFRX_HandleTypeDef *hspdif)
DMA2D_LayerCfgTypeDef LayerCfg[MAX_DMA2D_LAYER]
DMA2D handle Structure definition.
QueueHandle_t SemaphoreHandle_t
Definition: semphr.h:79
#define SPDIFRX
Definition: stm32f745xx.h:1273
#define DMA2D_NO_MODIF_ALPHA
#define FFT_Y_BORDER_TOP
Definition: FFT.h:17
RCC_PLLSAIInitTypeDef PLLSAI
uint16_t touchX[TS_MAX_NB_TOUCH]