STM32746G-Discovery board drivers V1.0.0

Dependents:   DISCO-F746NG_LCDTS_CC3000_NTP DISCO-F746NG_ROPE_WIFI F746_SpectralAnalysis_NoPhoto ecte433 ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers stm32746g_discovery_lcd.h Source File

stm32746g_discovery_lcd.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32746g_discovery_lcd.h
00004   * @author  MCD Application Team
00005   * @brief   This file contains the common defines and functions prototypes for
00006   *          the stm32746g_discovery_lcd.c driver.
00007   ******************************************************************************
00008   * @attention
00009   *
00010   * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
00011   *
00012   * Redistribution and use in source and binary forms, with or without modification,
00013   * are permitted provided that the following conditions are met:
00014   *   1. Redistributions of source code must retain the above copyright notice,
00015   *      this list of conditions and the following disclaimer.
00016   *   2. Redistributions in binary form must reproduce the above copyright notice,
00017   *      this list of conditions and the following disclaimer in the documentation
00018   *      and/or other materials provided with the distribution.
00019   *   3. Neither the name of STMicroelectronics nor the names of its contributors
00020   *      may be used to endorse or promote products derived from this software
00021   *      without specific prior written permission.
00022   *
00023   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00024   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00025   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00026   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00027   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00028   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00029   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00030   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00031   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00032   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033   *
00034   ******************************************************************************
00035   */  
00036 
00037 /* Define to prevent recursive inclusion -------------------------------------*/
00038 #ifndef __STM32746G_DISCOVERY_LCD_H
00039 #define __STM32746G_DISCOVERY_LCD_H
00040 
00041 #ifdef __cplusplus
00042  extern "C" {
00043 #endif 
00044 
00045 /* Includes ------------------------------------------------------------------*/
00046 /* Include LCD component Driver */
00047 /* LCD RK043FN48H-CT672B 4,3" 480x272 pixels */
00048 #include "../Components/rk043fn48h/rk043fn48h.h"
00049 
00050 /* Include SDRAM Driver */
00051 #include "stm32746g_discovery_sdram.h"
00052  
00053 #include "stm32746g_discovery.h"
00054 #include "../../../Utilities/Fonts/fonts.h"
00055   
00056 /** @addtogroup BSP
00057   * @{
00058   */
00059 
00060 /** @addtogroup STM32746G_DISCOVERY
00061   * @{
00062   */
00063     
00064 /** @addtogroup STM32746G_DISCOVERY_LCD
00065   * @{
00066   */ 
00067 
00068 /** @defgroup STM32746G_DISCOVERY_LCD_Exported_Types STM32746G_DISCOVERY_LCD Exported Types
00069   * @{
00070   */  
00071 typedef struct 
00072 { 
00073   uint32_t TextColor; 
00074   uint32_t BackColor;  
00075   sFONT    *pFont;
00076 }LCD_DrawPropTypeDef;   
00077    
00078 typedef struct 
00079 {
00080   int16_t X;
00081   int16_t Y;
00082 }Point, * pPoint; 
00083    
00084 /** 
00085   * @brief  Line mode structures definition  
00086   */ 
00087 typedef enum
00088 {
00089   CENTER_MODE             = 0x01,    /* Center mode */
00090   RIGHT_MODE              = 0x02,    /* Right mode  */
00091   LEFT_MODE               = 0x03     /* Left mode   */
00092 }Text_AlignModeTypdef;
00093 
00094 /**
00095   * @}
00096   */ 
00097 
00098 /** @defgroup STM32746G_DISCOVERY_LCD_Exported_Constants STM32746G_DISCOVERY_LCD Exported Constants
00099   * @{
00100   */ 
00101 #define MAX_LAYER_NUMBER       ((uint32_t)2)
00102 
00103 #define LCD_LayerCfgTypeDef    LTDC_LayerCfgTypeDef
00104 
00105 #define LTDC_ACTIVE_LAYER        ((uint32_t)1) /* Layer 1 */
00106 /** 
00107   * @brief  LCD status structure definition  
00108   */     
00109 #define LCD_OK                 ((uint8_t)0x00)
00110 #define LCD_ERROR              ((uint8_t)0x01)
00111 #define LCD_TIMEOUT            ((uint8_t)0x02)
00112 
00113 /** 
00114   * @brief  LCD FB_StartAddress  
00115   */
00116 #define LCD_FB_START_ADDRESS       ((uint32_t)0xC0000000)
00117 
00118 /** 
00119   * @brief  LCD color  
00120   */ 
00121 #define LCD_COLOR_BLUE          ((uint32_t)0xFF0000FF)
00122 #define LCD_COLOR_GREEN         ((uint32_t)0xFF00FF00)
00123 #define LCD_COLOR_RED           ((uint32_t)0xFFFF0000)
00124 #define LCD_COLOR_CYAN          ((uint32_t)0xFF00FFFF)
00125 #define LCD_COLOR_MAGENTA       ((uint32_t)0xFFFF00FF)
00126 #define LCD_COLOR_YELLOW        ((uint32_t)0xFFFFFF00)
00127 #define LCD_COLOR_LIGHTBLUE     ((uint32_t)0xFF8080FF)
00128 #define LCD_COLOR_LIGHTGREEN    ((uint32_t)0xFF80FF80)
00129 #define LCD_COLOR_LIGHTRED      ((uint32_t)0xFFFF8080)
00130 #define LCD_COLOR_LIGHTCYAN     ((uint32_t)0xFF80FFFF)
00131 #define LCD_COLOR_LIGHTMAGENTA  ((uint32_t)0xFFFF80FF)
00132 #define LCD_COLOR_LIGHTYELLOW   ((uint32_t)0xFFFFFF80)
00133 #define LCD_COLOR_DARKBLUE      ((uint32_t)0xFF000080)
00134 #define LCD_COLOR_DARKGREEN     ((uint32_t)0xFF008000)
00135 #define LCD_COLOR_DARKRED       ((uint32_t)0xFF800000)
00136 #define LCD_COLOR_DARKCYAN      ((uint32_t)0xFF008080)
00137 #define LCD_COLOR_DARKMAGENTA   ((uint32_t)0xFF800080)
00138 #define LCD_COLOR_DARKYELLOW    ((uint32_t)0xFF808000)
00139 #define LCD_COLOR_WHITE         ((uint32_t)0xFFFFFFFF)
00140 #define LCD_COLOR_LIGHTGRAY     ((uint32_t)0xFFD3D3D3)
00141 #define LCD_COLOR_GRAY          ((uint32_t)0xFF808080)
00142 #define LCD_COLOR_DARKGRAY      ((uint32_t)0xFF404040)
00143 #define LCD_COLOR_BLACK         ((uint32_t)0xFF000000)
00144 #define LCD_COLOR_BROWN         ((uint32_t)0xFFA52A2A)
00145 #define LCD_COLOR_ORANGE        ((uint32_t)0xFFFFA500)
00146 #define LCD_COLOR_TRANSPARENT   ((uint32_t)0xFF000000)
00147 
00148 /** 
00149   * @brief LCD default font 
00150   */ 
00151 #define LCD_DEFAULT_FONT        Font24     
00152 
00153 /** 
00154   * @brief  LCD Reload Types  
00155   */
00156 #define LCD_RELOAD_IMMEDIATE               ((uint32_t)LTDC_SRCR_IMR)
00157 #define LCD_RELOAD_VERTICAL_BLANKING       ((uint32_t)LTDC_SRCR_VBR) 
00158 
00159 
00160 /**
00161   * @brief LCD special pins
00162   */
00163 /* Display enable pin */
00164 #define LCD_DISP_PIN                    GPIO_PIN_12
00165 #define LCD_DISP_GPIO_PORT              GPIOI
00166 #define LCD_DISP_GPIO_CLK_ENABLE()      __HAL_RCC_GPIOI_CLK_ENABLE()
00167 #define LCD_DISP_GPIO_CLK_DISABLE()     __HAL_RCC_GPIOI_CLK_DISABLE()
00168 
00169 /* Backlight control pin */
00170 #define LCD_BL_CTRL_PIN                  GPIO_PIN_3
00171 #define LCD_BL_CTRL_GPIO_PORT            GPIOK
00172 #define LCD_BL_CTRL_GPIO_CLK_ENABLE()    __HAL_RCC_GPIOK_CLK_ENABLE()
00173 #define LCD_BL_CTRL_GPIO_CLK_DISABLE()   __HAL_RCC_GPIOK_CLK_DISABLE()
00174 
00175 /**
00176   * @}
00177   */ 
00178 
00179 /** @addtogroup STM32746G_DISCOVERY_LCD_Exported_Functions
00180   * @{
00181   */
00182 uint8_t  BSP_LCD_Init(void);
00183 uint8_t  BSP_LCD_DeInit(void);
00184 uint32_t BSP_LCD_GetXSize(void);
00185 uint32_t BSP_LCD_GetYSize(void);
00186 void     BSP_LCD_SetXSize(uint32_t imageWidthPixels);
00187 void     BSP_LCD_SetYSize(uint32_t imageHeightPixels);
00188 
00189 /* Functions using the LTDC controller */
00190 void     BSP_LCD_LayerDefaultInit(uint16_t LayerIndex, uint32_t FrameBuffer);
00191 void     BSP_LCD_LayerRgb565Init(uint16_t LayerIndex, uint32_t FB_Address);
00192 void     BSP_LCD_SetTransparency(uint32_t LayerIndex, uint8_t Transparency);
00193 void     BSP_LCD_SetTransparency_NoReload(uint32_t LayerIndex, uint8_t Transparency);
00194 void     BSP_LCD_SetLayerAddress(uint32_t LayerIndex, uint32_t Address);
00195 void     BSP_LCD_SetLayerAddress_NoReload(uint32_t LayerIndex, uint32_t Address);
00196 void     BSP_LCD_SetColorKeying(uint32_t LayerIndex, uint32_t RGBValue);
00197 void     BSP_LCD_SetColorKeying_NoReload(uint32_t LayerIndex, uint32_t RGBValue);
00198 void     BSP_LCD_ResetColorKeying(uint32_t LayerIndex);
00199 void     BSP_LCD_ResetColorKeying_NoReload(uint32_t LayerIndex);
00200 void     BSP_LCD_SetLayerWindow(uint16_t LayerIndex, uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
00201 void     BSP_LCD_SetLayerWindow_NoReload(uint16_t LayerIndex, uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
00202 void     BSP_LCD_SelectLayer(uint32_t LayerIndex);
00203 void     BSP_LCD_SetLayerVisible(uint32_t LayerIndex, FunctionalState State);
00204 void     BSP_LCD_SetLayerVisible_NoReload(uint32_t LayerIndex, FunctionalState State);
00205 void     BSP_LCD_Reload(uint32_t ReloadType);
00206 
00207 void     BSP_LCD_SetTextColor(uint32_t Color);
00208 uint32_t BSP_LCD_GetTextColor(void);
00209 void     BSP_LCD_SetBackColor(uint32_t Color);
00210 uint32_t BSP_LCD_GetBackColor(void);
00211 void     BSP_LCD_SetFont(sFONT *fonts);
00212 sFONT    *BSP_LCD_GetFont(void);
00213 
00214 uint32_t BSP_LCD_ReadPixel(uint16_t Xpos, uint16_t Ypos);
00215 void     BSP_LCD_DrawPixel(uint16_t Xpos, uint16_t Ypos, uint32_t pixel);
00216 void     BSP_LCD_Clear(uint32_t Color);
00217 void     BSP_LCD_ClearStringLine(uint32_t Line);
00218 void     BSP_LCD_DisplayStringAtLine(uint16_t Line, uint8_t *ptr);
00219 void     BSP_LCD_DisplayStringAt(uint16_t Xpos, uint16_t Ypos, uint8_t *Text, Text_AlignModeTypdef Mode);
00220 void     BSP_LCD_DisplayChar(uint16_t Xpos, uint16_t Ypos, uint8_t Ascii);
00221 
00222 void     BSP_LCD_DrawHLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length);
00223 void     BSP_LCD_DrawVLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length);
00224 void     BSP_LCD_DrawLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
00225 void     BSP_LCD_DrawRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
00226 void     BSP_LCD_DrawCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius);
00227 void     BSP_LCD_DrawPolygon(pPoint Points, uint16_t PointCount);
00228 void     BSP_LCD_DrawEllipse(int Xpos, int Ypos, int XRadius, int YRadius);
00229 void     BSP_LCD_DrawBitmap(uint32_t Xpos, uint32_t Ypos, uint8_t *pbmp);
00230 
00231 void     BSP_LCD_FillRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
00232 void     BSP_LCD_FillCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius);
00233 void     BSP_LCD_FillPolygon(pPoint Points, uint16_t PointCount);
00234 void     BSP_LCD_FillEllipse(int Xpos, int Ypos, int XRadius, int YRadius);
00235 
00236 void     BSP_LCD_DisplayOff(void);
00237 void     BSP_LCD_DisplayOn(void);
00238 
00239 /* These functions can be modified in case the current settings
00240    need to be changed for specific application needs */
00241 void     BSP_LCD_MspInit(LTDC_HandleTypeDef *hltdc, void *Params);
00242 void     BSP_LCD_MspDeInit(LTDC_HandleTypeDef *hltdc, void *Params);
00243 void     BSP_LCD_ClockConfig(LTDC_HandleTypeDef *hltdc, void *Params);
00244 
00245 /**
00246   * @}
00247   */ 
00248 
00249 /**
00250   * @}
00251   */ 
00252   
00253 /**
00254   * @}
00255   */
00256  
00257 /**
00258   * @}
00259   */ 
00260 
00261 #ifdef __cplusplus
00262 }
00263 #endif
00264 
00265 #endif /* __STM32746G_DISCOVERY_LCD_H */
00266 
00267 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/