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