STM32F769IDiscovery  1.00
uDANTE Audio Networking with STM32F7 DISCO board
stm32f7xx_hal_ltdc_ex.c
Go to the documentation of this file.
1 
38 /* Includes ------------------------------------------------------------------*/
39 #include "stm32f7xx_hal.h"
40 
49 #ifdef HAL_LTDC_MODULE_ENABLED
50 
51 /* Private typedef -----------------------------------------------------------*/
52 /* Private define ------------------------------------------------------------*/
53 /* Private macro -------------------------------------------------------------*/
54 /* Private variables ---------------------------------------------------------*/
55 /* Private function prototypes -----------------------------------------------*/
56 /* Exported functions --------------------------------------------------------*/
57 
75 #if defined (STM32F769xx) || defined (STM32F779xx)
76 
86 HAL_StatusTypeDef HAL_LTDC_StructInitFromVideoConfig(LTDC_HandleTypeDef* hltdc, DSI_VidCfgTypeDef *VidCfg)
87 {
88  /* Retrieve signal polarities from DSI */
89 
90  /* The following polarities are inverted:
91  LTDC_DEPOLARITY_AL <-> LTDC_DEPOLARITY_AH
92  LTDC_VSPOLARITY_AL <-> LTDC_VSPOLARITY_AH
93  LTDC_HSPOLARITY_AL <-> LTDC_HSPOLARITY_AH)*/
94 
95  /* Note 1 : Code in line w/ Current LTDC specification */
96  hltdc->Init.DEPolarity = (VidCfg->DEPolarity == DSI_DATA_ENABLE_ACTIVE_HIGH) ? LTDC_DEPOLARITY_AL : LTDC_DEPOLARITY_AH;
97  hltdc->Init.VSPolarity = (VidCfg->VSPolarity == DSI_VSYNC_ACTIVE_HIGH) ? LTDC_VSPOLARITY_AL : LTDC_VSPOLARITY_AH;
98  hltdc->Init.HSPolarity = (VidCfg->HSPolarity == DSI_HSYNC_ACTIVE_HIGH) ? LTDC_HSPOLARITY_AL : LTDC_HSPOLARITY_AH;
99 
100  /* Note 2: Code to be used in case LTDC polarities inversion updated in the specification */
101  /* hltdc->Init.DEPolarity = VidCfg->DEPolarity << 29;
102  hltdc->Init.VSPolarity = VidCfg->VSPolarity << 29;
103  hltdc->Init.HSPolarity = VidCfg->HSPolarity << 29; */
104 
105  /* Retrieve vertical timing parameters from DSI */
106  hltdc->Init.VerticalSync = VidCfg->VerticalSyncActive - 1;
107  hltdc->Init.AccumulatedVBP = VidCfg->VerticalSyncActive + VidCfg->VerticalBackPorch - 1;
108  hltdc->Init.AccumulatedActiveH = VidCfg->VerticalSyncActive + VidCfg->VerticalBackPorch + VidCfg->VerticalActive - 1;
109  hltdc->Init.TotalHeigh = VidCfg->VerticalSyncActive + VidCfg->VerticalBackPorch + VidCfg->VerticalActive + VidCfg->VerticalFrontPorch - 1;
110 
111  return HAL_OK;
112 }
113 
124 HAL_StatusTypeDef HAL_LTDC_StructInitFromAdaptedCommandConfig(LTDC_HandleTypeDef* hltdc, DSI_CmdCfgTypeDef *CmdCfg)
125 {
126  /* Retrieve signal polarities from DSI */
127 
128  /* The following polarities are inverted:
129  LTDC_DEPOLARITY_AL <-> LTDC_DEPOLARITY_AH
130  LTDC_VSPOLARITY_AL <-> LTDC_VSPOLARITY_AH
131  LTDC_HSPOLARITY_AL <-> LTDC_HSPOLARITY_AH)*/
132 
133  /* Note 1 : Code in line w/ Current LTDC specification */
134  hltdc->Init.DEPolarity = (CmdCfg->DEPolarity == DSI_DATA_ENABLE_ACTIVE_HIGH) ? LTDC_DEPOLARITY_AL : LTDC_DEPOLARITY_AH;
135  hltdc->Init.VSPolarity = (CmdCfg->VSPolarity == DSI_VSYNC_ACTIVE_HIGH) ? LTDC_VSPOLARITY_AL : LTDC_VSPOLARITY_AH;
136  hltdc->Init.HSPolarity = (CmdCfg->HSPolarity == DSI_HSYNC_ACTIVE_HIGH) ? LTDC_HSPOLARITY_AL : LTDC_HSPOLARITY_AH;
137 
138  /* Note 2: Code to be used in case LTDC polarities inversion updated in the specification */
139  /* hltdc->Init.DEPolarity = CmdCfg->DEPolarity << 29;
140  hltdc->Init.VSPolarity = CmdCfg->VSPolarity << 29;
141  hltdc->Init.HSPolarity = CmdCfg->HSPolarity << 29; */
142 
143  return HAL_OK;
144 }
145 #endif /*STM32F769xx | STM32F779xx */
146 
155 #endif /* HAL_LTCD_MODULE_ENABLED */
156 
164 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
DSI_CmdCfgTypeDef CmdCfg
Definition: main.c:68
This file contains all the functions prototypes for the HAL module driver.
HAL_StatusTypeDef
HAL Status structures definition.