STM32L4xx_HAL_Driver  1.14.0
stm32l4xx_hal_ltdc_ex.c
Go to the documentation of this file.
1 
20 /* Includes ------------------------------------------------------------------*/
21 #include "stm32l4xx_hal.h"
22 
27 #if defined(HAL_LTDC_MODULE_ENABLED) && defined(HAL_DSI_MODULE_ENABLED)
28 
29 #if defined (LTDC) && defined (DSI)
30 
36 /* Private typedef -----------------------------------------------------------*/
37 /* Private define ------------------------------------------------------------*/
38 /* Private macro -------------------------------------------------------------*/
39 /* Private variables ---------------------------------------------------------*/
40 /* Private function prototypes -----------------------------------------------*/
41 /* Exported functions --------------------------------------------------------*/
42 
72 {
73  /* Retrieve signal polarities from DSI */
74 
75  /* The following polarity is inverted:
76  LTDC_DEPOLARITY_AL <-> LTDC_DEPOLARITY_AH */
77 
78  /* Note 1 : Code in line w/ Current LTDC specification */
79  hltdc->Init.DEPolarity = (VidCfg->DEPolarity == DSI_DATA_ENABLE_ACTIVE_HIGH) ? LTDC_DEPOLARITY_AL : LTDC_DEPOLARITY_AH;
80  hltdc->Init.VSPolarity = (VidCfg->VSPolarity == DSI_VSYNC_ACTIVE_HIGH) ? LTDC_VSPOLARITY_AH : LTDC_VSPOLARITY_AL;
81  hltdc->Init.HSPolarity = (VidCfg->HSPolarity == DSI_HSYNC_ACTIVE_HIGH) ? LTDC_HSPOLARITY_AH : LTDC_HSPOLARITY_AL;
82 
83  /* Note 2: Code to be used in case LTDC polarities inversion updated in the specification */
84  /* hltdc->Init.DEPolarity = VidCfg->DEPolarity << 29;
85  hltdc->Init.VSPolarity = VidCfg->VSPolarity << 29;
86  hltdc->Init.HSPolarity = VidCfg->HSPolarity << 29; */
87 
88  /* Retrieve vertical timing parameters from DSI */
89  hltdc->Init.VerticalSync = VidCfg->VerticalSyncActive - 1U;
90  hltdc->Init.AccumulatedVBP = VidCfg->VerticalSyncActive + VidCfg->VerticalBackPorch - 1U;
91  hltdc->Init.AccumulatedActiveH = VidCfg->VerticalSyncActive + VidCfg->VerticalBackPorch + VidCfg->VerticalActive - 1U;
92  hltdc->Init.TotalHeigh = VidCfg->VerticalSyncActive + VidCfg->VerticalBackPorch + VidCfg->VerticalActive + VidCfg->VerticalFrontPorch - 1U;
93 
94  return HAL_OK;
95 }
96 
108 {
109  /* Retrieve signal polarities from DSI */
110 
111  /* The following polarities are inverted:
112  LTDC_DEPOLARITY_AL <-> LTDC_DEPOLARITY_AH
113  LTDC_VSPOLARITY_AL <-> LTDC_VSPOLARITY_AH
114  LTDC_HSPOLARITY_AL <-> LTDC_HSPOLARITY_AH)*/
115 
116  /* Note 1 : Code in line w/ Current LTDC specification */
117  hltdc->Init.DEPolarity = (CmdCfg->DEPolarity == DSI_DATA_ENABLE_ACTIVE_HIGH) ? LTDC_DEPOLARITY_AL : LTDC_DEPOLARITY_AH;
118  hltdc->Init.VSPolarity = (CmdCfg->VSPolarity == DSI_VSYNC_ACTIVE_HIGH) ? LTDC_VSPOLARITY_AL : LTDC_VSPOLARITY_AH;
119  hltdc->Init.HSPolarity = (CmdCfg->HSPolarity == DSI_HSYNC_ACTIVE_HIGH) ? LTDC_HSPOLARITY_AL : LTDC_HSPOLARITY_AH;
120 
121  /* Note 2: Code to be used in case LTDC polarities inversion updated in the specification */
122  /* hltdc->Init.DEPolarity = CmdCfg->DEPolarity << 29;
123  hltdc->Init.VSPolarity = CmdCfg->VSPolarity << 29;
124  hltdc->Init.HSPolarity = CmdCfg->HSPolarity << 29; */
125 
126  return HAL_OK;
127 }
128 
141 #endif /* LTDC && DSI */
142 
143 #endif /* HAL_LTCD_MODULE_ENABLED && HAL_DSI_MODULE_ENABLED */
144 
149 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
HAL_StatusTypeDef HAL_LTDCEx_StructInitFromAdaptedCommandConfig(LTDC_HandleTypeDef *hltdc, DSI_CmdCfgTypeDef *CmdCfg)
Retrieve common parameters from DSI Adapted command mode configuration structure. ...
DSI Adapted command mode configuration.
This file contains all the functions prototypes for the HAL module driver.
DSI Video mode configuration.
struct __LTDC_HandleTypeDef else typedef struct endif LTDC_HandleTypeDef
LTDC handle Structure definition.
return HAL_OK
HAL_StatusTypeDef HAL_LTDCEx_StructInitFromVideoConfig(LTDC_HandleTypeDef *hltdc, DSI_VidCfgTypeDef *VidCfg)
Retrieve common parameters from DSI Video mode configuration structure.