STM32L4xx_HAL_Driver  1.14.0
Peripheral Control functions

Peripheral Control functions. More...

Functions

HAL_StatusTypeDef HAL_DSI_SetGenericVCID (DSI_HandleTypeDef *hdsi, uint32_t VirtualChannelID)
 Configure the Generic interface read-back Virtual Channel ID. More...
 
HAL_StatusTypeDef HAL_DSI_ConfigVideoMode (DSI_HandleTypeDef *hdsi, DSI_VidCfgTypeDef *VidCfg)
 Select video mode and configure the corresponding parameters. More...
 
HAL_StatusTypeDef HAL_DSI_ConfigAdaptedCommandMode (DSI_HandleTypeDef *hdsi, DSI_CmdCfgTypeDef *CmdCfg)
 Select adapted command mode and configure the corresponding parameters. More...
 
HAL_StatusTypeDef HAL_DSI_ConfigCommand (DSI_HandleTypeDef *hdsi, DSI_LPCmdTypeDef *LPCmd)
 Configure command transmission mode: High-speed or Low-power and enable/disable acknowledge request after packet transmission. More...
 
HAL_StatusTypeDef HAL_DSI_ConfigFlowControl (DSI_HandleTypeDef *hdsi, uint32_t FlowControl)
 Configure the flow control parameters. More...
 
HAL_StatusTypeDef HAL_DSI_ConfigPhyTimer (DSI_HandleTypeDef *hdsi, DSI_PHY_TimerTypeDef *PhyTimers)
 Configure the DSI PHY timer parameters. More...
 
HAL_StatusTypeDef HAL_DSI_ConfigHostTimeouts (DSI_HandleTypeDef *hdsi, DSI_HOST_TimeoutTypeDef *HostTimeouts)
 Configure the DSI HOST timeout parameters. More...
 
HAL_StatusTypeDef HAL_DSI_Start (DSI_HandleTypeDef *hdsi)
 Start the DSI module. More...
 
HAL_StatusTypeDef HAL_DSI_Stop (DSI_HandleTypeDef *hdsi)
 Stop the DSI module. More...
 
HAL_StatusTypeDef HAL_DSI_Refresh (DSI_HandleTypeDef *hdsi)
 Refresh the display in command mode. More...
 
HAL_StatusTypeDef HAL_DSI_ColorMode (DSI_HandleTypeDef *hdsi, uint32_t ColorMode)
 Controls the display color mode in Video mode. More...
 
HAL_StatusTypeDef HAL_DSI_Shutdown (DSI_HandleTypeDef *hdsi, uint32_t Shutdown)
 Control the display shutdown in Video mode. More...
 
HAL_StatusTypeDef HAL_DSI_ShortWrite (DSI_HandleTypeDef *hdsi, uint32_t ChannelID, uint32_t Mode, uint32_t Param1, uint32_t Param2)
 write short DCS or short Generic command More...
 
HAL_StatusTypeDef HAL_DSI_LongWrite (DSI_HandleTypeDef *hdsi, uint32_t ChannelID, uint32_t Mode, uint32_t NbParams, uint32_t Param1, uint8_t *ParametersTable)
 write long DCS or long Generic command More...
 
HAL_StatusTypeDef HAL_DSI_Read (DSI_HandleTypeDef *hdsi, uint32_t ChannelNbr, uint8_t *Array, uint32_t Size, uint32_t Mode, uint32_t DCSCmd, uint8_t *ParametersTable)
 Read command (DCS or generic) More...
 
HAL_StatusTypeDef HAL_DSI_EnterULPMData (DSI_HandleTypeDef *hdsi)
 Enter the ULPM (Ultra Low Power Mode) with the D-PHY PLL running (only data lanes are in ULPM) More...
 
HAL_StatusTypeDef HAL_DSI_ExitULPMData (DSI_HandleTypeDef *hdsi)
 Exit the ULPM (Ultra Low Power Mode) with the D-PHY PLL running (only data lanes are in ULPM) More...
 
HAL_StatusTypeDef HAL_DSI_EnterULPM (DSI_HandleTypeDef *hdsi)
 Enter the ULPM (Ultra Low Power Mode) with the D-PHY PLL turned off (both data and clock lanes are in ULPM) More...
 
HAL_StatusTypeDef HAL_DSI_ExitULPM (DSI_HandleTypeDef *hdsi)
 Exit the ULPM (Ultra Low Power Mode) with the D-PHY PLL turned off (both data and clock lanes are in ULPM) More...
 
HAL_StatusTypeDef HAL_DSI_PatternGeneratorStart (DSI_HandleTypeDef *hdsi, uint32_t Mode, uint32_t Orientation)
 Start test pattern generation. More...
 
HAL_StatusTypeDef HAL_DSI_PatternGeneratorStop (DSI_HandleTypeDef *hdsi)
 Stop test pattern generation. More...
 
HAL_StatusTypeDef HAL_DSI_SetSlewRateAndDelayTuning (DSI_HandleTypeDef *hdsi, uint32_t CommDelay, uint32_t Lane, uint32_t Value)
 Set Slew-Rate And Delay Tuning. More...
 
HAL_StatusTypeDef HAL_DSI_SetLowPowerRXFilter (DSI_HandleTypeDef *hdsi, uint32_t Frequency)
 Low-Power Reception Filter Tuning. More...
 
HAL_StatusTypeDef HAL_DSI_SetSDD (DSI_HandleTypeDef *hdsi, FunctionalState State)
 Activate an additional current path on all lanes to meet the SDDTx parameter defined in the MIPI D-PHY specification. More...
 
HAL_StatusTypeDef HAL_DSI_SetLanePinsConfiguration (DSI_HandleTypeDef *hdsi, uint32_t CustomLane, uint32_t Lane, FunctionalState State)
 Custom lane pins configuration. More...
 
HAL_StatusTypeDef HAL_DSI_SetPHYTimings (DSI_HandleTypeDef *hdsi, uint32_t Timing, FunctionalState State, uint32_t Value)
 Set custom timing for the PHY. More...
 
HAL_StatusTypeDef HAL_DSI_ForceTXStopMode (DSI_HandleTypeDef *hdsi, uint32_t Lane, FunctionalState State)
 Force the Clock/Data Lane in TX Stop Mode. More...
 
HAL_StatusTypeDef HAL_DSI_ForceRXLowPower (DSI_HandleTypeDef *hdsi, FunctionalState State)
 Force LP Receiver in Low-Power Mode. More...
 
HAL_StatusTypeDef HAL_DSI_ForceDataLanesInRX (DSI_HandleTypeDef *hdsi, FunctionalState State)
 Force Data Lanes in RX Mode after a BTA. More...
 
HAL_StatusTypeDef HAL_DSI_SetPullDown (DSI_HandleTypeDef *hdsi, FunctionalState State)
 Enable a pull-down on the lanes to prevent from floating states when unused. More...
 
HAL_StatusTypeDef HAL_DSI_SetContentionDetectionOff (DSI_HandleTypeDef *hdsi, FunctionalState State)
 Switch off the contention detection on data lanes. More...
 

Detailed Description

Peripheral Control functions.

 ===============================================================================
                    ##### Peripheral Control functions #####
 ===============================================================================
    [..]  This section provides functions allowing to:
      (+) Configure the Generic interface read-back Virtual Channel ID
      (+) Select video mode and configure the corresponding parameters
      (+) Configure command transmission mode: High-speed or Low-power
      (+) Configure the flow control
      (+) Configure the DSI PHY timer
      (+) Configure the DSI HOST timeout
      (+) Configure the DSI HOST timeout
      (+) Start/Stop the DSI module
      (+) Refresh the display in command mode
      (+) Controls the display color mode in Video mode
      (+) Control the display shutdown in Video mode
      (+) write short DCS or short Generic command
      (+) write long DCS or long Generic command
      (+) Read command (DCS or generic)
      (+) Enter/Exit the Ultra Low Power Mode on data only (D-PHY PLL running)
      (+) Enter/Exit the Ultra Low Power Mode on data only and clock (D-PHY PLL turned off)
      (+) Start/Stop test pattern generation
      (+) Slew-Rate And Delay Tuning
      (+) Low-Power Reception Filter Tuning
      (+) Activate an additional current path on all lanes to meet the SDDTx parameter
      (+) Custom lane pins configuration
      (+) Set custom timing for the PHY
      (+) Force the Clock/Data Lane in TX Stop Mode
      (+) Force LP Receiver in Low-Power Mode
      (+) Force Data Lanes in RX Mode after a BTA
      (+) Enable a pull-down on the lanes to prevent from floating states when unused
      (+) Switch off the contention detection on data lanes

Function Documentation

◆ HAL_DSI_ColorMode()

HAL_StatusTypeDef HAL_DSI_ColorMode ( DSI_HandleTypeDef hdsi,
uint32_t  ColorMode 
)

Controls the display color mode in Video mode.

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
ColorModeColor mode (full or 8-colors). This parameter can be any value of
  • DSI_Color_Mode
Return values
HALstatus

Definition at line 1520 of file stm32l4xx_hal_dsi.c.

1521 {
1522  /* Process locked */
1523  __HAL_LOCK(hdsi);
1524 
1525  /* Check the parameters */
1526  assert_param(IS_DSI_COLOR_MODE(ColorMode));
1527 
1528  /* Update the display color mode */
1529  hdsi->Instance->WCR &= ~DSI_WCR_COLM;
1530  hdsi->Instance->WCR |= ColorMode;
1531 
1532  /* Process unlocked */
1533  __HAL_UNLOCK(hdsi);
1534 
1535  return HAL_OK;
1536 }
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DSI_ConfigAdaptedCommandMode()

HAL_StatusTypeDef HAL_DSI_ConfigAdaptedCommandMode ( DSI_HandleTypeDef hdsi,
DSI_CmdCfgTypeDef CmdCfg 
)

Select adapted command mode and configure the corresponding parameters.

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
CmdCfgpointer to a DSI_CmdCfgTypeDef structure that contains the DSI command mode configuration parameters
Return values
HALstatus

Definition at line 1193 of file stm32l4xx_hal_dsi.c.

1194 {
1195  /* Process locked */
1196  __HAL_LOCK(hdsi);
1197 
1198  /* Check the parameters */
1199  assert_param(IS_DSI_COLOR_CODING(CmdCfg->ColorCoding));
1200  assert_param(IS_DSI_TE_SOURCE(CmdCfg->TearingEffectSource));
1201  assert_param(IS_DSI_TE_POLARITY(CmdCfg->TearingEffectPolarity));
1202  assert_param(IS_DSI_AUTOMATIC_REFRESH(CmdCfg->AutomaticRefresh));
1203  assert_param(IS_DSI_VS_POLARITY(CmdCfg->VSyncPol));
1204  assert_param(IS_DSI_TE_ACK_REQUEST(CmdCfg->TEAcknowledgeRequest));
1205  assert_param(IS_DSI_DE_POLARITY(CmdCfg->DEPolarity));
1206  assert_param(IS_DSI_VSYNC_POLARITY(CmdCfg->VSPolarity));
1207  assert_param(IS_DSI_HSYNC_POLARITY(CmdCfg->HSPolarity));
1208 
1209  /* Select command mode by setting CMDM and DSIM bits */
1210  hdsi->Instance->MCR |= DSI_MCR_CMDM;
1211  hdsi->Instance->WCFGR &= ~DSI_WCFGR_DSIM;
1212  hdsi->Instance->WCFGR |= DSI_WCFGR_DSIM;
1213 
1214  /* Select the virtual channel for the LTDC interface traffic */
1215  hdsi->Instance->LVCIDR &= ~DSI_LVCIDR_VCID;
1216  hdsi->Instance->LVCIDR |= CmdCfg->VirtualChannelID;
1217 
1218  /* Configure the polarity of control signals */
1219  hdsi->Instance->LPCR &= ~(DSI_LPCR_DEP | DSI_LPCR_VSP | DSI_LPCR_HSP);
1220  hdsi->Instance->LPCR |= (CmdCfg->DEPolarity | CmdCfg->VSPolarity | CmdCfg->HSPolarity);
1221 
1222  /* Select the color coding for the host */
1223  hdsi->Instance->LCOLCR &= ~DSI_LCOLCR_COLC;
1224  hdsi->Instance->LCOLCR |= CmdCfg->ColorCoding;
1225 
1226  /* Select the color coding for the wrapper */
1227  hdsi->Instance->WCFGR &= ~DSI_WCFGR_COLMUX;
1228  hdsi->Instance->WCFGR |= ((CmdCfg->ColorCoding) << 1U);
1229 
1230  /* Configure the maximum allowed size for write memory command */
1231  hdsi->Instance->LCCR &= ~DSI_LCCR_CMDSIZE;
1232  hdsi->Instance->LCCR |= CmdCfg->CommandSize;
1233 
1234  /* Configure the tearing effect source and polarity and select the refresh mode */
1235  hdsi->Instance->WCFGR &= ~(DSI_WCFGR_TESRC | DSI_WCFGR_TEPOL | DSI_WCFGR_AR | DSI_WCFGR_VSPOL);
1236  hdsi->Instance->WCFGR |= (CmdCfg->TearingEffectSource | CmdCfg->TearingEffectPolarity | CmdCfg->AutomaticRefresh |
1237  CmdCfg->VSyncPol);
1238 
1239  /* Configure the tearing effect acknowledge request */
1240  hdsi->Instance->CMCR &= ~DSI_CMCR_TEARE;
1241  hdsi->Instance->CMCR |= CmdCfg->TEAcknowledgeRequest;
1242 
1243  /* Enable the Tearing Effect interrupt */
1244  __HAL_DSI_ENABLE_IT(hdsi, DSI_IT_TE);
1245 
1246  /* Enable the End of Refresh interrupt */
1247  __HAL_DSI_ENABLE_IT(hdsi, DSI_IT_ER);
1248 
1249  /* Process unlocked */
1250  __HAL_UNLOCK(hdsi);
1251 
1252  return HAL_OK;
1253 }
uint32_t TearingEffectPolarity
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DSI_ConfigCommand()

HAL_StatusTypeDef HAL_DSI_ConfigCommand ( DSI_HandleTypeDef hdsi,
DSI_LPCmdTypeDef LPCmd 
)

Configure command transmission mode: High-speed or Low-power and enable/disable acknowledge request after packet transmission.

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
LPCmdpointer to a DSI_LPCmdTypeDef structure that contains the DSI command transmission mode configuration parameters
Return values
HALstatus

Definition at line 1264 of file stm32l4xx_hal_dsi.c.

1265 {
1266  /* Process locked */
1267  __HAL_LOCK(hdsi);
1268 
1269  assert_param(IS_DSI_LP_GSW0P(LPCmd->LPGenShortWriteNoP));
1270  assert_param(IS_DSI_LP_GSW1P(LPCmd->LPGenShortWriteOneP));
1271  assert_param(IS_DSI_LP_GSW2P(LPCmd->LPGenShortWriteTwoP));
1272  assert_param(IS_DSI_LP_GSR0P(LPCmd->LPGenShortReadNoP));
1273  assert_param(IS_DSI_LP_GSR1P(LPCmd->LPGenShortReadOneP));
1274  assert_param(IS_DSI_LP_GSR2P(LPCmd->LPGenShortReadTwoP));
1275  assert_param(IS_DSI_LP_GLW(LPCmd->LPGenLongWrite));
1276  assert_param(IS_DSI_LP_DSW0P(LPCmd->LPDcsShortWriteNoP));
1277  assert_param(IS_DSI_LP_DSW1P(LPCmd->LPDcsShortWriteOneP));
1278  assert_param(IS_DSI_LP_DSR0P(LPCmd->LPDcsShortReadNoP));
1279  assert_param(IS_DSI_LP_DLW(LPCmd->LPDcsLongWrite));
1280  assert_param(IS_DSI_LP_MRDP(LPCmd->LPMaxReadPacket));
1281  assert_param(IS_DSI_ACK_REQUEST(LPCmd->AcknowledgeRequest));
1282 
1283  /* Select High-speed or Low-power for command transmission */
1284  hdsi->Instance->CMCR &= ~(DSI_CMCR_GSW0TX | \
1285  DSI_CMCR_GSW1TX | \
1286  DSI_CMCR_GSW2TX | \
1287  DSI_CMCR_GSR0TX | \
1288  DSI_CMCR_GSR1TX | \
1289  DSI_CMCR_GSR2TX | \
1290  DSI_CMCR_GLWTX | \
1291  DSI_CMCR_DSW0TX | \
1292  DSI_CMCR_DSW1TX | \
1293  DSI_CMCR_DSR0TX | \
1294  DSI_CMCR_DLWTX | \
1295  DSI_CMCR_MRDPS);
1296  hdsi->Instance->CMCR |= (LPCmd->LPGenShortWriteNoP | \
1297  LPCmd->LPGenShortWriteOneP | \
1298  LPCmd->LPGenShortWriteTwoP | \
1299  LPCmd->LPGenShortReadNoP | \
1300  LPCmd->LPGenShortReadOneP | \
1301  LPCmd->LPGenShortReadTwoP | \
1302  LPCmd->LPGenLongWrite | \
1303  LPCmd->LPDcsShortWriteNoP | \
1304  LPCmd->LPDcsShortWriteOneP | \
1305  LPCmd->LPDcsShortReadNoP | \
1306  LPCmd->LPDcsLongWrite | \
1307  LPCmd->LPMaxReadPacket);
1308 
1309  /* Configure the acknowledge request after each packet transmission */
1310  hdsi->Instance->CMCR &= ~DSI_CMCR_ARE;
1311  hdsi->Instance->CMCR |= LPCmd->AcknowledgeRequest;
1312 
1313  /* Process unlocked */
1314  __HAL_UNLOCK(hdsi);
1315 
1316  return HAL_OK;
1317 }
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK
uint32_t LPDcsShortWriteOneP
uint32_t LPGenShortWriteOneP
uint32_t LPGenShortWriteTwoP
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DSI_ConfigFlowControl()

HAL_StatusTypeDef HAL_DSI_ConfigFlowControl ( DSI_HandleTypeDef hdsi,
uint32_t  FlowControl 
)

Configure the flow control parameters.

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
FlowControlflow control feature(s) to be enabled. This parameter can be any combination of
  • DSI_FlowControl.
Return values
HALstatus

Definition at line 1327 of file stm32l4xx_hal_dsi.c.

1328 {
1329  /* Process locked */
1330  __HAL_LOCK(hdsi);
1331 
1332  /* Check the parameters */
1333  assert_param(IS_DSI_FLOW_CONTROL(FlowControl));
1334 
1335  /* Set the DSI Host Protocol Configuration Register */
1336  hdsi->Instance->PCR &= ~DSI_FLOW_CONTROL_ALL;
1337  hdsi->Instance->PCR |= FlowControl;
1338 
1339  /* Process unlocked */
1340  __HAL_UNLOCK(hdsi);
1341 
1342  return HAL_OK;
1343 }
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DSI_ConfigHostTimeouts()

HAL_StatusTypeDef HAL_DSI_ConfigHostTimeouts ( DSI_HandleTypeDef hdsi,
DSI_HOST_TimeoutTypeDef HostTimeouts 
)

Configure the DSI HOST timeout parameters.

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
HostTimeoutsDSI_HOST_TimeoutTypeDef structure that contains the DSI host timeout parameters
Return values
HALstatus

Definition at line 1399 of file stm32l4xx_hal_dsi.c.

1400 {
1401  /* Process locked */
1402  __HAL_LOCK(hdsi);
1403 
1404  /* Set the timeout clock division factor */
1405  hdsi->Instance->CCR &= ~DSI_CCR_TOCKDIV;
1406  hdsi->Instance->CCR |= ((HostTimeouts->TimeoutCkdiv) << 8U);
1407 
1408  /* High-speed transmission timeout */
1409  hdsi->Instance->TCCR[0U] &= ~DSI_TCCR0_HSTX_TOCNT;
1410  hdsi->Instance->TCCR[0U] |= ((HostTimeouts->HighSpeedTransmissionTimeout) << 16U);
1411 
1412  /* Low-power reception timeout */
1413  hdsi->Instance->TCCR[0U] &= ~DSI_TCCR0_LPRX_TOCNT;
1414  hdsi->Instance->TCCR[0U] |= HostTimeouts->LowPowerReceptionTimeout;
1415 
1416  /* High-speed read timeout */
1417  hdsi->Instance->TCCR[1U] &= ~DSI_TCCR1_HSRD_TOCNT;
1418  hdsi->Instance->TCCR[1U] |= HostTimeouts->HighSpeedReadTimeout;
1419 
1420  /* Low-power read timeout */
1421  hdsi->Instance->TCCR[2U] &= ~DSI_TCCR2_LPRD_TOCNT;
1422  hdsi->Instance->TCCR[2U] |= HostTimeouts->LowPowerReadTimeout;
1423 
1424  /* High-speed write timeout */
1425  hdsi->Instance->TCCR[3U] &= ~DSI_TCCR3_HSWR_TOCNT;
1426  hdsi->Instance->TCCR[3U] |= HostTimeouts->HighSpeedWriteTimeout;
1427 
1428  /* High-speed write presp mode */
1429  hdsi->Instance->TCCR[3U] &= ~DSI_TCCR3_PM;
1430  hdsi->Instance->TCCR[3U] |= HostTimeouts->HighSpeedWritePrespMode;
1431 
1432  /* Low-speed write timeout */
1433  hdsi->Instance->TCCR[4U] &= ~DSI_TCCR4_LPWR_TOCNT;
1434  hdsi->Instance->TCCR[4U] |= HostTimeouts->LowPowerWriteTimeout;
1435 
1436  /* BTA timeout */
1437  hdsi->Instance->TCCR[5U] &= ~DSI_TCCR5_BTA_TOCNT;
1438  hdsi->Instance->TCCR[5U] |= HostTimeouts->BTATimeout;
1439 
1440  /* Process unlocked */
1441  __HAL_UNLOCK(hdsi);
1442 
1443  return HAL_OK;
1444 }
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK

◆ HAL_DSI_ConfigPhyTimer()

HAL_StatusTypeDef HAL_DSI_ConfigPhyTimer ( DSI_HandleTypeDef hdsi,
DSI_PHY_TimerTypeDef PhyTimers 
)

Configure the DSI PHY timer parameters.

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
PhyTimersDSI_PHY_TimerTypeDef structure that contains the DSI PHY timing parameters
Return values
HALstatus

Definition at line 1353 of file stm32l4xx_hal_dsi.c.

1354 {
1355  uint32_t maxTime;
1356  /* Process locked */
1357  __HAL_LOCK(hdsi);
1358 
1359  maxTime = (PhyTimers->ClockLaneLP2HSTime > PhyTimers->ClockLaneHS2LPTime) ? PhyTimers->ClockLaneLP2HSTime :
1360  PhyTimers->ClockLaneHS2LPTime;
1361 
1362  /* Clock lane timer configuration */
1363 
1364  /* In Automatic Clock Lane control mode, the DSI Host can turn off the clock lane between two
1365  High-Speed transmission.
1366  To do so, the DSI Host calculates the time required for the clock lane to change from HighSpeed
1367  to Low-Power and from Low-Power to High-Speed.
1368  This timings are configured by the HS2LP_TIME and LP2HS_TIME in the DSI Host Clock Lane Timer Configuration Register (DSI_CLTCR).
1369  But the DSI Host is not calculating LP2HS_TIME + HS2LP_TIME but 2 x HS2LP_TIME.
1370 
1371  Workaround : Configure HS2LP_TIME and LP2HS_TIME with the same value being the max of HS2LP_TIME or LP2HS_TIME.
1372  */
1373  hdsi->Instance->CLTCR &= ~(DSI_CLTCR_LP2HS_TIME | DSI_CLTCR_HS2LP_TIME);
1374  hdsi->Instance->CLTCR |= (maxTime | ((maxTime) << 16U));
1375 
1376  /* Data lane timer configuration */
1377  hdsi->Instance->DLTCR &= ~(DSI_DLTCR_MRD_TIME | DSI_DLTCR_LP2HS_TIME | DSI_DLTCR_HS2LP_TIME);
1378  hdsi->Instance->DLTCR |= (PhyTimers->DataLaneMaxReadTime | ((PhyTimers->DataLaneLP2HSTime) << 16U) | ((
1379  PhyTimers->DataLaneHS2LPTime) << 24U));
1380 
1381  /* Configure the wait period to request HS transmission after a stop state */
1382  hdsi->Instance->PCONFR &= ~DSI_PCONFR_SW_TIME;
1383  hdsi->Instance->PCONFR |= ((PhyTimers->StopWaitTime) << 8U);
1384 
1385  /* Process unlocked */
1386  __HAL_UNLOCK(hdsi);
1387 
1388  return HAL_OK;
1389 }
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK

◆ HAL_DSI_ConfigVideoMode()

HAL_StatusTypeDef HAL_DSI_ConfigVideoMode ( DSI_HandleTypeDef hdsi,
DSI_VidCfgTypeDef VidCfg 
)

Select video mode and configure the corresponding parameters.

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
VidCfgpointer to a DSI_VidCfgTypeDef structure that contains the DSI video mode configuration parameters
Return values
HALstatus

Definition at line 1043 of file stm32l4xx_hal_dsi.c.

1044 {
1045  /* Process locked */
1046  __HAL_LOCK(hdsi);
1047 
1048  /* Check the parameters */
1049  assert_param(IS_DSI_COLOR_CODING(VidCfg->ColorCoding));
1050  assert_param(IS_DSI_VIDEO_MODE_TYPE(VidCfg->Mode));
1051  assert_param(IS_DSI_LP_COMMAND(VidCfg->LPCommandEnable));
1052  assert_param(IS_DSI_LP_HFP(VidCfg->LPHorizontalFrontPorchEnable));
1053  assert_param(IS_DSI_LP_HBP(VidCfg->LPHorizontalBackPorchEnable));
1054  assert_param(IS_DSI_LP_VACTIVE(VidCfg->LPVerticalActiveEnable));
1055  assert_param(IS_DSI_LP_VFP(VidCfg->LPVerticalFrontPorchEnable));
1056  assert_param(IS_DSI_LP_VBP(VidCfg->LPVerticalBackPorchEnable));
1057  assert_param(IS_DSI_LP_VSYNC(VidCfg->LPVerticalSyncActiveEnable));
1058  assert_param(IS_DSI_FBTAA(VidCfg->FrameBTAAcknowledgeEnable));
1059  assert_param(IS_DSI_DE_POLARITY(VidCfg->DEPolarity));
1060  assert_param(IS_DSI_VSYNC_POLARITY(VidCfg->VSPolarity));
1061  assert_param(IS_DSI_HSYNC_POLARITY(VidCfg->HSPolarity));
1062  /* Check the LooselyPacked variant only in 18-bit mode */
1063  if (VidCfg->ColorCoding == DSI_RGB666)
1064  {
1065  assert_param(IS_DSI_LOOSELY_PACKED(VidCfg->LooselyPacked));
1066  }
1067 
1068  /* Select video mode by resetting CMDM and DSIM bits */
1069  hdsi->Instance->MCR &= ~DSI_MCR_CMDM;
1070  hdsi->Instance->WCFGR &= ~DSI_WCFGR_DSIM;
1071 
1072  /* Configure the video mode transmission type */
1073  hdsi->Instance->VMCR &= ~DSI_VMCR_VMT;
1074  hdsi->Instance->VMCR |= VidCfg->Mode;
1075 
1076  /* Configure the video packet size */
1077  hdsi->Instance->VPCR &= ~DSI_VPCR_VPSIZE;
1078  hdsi->Instance->VPCR |= VidCfg->PacketSize;
1079 
1080  /* Set the chunks number to be transmitted through the DSI link */
1081  hdsi->Instance->VCCR &= ~DSI_VCCR_NUMC;
1082  hdsi->Instance->VCCR |= VidCfg->NumberOfChunks;
1083 
1084  /* Set the size of the null packet */
1085  hdsi->Instance->VNPCR &= ~DSI_VNPCR_NPSIZE;
1086  hdsi->Instance->VNPCR |= VidCfg->NullPacketSize;
1087 
1088  /* Select the virtual channel for the LTDC interface traffic */
1089  hdsi->Instance->LVCIDR &= ~DSI_LVCIDR_VCID;
1090  hdsi->Instance->LVCIDR |= VidCfg->VirtualChannelID;
1091 
1092  /* Configure the polarity of control signals */
1093  hdsi->Instance->LPCR &= ~(DSI_LPCR_DEP | DSI_LPCR_VSP | DSI_LPCR_HSP);
1094  hdsi->Instance->LPCR |= (VidCfg->DEPolarity | VidCfg->VSPolarity | VidCfg->HSPolarity);
1095 
1096  /* Select the color coding for the host */
1097  hdsi->Instance->LCOLCR &= ~DSI_LCOLCR_COLC;
1098  hdsi->Instance->LCOLCR |= VidCfg->ColorCoding;
1099 
1100  /* Select the color coding for the wrapper */
1101  hdsi->Instance->WCFGR &= ~DSI_WCFGR_COLMUX;
1102  hdsi->Instance->WCFGR |= ((VidCfg->ColorCoding) << 1U);
1103 
1104  /* Enable/disable the loosely packed variant to 18-bit configuration */
1105  if (VidCfg->ColorCoding == DSI_RGB666)
1106  {
1107  hdsi->Instance->LCOLCR &= ~DSI_LCOLCR_LPE;
1108  hdsi->Instance->LCOLCR |= VidCfg->LooselyPacked;
1109  }
1110 
1111  /* Set the Horizontal Synchronization Active (HSA) in lane byte clock cycles */
1112  hdsi->Instance->VHSACR &= ~DSI_VHSACR_HSA;
1113  hdsi->Instance->VHSACR |= VidCfg->HorizontalSyncActive;
1114 
1115  /* Set the Horizontal Back Porch (HBP) in lane byte clock cycles */
1116  hdsi->Instance->VHBPCR &= ~DSI_VHBPCR_HBP;
1117  hdsi->Instance->VHBPCR |= VidCfg->HorizontalBackPorch;
1118 
1119  /* Set the total line time (HLINE=HSA+HBP+HACT+HFP) in lane byte clock cycles */
1120  hdsi->Instance->VLCR &= ~DSI_VLCR_HLINE;
1121  hdsi->Instance->VLCR |= VidCfg->HorizontalLine;
1122 
1123  /* Set the Vertical Synchronization Active (VSA) */
1124  hdsi->Instance->VVSACR &= ~DSI_VVSACR_VSA;
1125  hdsi->Instance->VVSACR |= VidCfg->VerticalSyncActive;
1126 
1127  /* Set the Vertical Back Porch (VBP)*/
1128  hdsi->Instance->VVBPCR &= ~DSI_VVBPCR_VBP;
1129  hdsi->Instance->VVBPCR |= VidCfg->VerticalBackPorch;
1130 
1131  /* Set the Vertical Front Porch (VFP)*/
1132  hdsi->Instance->VVFPCR &= ~DSI_VVFPCR_VFP;
1133  hdsi->Instance->VVFPCR |= VidCfg->VerticalFrontPorch;
1134 
1135  /* Set the Vertical Active period*/
1136  hdsi->Instance->VVACR &= ~DSI_VVACR_VA;
1137  hdsi->Instance->VVACR |= VidCfg->VerticalActive;
1138 
1139  /* Configure the command transmission mode */
1140  hdsi->Instance->VMCR &= ~DSI_VMCR_LPCE;
1141  hdsi->Instance->VMCR |= VidCfg->LPCommandEnable;
1142 
1143  /* Low power largest packet size */
1144  hdsi->Instance->LPMCR &= ~DSI_LPMCR_LPSIZE;
1145  hdsi->Instance->LPMCR |= ((VidCfg->LPLargestPacketSize) << 16U);
1146 
1147  /* Low power VACT largest packet size */
1148  hdsi->Instance->LPMCR &= ~DSI_LPMCR_VLPSIZE;
1149  hdsi->Instance->LPMCR |= VidCfg->LPVACTLargestPacketSize;
1150 
1151  /* Enable LP transition in HFP period */
1152  hdsi->Instance->VMCR &= ~DSI_VMCR_LPHFPE;
1153  hdsi->Instance->VMCR |= VidCfg->LPHorizontalFrontPorchEnable;
1154 
1155  /* Enable LP transition in HBP period */
1156  hdsi->Instance->VMCR &= ~DSI_VMCR_LPHBPE;
1157  hdsi->Instance->VMCR |= VidCfg->LPHorizontalBackPorchEnable;
1158 
1159  /* Enable LP transition in VACT period */
1160  hdsi->Instance->VMCR &= ~DSI_VMCR_LPVAE;
1161  hdsi->Instance->VMCR |= VidCfg->LPVerticalActiveEnable;
1162 
1163  /* Enable LP transition in VFP period */
1164  hdsi->Instance->VMCR &= ~DSI_VMCR_LPVFPE;
1165  hdsi->Instance->VMCR |= VidCfg->LPVerticalFrontPorchEnable;
1166 
1167  /* Enable LP transition in VBP period */
1168  hdsi->Instance->VMCR &= ~DSI_VMCR_LPVBPE;
1169  hdsi->Instance->VMCR |= VidCfg->LPVerticalBackPorchEnable;
1170 
1171  /* Enable LP transition in vertical sync period */
1172  hdsi->Instance->VMCR &= ~DSI_VMCR_LPVSAE;
1173  hdsi->Instance->VMCR |= VidCfg->LPVerticalSyncActiveEnable;
1174 
1175  /* Enable the request for an acknowledge response at the end of a frame */
1176  hdsi->Instance->VMCR &= ~DSI_VMCR_FBTAAE;
1177  hdsi->Instance->VMCR |= VidCfg->FrameBTAAcknowledgeEnable;
1178 
1179  /* Process unlocked */
1180  __HAL_UNLOCK(hdsi);
1181 
1182  return HAL_OK;
1183 }
uint32_t LPVerticalFrontPorchEnable
uint32_t FrameBTAAcknowledgeEnable
uint32_t LPHorizontalBackPorchEnable
__HAL_UNLOCK(hrtc)
uint32_t LPHorizontalFrontPorchEnable
__HAL_LOCK(hrtc)
return HAL_OK
uint32_t LPVACTLargestPacketSize
uint32_t LPVerticalBackPorchEnable
uint32_t LPVerticalSyncActiveEnable
uint32_t LPVerticalActiveEnable
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DSI_EnterULPM()

HAL_StatusTypeDef HAL_DSI_EnterULPM ( DSI_HandleTypeDef hdsi)

Enter the ULPM (Ultra Low Power Mode) with the D-PHY PLL turned off (both data and clock lanes are in ULPM)

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
Return values
HALstatus

Definition at line 1932 of file stm32l4xx_hal_dsi.c.

1933 {
1934  uint32_t tickstart;
1935 
1936  /* Process locked */
1937  __HAL_LOCK(hdsi);
1938 
1939  /* Clock lane configuration: no more HS request */
1940  hdsi->Instance->CLCR &= ~DSI_CLCR_DPCC;
1941 
1942  /* Use system PLL as byte lane clock source before stopping DSIPHY clock source */
1943  __HAL_RCC_DSI_CONFIG(RCC_DSICLKSOURCE_PLLSAI2);
1944 
1945  /* ULPS Request on Clock and Data Lanes */
1946  hdsi->Instance->PUCR |= (DSI_PUCR_URCL | DSI_PUCR_URDL);
1947 
1948  /* Get tick */
1949  tickstart = HAL_GetTick();
1950 
1951  /* Wait until all active lanes exit ULPM */
1952  if ((hdsi->Instance->PCONFR & DSI_PCONFR_NL) == DSI_ONE_DATA_LANE)
1953  {
1954  while ((hdsi->Instance->PSR & (DSI_PSR_UAN0 | DSI_PSR_UANC)) != 0U)
1955  {
1956  /* Check for the Timeout */
1957  if ((HAL_GetTick() - tickstart) > DSI_TIMEOUT_VALUE)
1958  {
1959  /* Process Unlocked */
1960  __HAL_UNLOCK(hdsi);
1961 
1962  return HAL_TIMEOUT;
1963  }
1964  }
1965  }
1966  else if ((hdsi->Instance->PCONFR & DSI_PCONFR_NL) == DSI_TWO_DATA_LANES)
1967  {
1968  while ((hdsi->Instance->PSR & (DSI_PSR_UAN0 | DSI_PSR_UAN1 | DSI_PSR_UANC)) != 0U)
1969  {
1970  /* Check for the Timeout */
1971  if ((HAL_GetTick() - tickstart) > DSI_TIMEOUT_VALUE)
1972  {
1973  /* Process Unlocked */
1974  __HAL_UNLOCK(hdsi);
1975 
1976  return HAL_TIMEOUT;
1977  }
1978  }
1979  }
1980  else
1981  {
1982  /* Process unlocked */
1983  __HAL_UNLOCK(hdsi);
1984 
1985  return HAL_ERROR;
1986  }
1987 
1988  /* Turn off the DSI PLL */
1989  __HAL_DSI_PLL_DISABLE(hdsi);
1990 
1991  /* Process unlocked */
1992  __HAL_UNLOCK(hdsi);
1993 
1994  return HAL_OK;
1995 }
uint32_t HAL_GetTick(void)
Provide a tick value in millisecond.
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK

◆ HAL_DSI_EnterULPMData()

HAL_StatusTypeDef HAL_DSI_EnterULPMData ( DSI_HandleTypeDef hdsi)

Enter the ULPM (Ultra Low Power Mode) with the D-PHY PLL running (only data lanes are in ULPM)

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
Return values
HALstatus

Definition at line 1800 of file stm32l4xx_hal_dsi.c.

1801 {
1802  uint32_t tickstart;
1803 
1804  /* Process locked */
1805  __HAL_LOCK(hdsi);
1806 
1807  /* ULPS Request on Data Lanes */
1808  hdsi->Instance->PUCR |= DSI_PUCR_URDL;
1809 
1810  /* Get tick */
1811  tickstart = HAL_GetTick();
1812 
1813  /* Wait until the D-PHY active lanes enter into ULPM */
1814  if ((hdsi->Instance->PCONFR & DSI_PCONFR_NL) == DSI_ONE_DATA_LANE)
1815  {
1816  while ((hdsi->Instance->PSR & DSI_PSR_UAN0) != 0U)
1817  {
1818  /* Check for the Timeout */
1819  if ((HAL_GetTick() - tickstart) > DSI_TIMEOUT_VALUE)
1820  {
1821  /* Process Unlocked */
1822  __HAL_UNLOCK(hdsi);
1823 
1824  return HAL_TIMEOUT;
1825  }
1826  }
1827  }
1828  else if ((hdsi->Instance->PCONFR & DSI_PCONFR_NL) == DSI_TWO_DATA_LANES)
1829  {
1830  while ((hdsi->Instance->PSR & (DSI_PSR_UAN0 | DSI_PSR_UAN1)) != 0U)
1831  {
1832  /* Check for the Timeout */
1833  if ((HAL_GetTick() - tickstart) > DSI_TIMEOUT_VALUE)
1834  {
1835  /* Process Unlocked */
1836  __HAL_UNLOCK(hdsi);
1837 
1838  return HAL_TIMEOUT;
1839  }
1840  }
1841  }
1842  else
1843  {
1844  /* Process unlocked */
1845  __HAL_UNLOCK(hdsi);
1846 
1847  return HAL_ERROR;
1848  }
1849 
1850  /* Process unlocked */
1851  __HAL_UNLOCK(hdsi);
1852 
1853  return HAL_OK;
1854 }
uint32_t HAL_GetTick(void)
Provide a tick value in millisecond.
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK

◆ HAL_DSI_ExitULPM()

HAL_StatusTypeDef HAL_DSI_ExitULPM ( DSI_HandleTypeDef hdsi)

Exit the ULPM (Ultra Low Power Mode) with the D-PHY PLL turned off (both data and clock lanes are in ULPM)

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
Return values
HALstatus

Definition at line 2004 of file stm32l4xx_hal_dsi.c.

2005 {
2006  uint32_t tickstart;
2007 
2008  /* Process locked */
2009  __HAL_LOCK(hdsi);
2010 
2011  /* Turn on the DSI PLL */
2012  __HAL_DSI_PLL_ENABLE(hdsi);
2013 
2014  /* Get tick */
2015  tickstart = HAL_GetTick();
2016 
2017  /* Wait for the lock of the PLL */
2018  while (__HAL_DSI_GET_FLAG(hdsi, DSI_FLAG_PLLLS) == 0U)
2019  {
2020  /* Check for the Timeout */
2021  if ((HAL_GetTick() - tickstart) > DSI_TIMEOUT_VALUE)
2022  {
2023  /* Process Unlocked */
2024  __HAL_UNLOCK(hdsi);
2025 
2026  return HAL_TIMEOUT;
2027  }
2028  }
2029 
2030  /* Exit ULPS on Clock and Data Lanes */
2031  hdsi->Instance->PUCR |= (DSI_PUCR_UECL | DSI_PUCR_UEDL);
2032 
2033  /* Get tick */
2034  tickstart = HAL_GetTick();
2035 
2036  /* Wait until all active lanes exit ULPM */
2037  if ((hdsi->Instance->PCONFR & DSI_PCONFR_NL) == DSI_ONE_DATA_LANE)
2038  {
2039  while ((hdsi->Instance->PSR & (DSI_PSR_UAN0 | DSI_PSR_UANC)) != (DSI_PSR_UAN0 | DSI_PSR_UANC))
2040  {
2041  /* Check for the Timeout */
2042  if ((HAL_GetTick() - tickstart) > DSI_TIMEOUT_VALUE)
2043  {
2044  /* Process Unlocked */
2045  __HAL_UNLOCK(hdsi);
2046 
2047  return HAL_TIMEOUT;
2048  }
2049  }
2050  }
2051  else if ((hdsi->Instance->PCONFR & DSI_PCONFR_NL) == DSI_TWO_DATA_LANES)
2052  {
2053  while ((hdsi->Instance->PSR & (DSI_PSR_UAN0 | DSI_PSR_UAN1 | DSI_PSR_UANC)) != (DSI_PSR_UAN0 | DSI_PSR_UAN1 |
2054  DSI_PSR_UANC))
2055  {
2056  /* Check for the Timeout */
2057  if ((HAL_GetTick() - tickstart) > DSI_TIMEOUT_VALUE)
2058  {
2059  /* Process Unlocked */
2060  __HAL_UNLOCK(hdsi);
2061 
2062  return HAL_TIMEOUT;
2063  }
2064  }
2065  }
2066  else
2067  {
2068  /* Process unlocked */
2069  __HAL_UNLOCK(hdsi);
2070 
2071  return HAL_ERROR;
2072  }
2073 
2074  /* wait for 1 ms */
2075  HAL_Delay(1U);
2076 
2077  /* De-assert the ULPM requests and the ULPM exit bits */
2078  hdsi->Instance->PUCR = 0U;
2079 
2080  /* Switch the lanbyteclock source in the RCC from system PLL to D-PHY */
2081  __HAL_RCC_DSI_CONFIG(RCC_DSICLKSOURCE_DSIPHY);
2082 
2083  /* Restore clock lane configuration to HS */
2084  hdsi->Instance->CLCR |= DSI_CLCR_DPCC;
2085 
2086  /* Process unlocked */
2087  __HAL_UNLOCK(hdsi);
2088 
2089  return HAL_OK;
2090 }
void HAL_Delay(uint32_t Delay)
This function provides minimum delay (in milliseconds) based on variable incremented.
uint32_t HAL_GetTick(void)
Provide a tick value in millisecond.
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK

◆ HAL_DSI_ExitULPMData()

HAL_StatusTypeDef HAL_DSI_ExitULPMData ( DSI_HandleTypeDef hdsi)

Exit the ULPM (Ultra Low Power Mode) with the D-PHY PLL running (only data lanes are in ULPM)

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
Return values
HALstatus

Definition at line 1863 of file stm32l4xx_hal_dsi.c.

1864 {
1865  uint32_t tickstart;
1866 
1867  /* Process locked */
1868  __HAL_LOCK(hdsi);
1869 
1870  /* Exit ULPS on Data Lanes */
1871  hdsi->Instance->PUCR |= DSI_PUCR_UEDL;
1872 
1873  /* Get tick */
1874  tickstart = HAL_GetTick();
1875 
1876  /* Wait until all active lanes exit ULPM */
1877  if ((hdsi->Instance->PCONFR & DSI_PCONFR_NL) == DSI_ONE_DATA_LANE)
1878  {
1879  while ((hdsi->Instance->PSR & DSI_PSR_UAN0) != DSI_PSR_UAN0)
1880  {
1881  /* Check for the Timeout */
1882  if ((HAL_GetTick() - tickstart) > DSI_TIMEOUT_VALUE)
1883  {
1884  /* Process Unlocked */
1885  __HAL_UNLOCK(hdsi);
1886 
1887  return HAL_TIMEOUT;
1888  }
1889  }
1890  }
1891  else if ((hdsi->Instance->PCONFR & DSI_PCONFR_NL) == DSI_TWO_DATA_LANES)
1892  {
1893  while ((hdsi->Instance->PSR & (DSI_PSR_UAN0 | DSI_PSR_UAN1)) != (DSI_PSR_UAN0 | DSI_PSR_UAN1))
1894  {
1895  /* Check for the Timeout */
1896  if ((HAL_GetTick() - tickstart) > DSI_TIMEOUT_VALUE)
1897  {
1898  /* Process Unlocked */
1899  __HAL_UNLOCK(hdsi);
1900 
1901  return HAL_TIMEOUT;
1902  }
1903  }
1904  }
1905  else
1906  {
1907  /* Process unlocked */
1908  __HAL_UNLOCK(hdsi);
1909 
1910  return HAL_ERROR;
1911  }
1912 
1913  /* wait for 1 ms*/
1914  HAL_Delay(1U);
1915 
1916  /* De-assert the ULPM requests and the ULPM exit bits */
1917  hdsi->Instance->PUCR = 0U;
1918 
1919  /* Process unlocked */
1920  __HAL_UNLOCK(hdsi);
1921 
1922  return HAL_OK;
1923 }
void HAL_Delay(uint32_t Delay)
This function provides minimum delay (in milliseconds) based on variable incremented.
uint32_t HAL_GetTick(void)
Provide a tick value in millisecond.
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK

◆ HAL_DSI_ForceDataLanesInRX()

HAL_StatusTypeDef HAL_DSI_ForceDataLanesInRX ( DSI_HandleTypeDef hdsi,
FunctionalState  State 
)

Force Data Lanes in RX Mode after a BTA.

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
StateENABLE or DISABLE
Return values
HALstatus

Definition at line 2600 of file stm32l4xx_hal_dsi.c.

2601 {
2602  /* Process locked */
2603  __HAL_LOCK(hdsi);
2604 
2605  /* Check function parameters */
2606  assert_param(IS_FUNCTIONAL_STATE(State));
2607 
2608  /* Force Data Lanes in RX Mode */
2609  hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_TDDL;
2610  hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 16U);
2611 
2612  /* Process unlocked */
2613  __HAL_UNLOCK(hdsi);
2614 
2615  return HAL_OK;
2616 }
hrtc State
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DSI_ForceRXLowPower()

HAL_StatusTypeDef HAL_DSI_ForceRXLowPower ( DSI_HandleTypeDef hdsi,
FunctionalState  State 
)

Force LP Receiver in Low-Power Mode.

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
StateENABLE or DISABLE
Return values
HALstatus

Definition at line 2575 of file stm32l4xx_hal_dsi.c.

2576 {
2577  /* Process locked */
2578  __HAL_LOCK(hdsi);
2579 
2580  /* Check function parameters */
2581  assert_param(IS_FUNCTIONAL_STATE(State));
2582 
2583  /* Force/Unforce LP Receiver in Low-Power Mode */
2584  hdsi->Instance->WPCR[1U] &= ~DSI_WPCR1_FLPRXLPM;
2585  hdsi->Instance->WPCR[1U] |= ((uint32_t)State << 22U);
2586 
2587  /* Process unlocked */
2588  __HAL_UNLOCK(hdsi);
2589 
2590  return HAL_OK;
2591 }
hrtc State
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DSI_ForceTXStopMode()

HAL_StatusTypeDef HAL_DSI_ForceTXStopMode ( DSI_HandleTypeDef hdsi,
uint32_t  Lane,
FunctionalState  State 
)

Force the Clock/Data Lane in TX Stop Mode.

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
Laneselect between clock or data lanes. This parameter can be any value of
  • DSI_Lane_Group
StateENABLE or DISABLE
Return values
HALstatus

Definition at line 2533 of file stm32l4xx_hal_dsi.c.

2534 {
2535  /* Process locked */
2536  __HAL_LOCK(hdsi);
2537 
2538  /* Check function parameters */
2539  assert_param(IS_DSI_LANE_GROUP(Lane));
2540  assert_param(IS_FUNCTIONAL_STATE(State));
2541 
2542  if (Lane == DSI_CLOCK_LANE)
2543  {
2544  /* Force/Unforce the Clock Lane in TX Stop Mode */
2545  hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_FTXSMCL;
2546  hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 12U);
2547  }
2548  else if (Lane == DSI_DATA_LANES)
2549  {
2550  /* Force/Unforce the Data Lanes in TX Stop Mode */
2551  hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_FTXSMDL;
2552  hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 13U);
2553  }
2554  else
2555  {
2556  /* Process unlocked */
2557  __HAL_UNLOCK(hdsi);
2558 
2559  return HAL_ERROR;
2560  }
2561 
2562  /* Process unlocked */
2563  __HAL_UNLOCK(hdsi);
2564 
2565  return HAL_OK;
2566 }
hrtc State
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DSI_LongWrite()

HAL_StatusTypeDef HAL_DSI_LongWrite ( DSI_HandleTypeDef hdsi,
uint32_t  ChannelID,
uint32_t  Mode,
uint32_t  NbParams,
uint32_t  Param1,
uint8_t *  ParametersTable 
)

write long DCS or long Generic command

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
ChannelIDVirtual channel ID.
ModeDSI long packet data type. This parameter can be any value of
  • DSI_LONG_WRITE_PKT_Data_Type.
NbParamsNumber of parameters.
Param1DSC command or first generic parameter. This parameter can be any value of
  • DSI_DCS_Command or a generic command code
ParametersTablePointer to parameter values table.
Return values
HALstatus

Definition at line 1612 of file stm32l4xx_hal_dsi.c.

1618 {
1619  uint32_t uicounter, nbBytes, count;
1620  uint32_t tickstart;
1621  uint32_t fifoword;
1622  uint8_t *pparams = ParametersTable;
1623 
1624  /* Process locked */
1625  __HAL_LOCK(hdsi);
1626 
1627  /* Check the parameters */
1628  assert_param(IS_DSI_LONG_WRITE_PACKET_TYPE(Mode));
1629 
1630  /* Get tick */
1631  tickstart = HAL_GetTick();
1632 
1633  /* Wait for Command FIFO Empty */
1634  while ((hdsi->Instance->GPSR & DSI_GPSR_CMDFE) == 0U)
1635  {
1636  /* Check for the Timeout */
1637  if ((HAL_GetTick() - tickstart) > DSI_TIMEOUT_VALUE)
1638  {
1639  /* Process Unlocked */
1640  __HAL_UNLOCK(hdsi);
1641 
1642  return HAL_TIMEOUT;
1643  }
1644  }
1645 
1646  /* Set the DCS code on payload byte 1, and the other parameters on the write FIFO command*/
1647  fifoword = Param1;
1648  nbBytes = (NbParams < 3U) ? NbParams : 3U;
1649 
1650  for (count = 0U; count < nbBytes; count++)
1651  {
1652  fifoword |= (((uint32_t)(*(pparams + count))) << (8U + (8U * count)));
1653  }
1654  hdsi->Instance->GPDR = fifoword;
1655 
1656  uicounter = NbParams - nbBytes;
1657  pparams += nbBytes;
1658  /* Set the Next parameters on the write FIFO command*/
1659  while (uicounter != 0U)
1660  {
1661  nbBytes = (uicounter < 4U) ? uicounter : 4U;
1662  fifoword = 0U;
1663  for (count = 0U; count < nbBytes; count++)
1664  {
1665  fifoword |= (((uint32_t)(*(pparams + count))) << (8U * count));
1666  }
1667  hdsi->Instance->GPDR = fifoword;
1668 
1669  uicounter -= nbBytes;
1670  pparams += nbBytes;
1671  }
1672 
1673  /* Configure the packet to send a long DCS command */
1674  DSI_ConfigPacketHeader(hdsi->Instance,
1675  ChannelID,
1676  Mode,
1677  ((NbParams + 1U) & 0x00FFU),
1678  (((NbParams + 1U) & 0xFF00U) >> 8U));
1679 
1680  /* Process unlocked */
1681  __HAL_UNLOCK(hdsi);
1682 
1683  return HAL_OK;
1684 }
uint32_t HAL_GetTick(void)
Provide a tick value in millisecond.
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK
static void DSI_ConfigPacketHeader(DSI_TypeDef *DSIx, uint32_t ChannelID, uint32_t DataType, uint32_t Data0, uint32_t Data1)
Generic DSI packet header configuration.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DSI_PatternGeneratorStart()

HAL_StatusTypeDef HAL_DSI_PatternGeneratorStart ( DSI_HandleTypeDef hdsi,
uint32_t  Mode,
uint32_t  Orientation 
)

Start test pattern generation.

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
ModePattern generator mode This parameter can be one of the following values: 0 : Color bars (horizontal or vertical) 1 : BER pattern (vertical only)
OrientationPattern generator orientation This parameter can be one of the following values: 0 : Vertical color bars 1 : Horizontal color bars
Return values
HALstatus

Definition at line 2106 of file stm32l4xx_hal_dsi.c.

2107 {
2108  /* Process locked */
2109  __HAL_LOCK(hdsi);
2110 
2111  /* Configure pattern generator mode and orientation */
2112  hdsi->Instance->VMCR &= ~(DSI_VMCR_PGM | DSI_VMCR_PGO);
2113  hdsi->Instance->VMCR |= ((Mode << 20U) | (Orientation << 24U));
2114 
2115  /* Enable pattern generator by setting PGE bit */
2116  hdsi->Instance->VMCR |= DSI_VMCR_PGE;
2117 
2118  /* Process unlocked */
2119  __HAL_UNLOCK(hdsi);
2120 
2121  return HAL_OK;
2122 }
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK

◆ HAL_DSI_PatternGeneratorStop()

HAL_StatusTypeDef HAL_DSI_PatternGeneratorStop ( DSI_HandleTypeDef hdsi)

Stop test pattern generation.

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
Return values
HALstatus

Definition at line 2130 of file stm32l4xx_hal_dsi.c.

2131 {
2132  /* Process locked */
2133  __HAL_LOCK(hdsi);
2134 
2135  /* Disable pattern generator by clearing PGE bit */
2136  hdsi->Instance->VMCR &= ~DSI_VMCR_PGE;
2137 
2138  /* Process unlocked */
2139  __HAL_UNLOCK(hdsi);
2140 
2141  return HAL_OK;
2142 }
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK

◆ HAL_DSI_Read()

HAL_StatusTypeDef HAL_DSI_Read ( DSI_HandleTypeDef hdsi,
uint32_t  ChannelNbr,
uint8_t *  Array,
uint32_t  Size,
uint32_t  Mode,
uint32_t  DCSCmd,
uint8_t *  ParametersTable 
)

Read command (DCS or generic)

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
ChannelNbrVirtual channel ID
Arraypointer to a buffer to store the payload of a read back operation.
SizeData size to be read (in byte).
ModeDSI read packet data type. This parameter can be any value of
  • DSI_SHORT_READ_PKT_Data_Type.
DCSCmdDCS get/read command.
ParametersTablePointer to parameter values table.
Return values
HALstatus

Definition at line 1699 of file stm32l4xx_hal_dsi.c.

1706 {
1707  uint32_t tickstart;
1708  uint8_t *pdata = Array;
1709  uint32_t datasize = Size;
1710  uint32_t fifoword;
1711  uint32_t nbbytes;
1712  uint32_t count;
1713 
1714  /* Process locked */
1715  __HAL_LOCK(hdsi);
1716 
1717  /* Check the parameters */
1718  assert_param(IS_DSI_READ_PACKET_TYPE(Mode));
1719 
1720  if (datasize > 2U)
1721  {
1722  /* set max return packet size */
1723  if (DSI_ShortWrite(hdsi, ChannelNbr, DSI_MAX_RETURN_PKT_SIZE, ((datasize) & 0xFFU),
1724  (((datasize) >> 8U) & 0xFFU)) != HAL_OK)
1725  {
1726  /* Process Unlocked */
1727  __HAL_UNLOCK(hdsi);
1728 
1729  return HAL_ERROR;
1730  }
1731  }
1732 
1733  /* Configure the packet to read command */
1734  if (Mode == DSI_DCS_SHORT_PKT_READ)
1735  {
1736  DSI_ConfigPacketHeader(hdsi->Instance, ChannelNbr, Mode, DCSCmd, 0U);
1737  }
1738  else if (Mode == DSI_GEN_SHORT_PKT_READ_P0)
1739  {
1740  DSI_ConfigPacketHeader(hdsi->Instance, ChannelNbr, Mode, 0U, 0U);
1741  }
1742  else if (Mode == DSI_GEN_SHORT_PKT_READ_P1)
1743  {
1744  DSI_ConfigPacketHeader(hdsi->Instance, ChannelNbr, Mode, ParametersTable[0U], 0U);
1745  }
1746  else if (Mode == DSI_GEN_SHORT_PKT_READ_P2)
1747  {
1748  DSI_ConfigPacketHeader(hdsi->Instance, ChannelNbr, Mode, ParametersTable[0U], ParametersTable[1U]);
1749  }
1750  else
1751  {
1752  /* Process Unlocked */
1753  __HAL_UNLOCK(hdsi);
1754 
1755  return HAL_ERROR;
1756  }
1757 
1758  /* Get tick */
1759  tickstart = HAL_GetTick();
1760 
1761  /* If DSI fifo is not empty, read requested bytes */
1762  while (((int32_t)(datasize)) > 0)
1763  {
1764  if ((hdsi->Instance->GPSR & DSI_GPSR_PRDFE) == 0U)
1765  {
1766  fifoword = hdsi->Instance->GPDR;
1767  nbbytes = (datasize < 4U) ? datasize : 4U;
1768 
1769  for (count = 0U; count < nbbytes; count++)
1770  {
1771  *pdata = (uint8_t)(fifoword >> (8U * count));
1772  pdata++;
1773  datasize--;
1774  }
1775  }
1776 
1777  /* Check for the Timeout */
1778  if ((HAL_GetTick() - tickstart) > DSI_TIMEOUT_VALUE)
1779  {
1780  /* Process Unlocked */
1781  __HAL_UNLOCK(hdsi);
1782 
1783  return HAL_TIMEOUT;
1784  }
1785  }
1786 
1787  /* Process unlocked */
1788  __HAL_UNLOCK(hdsi);
1789 
1790  return HAL_OK;
1791 }
uint32_t HAL_GetTick(void)
Provide a tick value in millisecond.
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK
static void DSI_ConfigPacketHeader(DSI_TypeDef *DSIx, uint32_t ChannelID, uint32_t DataType, uint32_t Data0, uint32_t Data1)
Generic DSI packet header configuration.
static HAL_StatusTypeDef DSI_ShortWrite(DSI_HandleTypeDef *hdsi, uint32_t ChannelID, uint32_t Mode, uint32_t Param1, uint32_t Param2)
write short DCS or short Generic command
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DSI_Refresh()

HAL_StatusTypeDef HAL_DSI_Refresh ( DSI_HandleTypeDef hdsi)

Refresh the display in command mode.

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
Return values
HALstatus

Definition at line 1498 of file stm32l4xx_hal_dsi.c.

1499 {
1500  /* Process locked */
1501  __HAL_LOCK(hdsi);
1502 
1503  /* Update the display */
1504  hdsi->Instance->WCR |= DSI_WCR_LTDCEN;
1505 
1506  /* Process unlocked */
1507  __HAL_UNLOCK(hdsi);
1508 
1509  return HAL_OK;
1510 }
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK

◆ HAL_DSI_SetContentionDetectionOff()

HAL_StatusTypeDef HAL_DSI_SetContentionDetectionOff ( DSI_HandleTypeDef hdsi,
FunctionalState  State 
)

Switch off the contention detection on data lanes.

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
StateENABLE or DISABLE
Return values
HALstatus

Definition at line 2650 of file stm32l4xx_hal_dsi.c.

2651 {
2652  /* Process locked */
2653  __HAL_LOCK(hdsi);
2654 
2655  /* Check function parameters */
2656  assert_param(IS_FUNCTIONAL_STATE(State));
2657 
2658  /* Contention Detection on Data Lanes OFF */
2659  hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_CDOFFDL;
2660  hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 14U);
2661 
2662  /* Process unlocked */
2663  __HAL_UNLOCK(hdsi);
2664 
2665  return HAL_OK;
2666 }
hrtc State
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DSI_SetGenericVCID()

HAL_StatusTypeDef HAL_DSI_SetGenericVCID ( DSI_HandleTypeDef hdsi,
uint32_t  VirtualChannelID 
)

Configure the Generic interface read-back Virtual Channel ID.

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
VirtualChannelIDVirtual channel ID
Return values
HALstatus

Definition at line 1020 of file stm32l4xx_hal_dsi.c.

1021 {
1022  /* Process locked */
1023  __HAL_LOCK(hdsi);
1024 
1025  /* Update the GVCID register */
1026  hdsi->Instance->GVCIDR &= ~DSI_GVCIDR_VCID;
1027  hdsi->Instance->GVCIDR |= VirtualChannelID;
1028 
1029  /* Process unlocked */
1030  __HAL_UNLOCK(hdsi);
1031 
1032  return HAL_OK;
1033 }
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK

◆ HAL_DSI_SetLanePinsConfiguration()

HAL_StatusTypeDef HAL_DSI_SetLanePinsConfiguration ( DSI_HandleTypeDef hdsi,
uint32_t  CustomLane,
uint32_t  Lane,
FunctionalState  State 
)

Custom lane pins configuration.

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
CustomLaneFunction to be applyed on selected lane. This parameter can be any value of
  • DSI_CustomLane
Laneselect between clock or data lane 0 or data lane 1. This parameter can be any value of
  • DSI_Lane_Select
StateENABLE or DISABLE
Return values
HALstatus

Definition at line 2299 of file stm32l4xx_hal_dsi.c.

2301 {
2302  /* Process locked */
2303  __HAL_LOCK(hdsi);
2304 
2305  /* Check function parameters */
2306  assert_param(IS_DSI_CUSTOM_LANE(CustomLane));
2307  assert_param(IS_DSI_LANE(Lane));
2308  assert_param(IS_FUNCTIONAL_STATE(State));
2309 
2310  switch (CustomLane)
2311  {
2312  case DSI_SWAP_LANE_PINS:
2313  if (Lane == DSI_CLK_LANE)
2314  {
2315  /* Swap pins on clock lane */
2316  hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_SWCL;
2317  hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 6U);
2318  }
2319  else if (Lane == DSI_DATA_LANE0)
2320  {
2321  /* Swap pins on data lane 0 */
2322  hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_SWDL0;
2323  hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 7U);
2324  }
2325  else if (Lane == DSI_DATA_LANE1)
2326  {
2327  /* Swap pins on data lane 1 */
2328  hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_SWDL1;
2329  hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 8U);
2330  }
2331  else
2332  {
2333  /* Process unlocked */
2334  __HAL_UNLOCK(hdsi);
2335 
2336  return HAL_ERROR;
2337  }
2338  break;
2339  case DSI_INVERT_HS_SIGNAL:
2340  if (Lane == DSI_CLK_LANE)
2341  {
2342  /* Invert HS signal on clock lane */
2343  hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_HSICL;
2344  hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 9U);
2345  }
2346  else if (Lane == DSI_DATA_LANE0)
2347  {
2348  /* Invert HS signal on data lane 0 */
2349  hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_HSIDL0;
2350  hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 10U);
2351  }
2352  else if (Lane == DSI_DATA_LANE1)
2353  {
2354  /* Invert HS signal on data lane 1 */
2355  hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_HSIDL1;
2356  hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 11U);
2357  }
2358  else
2359  {
2360  /* Process unlocked */
2361  __HAL_UNLOCK(hdsi);
2362 
2363  return HAL_ERROR;
2364  }
2365  break;
2366  default:
2367  break;
2368  }
2369 
2370  /* Process unlocked */
2371  __HAL_UNLOCK(hdsi);
2372 
2373  return HAL_OK;
2374 }
hrtc State
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DSI_SetLowPowerRXFilter()

HAL_StatusTypeDef HAL_DSI_SetLowPowerRXFilter ( DSI_HandleTypeDef hdsi,
uint32_t  Frequency 
)

Low-Power Reception Filter Tuning.

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
Frequencycutoff frequency of low-pass filter at the input of LPRX
Return values
HALstatus

Definition at line 2247 of file stm32l4xx_hal_dsi.c.

2248 {
2249  /* Process locked */
2250  __HAL_LOCK(hdsi);
2251 
2252  /* Low-Power RX low-pass Filtering Tuning */
2253  hdsi->Instance->WPCR[1U] &= ~DSI_WPCR1_LPRXFT;
2254  hdsi->Instance->WPCR[1U] |= Frequency << 25U;
2255 
2256  /* Process unlocked */
2257  __HAL_UNLOCK(hdsi);
2258 
2259  return HAL_OK;
2260 }
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK

◆ HAL_DSI_SetPHYTimings()

HAL_StatusTypeDef HAL_DSI_SetPHYTimings ( DSI_HandleTypeDef hdsi,
uint32_t  Timing,
FunctionalState  State,
uint32_t  Value 
)

Set custom timing for the PHY.

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
TimingPHY timing to be adjusted. This parameter can be any value of
  • DSI_PHY_Timing
StateENABLE or DISABLE
ValueCustom value of the timing
Return values
HALstatus

Definition at line 2386 of file stm32l4xx_hal_dsi.c.

2387 {
2388  /* Process locked */
2389  __HAL_LOCK(hdsi);
2390 
2391  /* Check function parameters */
2392  assert_param(IS_DSI_PHY_TIMING(Timing));
2393  assert_param(IS_FUNCTIONAL_STATE(State));
2394 
2395  switch (Timing)
2396  {
2397  case DSI_TCLK_POST:
2398  /* Enable/Disable custom timing setting */
2399  hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_TCLKPOSTEN;
2400  hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 27U);
2401 
2402  if (State != DISABLE)
2403  {
2404  /* Set custom value */
2405  hdsi->Instance->WPCR[4U] &= ~DSI_WPCR4_TCLKPOST;
2406  hdsi->Instance->WPCR[4U] |= Value & DSI_WPCR4_TCLKPOST;
2407  }
2408 
2409  break;
2410  case DSI_TLPX_CLK:
2411  /* Enable/Disable custom timing setting */
2412  hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_TLPXCEN;
2413  hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 26U);
2414 
2415  if (State != DISABLE)
2416  {
2417  /* Set custom value */
2418  hdsi->Instance->WPCR[3U] &= ~DSI_WPCR3_TLPXC;
2419  hdsi->Instance->WPCR[3U] |= (Value << 24U) & DSI_WPCR3_TLPXC;
2420  }
2421 
2422  break;
2423  case DSI_THS_EXIT:
2424  /* Enable/Disable custom timing setting */
2425  hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_THSEXITEN;
2426  hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 25U);
2427 
2428  if (State != DISABLE)
2429  {
2430  /* Set custom value */
2431  hdsi->Instance->WPCR[3U] &= ~DSI_WPCR3_THSEXIT;
2432  hdsi->Instance->WPCR[3U] |= (Value << 16U) & DSI_WPCR3_THSEXIT;
2433  }
2434 
2435  break;
2436  case DSI_TLPX_DATA:
2437  /* Enable/Disable custom timing setting */
2438  hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_TLPXDEN;
2439  hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 24U);
2440 
2441  if (State != DISABLE)
2442  {
2443  /* Set custom value */
2444  hdsi->Instance->WPCR[3U] &= ~DSI_WPCR3_TLPXD;
2445  hdsi->Instance->WPCR[3U] |= (Value << 8U) & DSI_WPCR3_TLPXD;
2446  }
2447 
2448  break;
2449  case DSI_THS_ZERO:
2450  /* Enable/Disable custom timing setting */
2451  hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_THSZEROEN;
2452  hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 23U);
2453 
2454  if (State != DISABLE)
2455  {
2456  /* Set custom value */
2457  hdsi->Instance->WPCR[3U] &= ~DSI_WPCR3_THSZERO;
2458  hdsi->Instance->WPCR[3U] |= Value & DSI_WPCR3_THSZERO;
2459  }
2460 
2461  break;
2462  case DSI_THS_TRAIL:
2463  /* Enable/Disable custom timing setting */
2464  hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_THSTRAILEN;
2465  hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 22U);
2466 
2467  if (State != DISABLE)
2468  {
2469  /* Set custom value */
2470  hdsi->Instance->WPCR[2U] &= ~DSI_WPCR2_THSTRAIL;
2471  hdsi->Instance->WPCR[2U] |= (Value << 24U) & DSI_WPCR2_THSTRAIL;
2472  }
2473 
2474  break;
2475  case DSI_THS_PREPARE:
2476  /* Enable/Disable custom timing setting */
2477  hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_THSPREPEN;
2478  hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 21U);
2479 
2480  if (State != DISABLE)
2481  {
2482  /* Set custom value */
2483  hdsi->Instance->WPCR[2U] &= ~DSI_WPCR2_THSPREP;
2484  hdsi->Instance->WPCR[2U] |= (Value << 16U) & DSI_WPCR2_THSPREP;
2485  }
2486 
2487  break;
2488  case DSI_TCLK_ZERO:
2489  /* Enable/Disable custom timing setting */
2490  hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_TCLKZEROEN;
2491  hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 20U);
2492 
2493  if (State != DISABLE)
2494  {
2495  /* Set custom value */
2496  hdsi->Instance->WPCR[2U] &= ~DSI_WPCR2_TCLKZERO;
2497  hdsi->Instance->WPCR[2U] |= (Value << 8U) & DSI_WPCR2_TCLKZERO;
2498  }
2499 
2500  break;
2501  case DSI_TCLK_PREPARE:
2502  /* Enable/Disable custom timing setting */
2503  hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_TCLKPREPEN;
2504  hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 19U);
2505 
2506  if (State != DISABLE)
2507  {
2508  /* Set custom value */
2509  hdsi->Instance->WPCR[2U] &= ~DSI_WPCR2_TCLKPREP;
2510  hdsi->Instance->WPCR[2U] |= Value & DSI_WPCR2_TCLKPREP;
2511  }
2512 
2513  break;
2514  default:
2515  break;
2516  }
2517 
2518  /* Process unlocked */
2519  __HAL_UNLOCK(hdsi);
2520 
2521  return HAL_OK;
2522 }
hrtc State
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DSI_SetPullDown()

HAL_StatusTypeDef HAL_DSI_SetPullDown ( DSI_HandleTypeDef hdsi,
FunctionalState  State 
)

Enable a pull-down on the lanes to prevent from floating states when unused.

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
StateENABLE or DISABLE
Return values
HALstatus

Definition at line 2625 of file stm32l4xx_hal_dsi.c.

2626 {
2627  /* Process locked */
2628  __HAL_LOCK(hdsi);
2629 
2630  /* Check function parameters */
2631  assert_param(IS_FUNCTIONAL_STATE(State));
2632 
2633  /* Enable/Disable pull-down on lanes */
2634  hdsi->Instance->WPCR[0U] &= ~DSI_WPCR0_PDEN;
2635  hdsi->Instance->WPCR[0U] |= ((uint32_t)State << 18U);
2636 
2637  /* Process unlocked */
2638  __HAL_UNLOCK(hdsi);
2639 
2640  return HAL_OK;
2641 }
hrtc State
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DSI_SetSDD()

HAL_StatusTypeDef HAL_DSI_SetSDD ( DSI_HandleTypeDef hdsi,
FunctionalState  State 
)

Activate an additional current path on all lanes to meet the SDDTx parameter defined in the MIPI D-PHY specification.

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
StateENABLE or DISABLE
Return values
HALstatus

Definition at line 2270 of file stm32l4xx_hal_dsi.c.

2271 {
2272  /* Process locked */
2273  __HAL_LOCK(hdsi);
2274 
2275  /* Check function parameters */
2276  assert_param(IS_FUNCTIONAL_STATE(State));
2277 
2278  /* Activate/Disactivate additional current path on all lanes */
2279  hdsi->Instance->WPCR[1U] &= ~DSI_WPCR1_SDDC;
2280  hdsi->Instance->WPCR[1U] |= ((uint32_t)State << 12U);
2281 
2282  /* Process unlocked */
2283  __HAL_UNLOCK(hdsi);
2284 
2285  return HAL_OK;
2286 }
hrtc State
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DSI_SetSlewRateAndDelayTuning()

HAL_StatusTypeDef HAL_DSI_SetSlewRateAndDelayTuning ( DSI_HandleTypeDef hdsi,
uint32_t  CommDelay,
uint32_t  Lane,
uint32_t  Value 
)

Set Slew-Rate And Delay Tuning.

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
CommDelayCommunication delay to be adjusted. This parameter can be any value of
  • DSI_Communication_Delay
Laneselect between clock or data lanes. This parameter can be any value of
  • DSI_Lane_Group
ValueCustom value of the slew-rate or delay
Return values
HALstatus

Definition at line 2155 of file stm32l4xx_hal_dsi.c.

2157 {
2158  /* Process locked */
2159  __HAL_LOCK(hdsi);
2160 
2161  /* Check function parameters */
2162  assert_param(IS_DSI_COMMUNICATION_DELAY(CommDelay));
2163  assert_param(IS_DSI_LANE_GROUP(Lane));
2164 
2165  switch (CommDelay)
2166  {
2167  case DSI_SLEW_RATE_HSTX:
2168  if (Lane == DSI_CLOCK_LANE)
2169  {
2170  /* High-Speed Transmission Slew Rate Control on Clock Lane */
2171  hdsi->Instance->WPCR[1U] &= ~DSI_WPCR1_HSTXSRCCL;
2172  hdsi->Instance->WPCR[1U] |= Value << 16U;
2173  }
2174  else if (Lane == DSI_DATA_LANES)
2175  {
2176  /* High-Speed Transmission Slew Rate Control on Data Lanes */
2177  hdsi->Instance->WPCR[1U] &= ~DSI_WPCR1_HSTXSRCDL;
2178  hdsi->Instance->WPCR[1U] |= Value << 18U;
2179  }
2180  else
2181  {
2182  /* Process unlocked */
2183  __HAL_UNLOCK(hdsi);
2184 
2185  return HAL_ERROR;
2186  }
2187  break;
2188  case DSI_SLEW_RATE_LPTX:
2189  if (Lane == DSI_CLOCK_LANE)
2190  {
2191  /* Low-Power transmission Slew Rate Compensation on Clock Lane */
2192  hdsi->Instance->WPCR[1U] &= ~DSI_WPCR1_LPSRCCL;
2193  hdsi->Instance->WPCR[1U] |= Value << 6U;
2194  }
2195  else if (Lane == DSI_DATA_LANES)
2196  {
2197  /* Low-Power transmission Slew Rate Compensation on Data Lanes */
2198  hdsi->Instance->WPCR[1U] &= ~DSI_WPCR1_LPSRCDL;
2199  hdsi->Instance->WPCR[1U] |= Value << 8U;
2200  }
2201  else
2202  {
2203  /* Process unlocked */
2204  __HAL_UNLOCK(hdsi);
2205 
2206  return HAL_ERROR;
2207  }
2208  break;
2209  case DSI_HS_DELAY:
2210  if (Lane == DSI_CLOCK_LANE)
2211  {
2212  /* High-Speed Transmission Delay on Clock Lane */
2213  hdsi->Instance->WPCR[1U] &= ~DSI_WPCR1_HSTXDCL;
2214  hdsi->Instance->WPCR[1U] |= Value;
2215  }
2216  else if (Lane == DSI_DATA_LANES)
2217  {
2218  /* High-Speed Transmission Delay on Data Lanes */
2219  hdsi->Instance->WPCR[1U] &= ~DSI_WPCR1_HSTXDDL;
2220  hdsi->Instance->WPCR[1U] |= Value << 2U;
2221  }
2222  else
2223  {
2224  /* Process unlocked */
2225  __HAL_UNLOCK(hdsi);
2226 
2227  return HAL_ERROR;
2228  }
2229  break;
2230  default:
2231  break;
2232  }
2233 
2234  /* Process unlocked */
2235  __HAL_UNLOCK(hdsi);
2236 
2237  return HAL_OK;
2238 }
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DSI_ShortWrite()

HAL_StatusTypeDef HAL_DSI_ShortWrite ( DSI_HandleTypeDef hdsi,
uint32_t  ChannelID,
uint32_t  Mode,
uint32_t  Param1,
uint32_t  Param2 
)

write short DCS or short Generic command

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
ChannelIDVirtual channel ID.
ModeDSI short packet data type. This parameter can be any value of
  • DSI_SHORT_WRITE_PKT_Data_Type.
Param1DSC command or first generic parameter. This parameter can be any value of
  • DSI_DCS_Command or a generic command code.
Param2DSC parameter or second generic parameter.
Return values
HALstatus

Definition at line 1577 of file stm32l4xx_hal_dsi.c.

1582 {
1583  HAL_StatusTypeDef status;
1584  /* Check the parameters */
1585  assert_param(IS_DSI_SHORT_WRITE_PACKET_TYPE(Mode));
1586 
1587  /* Process locked */
1588  __HAL_LOCK(hdsi);
1589 
1590  status = DSI_ShortWrite(hdsi, ChannelID, Mode, Param1, Param2);
1591 
1592  /* Process unlocked */
1593  __HAL_UNLOCK(hdsi);
1594 
1595  return status;
1596 }
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
static HAL_StatusTypeDef DSI_ShortWrite(DSI_HandleTypeDef *hdsi, uint32_t ChannelID, uint32_t Mode, uint32_t Param1, uint32_t Param2)
write short DCS or short Generic command
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DSI_Shutdown()

HAL_StatusTypeDef HAL_DSI_Shutdown ( DSI_HandleTypeDef hdsi,
uint32_t  Shutdown 
)

Control the display shutdown in Video mode.

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
ShutdownShut-down (Display-ON or Display-OFF). This parameter can be any value of
  • DSI_ShutDown
Return values
HALstatus

Definition at line 1546 of file stm32l4xx_hal_dsi.c.

1547 {
1548  /* Process locked */
1549  __HAL_LOCK(hdsi);
1550 
1551  /* Check the parameters */
1552  assert_param(IS_DSI_SHUT_DOWN(Shutdown));
1553 
1554  /* Update the display Shutdown */
1555  hdsi->Instance->WCR &= ~DSI_WCR_SHTDN;
1556  hdsi->Instance->WCR |= Shutdown;
1557 
1558  /* Process unlocked */
1559  __HAL_UNLOCK(hdsi);
1560 
1561  return HAL_OK;
1562 }
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DSI_Start()

HAL_StatusTypeDef HAL_DSI_Start ( DSI_HandleTypeDef hdsi)

Start the DSI module.

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
Return values
HALstatus

Definition at line 1452 of file stm32l4xx_hal_dsi.c.

1453 {
1454  /* Process locked */
1455  __HAL_LOCK(hdsi);
1456 
1457  /* Enable the DSI host */
1458  __HAL_DSI_ENABLE(hdsi);
1459 
1460  /* Enable the DSI wrapper */
1461  __HAL_DSI_WRAPPER_ENABLE(hdsi);
1462 
1463  /* Process unlocked */
1464  __HAL_UNLOCK(hdsi);
1465 
1466  return HAL_OK;
1467 }
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK

◆ HAL_DSI_Stop()

HAL_StatusTypeDef HAL_DSI_Stop ( DSI_HandleTypeDef hdsi)

Stop the DSI module.

Parameters
hdsipointer to a DSI_HandleTypeDef structure that contains the configuration information for the DSI.
Return values
HALstatus

Definition at line 1475 of file stm32l4xx_hal_dsi.c.

1476 {
1477  /* Process locked */
1478  __HAL_LOCK(hdsi);
1479 
1480  /* Disable the DSI host */
1481  __HAL_DSI_DISABLE(hdsi);
1482 
1483  /* Disable the DSI wrapper */
1484  __HAL_DSI_WRAPPER_DISABLE(hdsi);
1485 
1486  /* Process unlocked */
1487  __HAL_UNLOCK(hdsi);
1488 
1489  return HAL_OK;
1490 }
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK