Application/Config/LCDConf_WHT.c
/**
  * @brief  This function is called by the display driver for several purposes.
  *         To support the according task the routine needs to be adapted to
  *         the display controller. Please note that the commands marked with
  *         'optional' are not cogently required and should only be adapted if
  *         the display controller supports these features
  * @param  LayerIndex: Index of layer to be configured 
  * @param  Cmd       :Please refer to the details in the switch statement below
  * @param  pData     :Pointer to a LCD_X_DATA structure
  * @retval Status (-1 : Error,  0 : Ok)
  */
@brief  This function is called by the display driver for several purposes.
To support the according task the routine needs to be adapted to
the display controller.
@brief This function is called by the display driver for several purposes . To support the according task the routine needs to be adapted to the display controller .
int  LCD_X_DisplayDriver(unsigned LayerIndex, unsigned Cmd, void * pData)
{
  int r = 0;
  int addr;
  int xPos, yPos;
  int Color;
  switch (Cmd) 
  {
  case LCD_X_INITCONTROLLER: 
    LCD_LL_LayerInit(LayerIndex);
    break;
  case LCD_X_SETORG: 
    addr = layer_prop[LayerIndex].address + ((LCD_X_SETORG_INFO *)pData)->yPos * layer_prop[LayerIndex].xSize * layer_prop[LayerIndex].BytesPerPixel;
    HAL_LTDC_SetAddress(&hltdc, addr, LayerIndex);
    break;
  case LCD_X_SHOWBUFFER: 
    layer_prop[LayerIndex].pending_buffer = ((LCD_X_SHOWBUFFER_INFO *)pData)->Index;
    break;
  case LCD_X_SETLUTENTRY: 
    HAL_LTDC_ConfigCLUT(&hltdc, (uint32_t *)&(((LCD_X_SETLUTENTRY_INFO *)pData)->Color), 1, LayerIndex);
    break;
  case LCD_X_ON: 
    __HAL_LTDC_ENABLE(&hltdc);
    break;
  case LCD_X_OFF: 
    __HAL_LTDC_DISABLE(&hltdc);
    break;
  case LCD_X_SETVIS:
    if(((LCD_X_SETVIS_INFO *)pData)->OnOff  == ENABLE )
    {
      __HAL_LTDC_LAYER_ENABLE(&hltdc, LayerIndex); 
    }
    else
    {
      __HAL_LTDC_LAYER_DISABLE(&hltdc, LayerIndex); 
    }
    __HAL_LTDC_RELOAD_CONFIG(&hltdc); 
    break;
  case LCD_X_SETPOS: 
    HAL_LTDC_SetWindowPosition(&hltdc, 
                               ((LCD_X_SETPOS_INFO *)pData)->xPos, 
                               ((LCD_X_SETPOS_INFO *)pData)->yPos, 
                               LayerIndex);
    break;
  case LCD_X_SETSIZE:
    GUI_GetLayerPosEx(LayerIndex, &xPos, &yPos);
    layer_prop[LayerIndex].xSize = ((LCD_X_SETSIZE_INFO *)pData)->xSize;
    layer_prop[LayerIndex].ySize = ((LCD_X_SETSIZE_INFO *)pData)->ySize;
    HAL_LTDC_SetWindowPosition(&hltdc, xPos, yPos, LayerIndex);
    break;
  case LCD_X_SETALPHA:
    HAL_LTDC_SetAlpha(&hltdc, ((LCD_X_SETALPHA_INFO *)pData)->Alpha, LayerIndex);
    break;
  case LCD_X_SETCHROMAMODE:
    if(((LCD_X_SETCHROMAMODE_INFO *)pData)->ChromaMode != 0)
    {
      HAL_LTDC_EnableColorKeying(&hltdc, LayerIndex);
    }
    else
    {
      HAL_LTDC_DisableColorKeying(&hltdc, LayerIndex);      
    }
    break;
  case LCD_X_SETCHROMA:
    Color = ((((LCD_X_SETCHROMA_INFO *)pData)->ChromaMin & 0xFF0000) >> 16) |\
             (((LCD_X_SETCHROMA_INFO *)pData)->ChromaMin & 0x00FF00) |\
            ((((LCD_X_SETCHROMA_INFO *)pData)->ChromaMin & 0x0000FF) << 16);
    HAL_LTDC_ConfigColorKeying(&hltdc, Color, LayerIndex);
    break;
  default:
    r = -1;
  }
  return r;
}
int LCD_X_DisplayDriver ( unsigned LayerIndex , unsigned Cmd , void * pData ) { int r = 0 ; int addr ; int xPos , yPos ; int Color ; switch ( Cmd ) { case LCD_X_INITCONTROLLER : LCD_LL_LayerInit ( LayerIndex ) ; break ; case LCD_X_SETORG : addr = layer_prop [ LayerIndex ] . address + ( ( LCD_X_SETORG_INFO * ) pData ) -> yPos * layer_prop [ LayerIndex ] . xSize * layer_prop [ LayerIndex ] . BytesPerPixel ; HAL_LTDC_SetAddress ( & hltdc , addr , LayerIndex ) ; break ; case LCD_X_SHOWBUFFER : layer_prop [ LayerIndex ] . pending_buffer = ( ( LCD_X_SHOWBUFFER_INFO * ) pData ) -> Index ; break ; case LCD_X_SETLUTENTRY : HAL_LTDC_ConfigCLUT ( & hltdc , ( uint32_t * ) & ( ( ( LCD_X_SETLUTENTRY_INFO * ) pData ) -> Color ) , 1 , LayerIndex ) ; break ; case LCD_X_ON : __HAL_LTDC_ENABLE ( & hltdc ) ; break ; case LCD_X_OFF : __HAL_LTDC_DISABLE ( & hltdc ) ; break ; case LCD_X_SETVIS : if ( ( ( LCD_X_SETVIS_INFO * ) pData ) -> OnOff == ENABLE ) { __HAL_LTDC_LAYER_ENABLE ( & hltdc , LayerIndex ) ; } else { __HAL_LTDC_LAYER_DISABLE ( & hltdc , LayerIndex ) ; } __HAL_LTDC_RELOAD_CONFIG ( & hltdc ) ; break ; case LCD_X_SETPOS : HAL_LTDC_SetWindowPosition ( & hltdc , ( ( LCD_X_SETPOS_INFO * ) pData ) -> xPos , ( ( LCD_X_SETPOS_INFO * ) pData ) -> yPos , LayerIndex ) ; break ; case LCD_X_SETSIZE : GUI_GetLayerPosEx ( LayerIndex , & xPos , & yPos ) ; layer_prop [ LayerIndex ] . xSize = ( ( LCD_X_SETSIZE_INFO * ) pData ) -> xSize ; layer_prop [ LayerIndex ] . ySize = ( ( LCD_X_SETSIZE_INFO * ) pData ) -> ySize ; HAL_LTDC_SetWindowPosition ( & hltdc , xPos , yPos , LayerIndex ) ; break ; case LCD_X_SETALPHA : HAL_LTDC_SetAlpha ( & hltdc , ( ( LCD_X_SETALPHA_INFO * ) pData ) -> Alpha , LayerIndex ) ; break ; case LCD_X_SETCHROMAMODE : if ( ( ( LCD_X_SETCHROMAMODE_INFO * ) pData ) -> ChromaMode != 0 ) { HAL_LTDC_EnableColorKeying ( & hltdc , LayerIndex ) ; } else { HAL_LTDC_DisableColorKeying ( & hltdc , LayerIndex ) ; } break ; case LCD_X_SETCHROMA : Color = ( ( ( ( LCD_X_SETCHROMA_INFO * ) pData ) -> ChromaMin & 0xFF0000 ) >> 16 ) | ( ( ( LCD_X_SETCHROMA_INFO * ) pData ) -> ChromaMin & 0x00FF00 ) | ( ( ( ( LCD_X_SETCHROMA_INFO * ) pData ) -> ChromaMin & 0x0000FF ) << 16 ) ; HAL_LTDC_ConfigColorKeying ( & hltdc , Color , LayerIndex ) ; break ; default : r = -1 ; } return r ; }
@brief  This function is called by the display driver for several purposes.
@brief This function is called by the display driver for several purposes .