STM32L4R9I-Discovery BSP User Manual: stm32l4r9i_discovery_lcd.h Source File

STM32L4R9I-Discovery BSP

stm32l4r9i_discovery_lcd.h
Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32l4r9i_discovery_lcd.h
00004   * @author  MCD Application Team
00005   * @brief   This file contains the common defines and functions prototypes for
00006   *          the stm32l4r9i_discovery_lcd.c driver.
00007   ******************************************************************************
00008   * @attention
00009   *
00010   * <h2><center>&copy; COPYRIGHT(c) 2017 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 __STM32L4R9I_DISCOVERY_LCD_H
00039 #define __STM32L4R9I_DISCOVERY_LCD_H
00040 
00041 #ifdef __cplusplus
00042  extern "C" {
00043 #endif
00044 
00045 #include "stm32l4r9i_discovery.h"
00046 #include "../../../Utilities/Fonts/fonts.h"
00047 
00048 /** @addtogroup BSP
00049   * @{
00050   */
00051 
00052 /** @addtogroup STM32L4R9I_DISCOVERY
00053   * @{
00054   */
00055 
00056 /** @addtogroup STM32L4R9I_DISCOVERY_LCD STM32L4R9I_DISCOVERY LCD
00057   * @{
00058   */
00059 
00060 /** @defgroup STM32L4R9I_DISCOVERY_LCD_Exported_Constants LCD Exported Constants
00061   * @{
00062   */
00063 
00064 /* LTDC layer configuration structure */
00065 #define LCD_LayerCfgTypeDef               LTDC_LayerCfgTypeDef
00066 
00067 /* Maximum number of LTDC layers */
00068 #define LTDC_MAX_LAYER_NUMBER             ((uint32_t) 2)
00069 
00070 /* LTDC Background layer index */
00071 #define LTDC_ACTIVE_LAYER_BACKGROUND      LTDC_LAYER_1
00072 
00073 /* LTDC Foreground layer index : Not used on STM32L4R9I_DISCOVERY, only one layer used */
00074 #define LTDC_ACTIVE_LAYER_FOREGROUND      LTDC_LAYER_2
00075 
00076 /* Number of LTDC layers */
00077 #define LTDC_NB_OF_LAYERS                 ((uint32_t) 2)
00078 
00079 /* LTDC Default used layer index */
00080 #define LTDC_DEFAULT_ACTIVE_LAYER         LTDC_ACTIVE_LAYER_BACKGROUND
00081 
00082 /* LCD status */
00083 #define   LCD_OK         0x00
00084 #define   LCD_ERROR      0x01
00085 #define   LCD_TIMEOUT    0x02
00086 
00087 /* LCD color definitions values in ARGB8888 format */
00088 /* Blue value in ARGB8888 format */
00089 #define LCD_COLOR_BLUE          ((uint32_t) 0xFF0000FF)
00090 /* Green value in ARGB8888 format */
00091 #define LCD_COLOR_GREEN         ((uint32_t) 0xFF00FF00)
00092 /* Red value in ARGB8888 format */
00093 #define LCD_COLOR_RED           ((uint32_t) 0xFFFF0000)
00094 /* Cyan value in ARGB8888 format */
00095 #define LCD_COLOR_CYAN          ((uint32_t) 0xFF00FFFF)
00096 /* Magenta value in ARGB8888 format */
00097 #define LCD_COLOR_MAGENTA       ((uint32_t) 0xFFFF00FF)
00098 /* Yellow value in ARGB8888 format */
00099 #define LCD_COLOR_YELLOW        ((uint32_t) 0xFFFFFF00)
00100 /* Light Blue value in ARGB8888 format */
00101 #define LCD_COLOR_LIGHTBLUE     ((uint32_t) 0xFF8080FF)
00102 /* Light Green value in ARGB8888 format */
00103 #define LCD_COLOR_LIGHTGREEN    ((uint32_t) 0xFF80FF80)
00104 /* Light Red value in ARGB8888 format */
00105 #define LCD_COLOR_LIGHTRED      ((uint32_t) 0xFFFF8080)
00106 /* Light Cyan value in ARGB8888 format */
00107 #define LCD_COLOR_LIGHTCYAN     ((uint32_t) 0xFF80FFFF)
00108 /* Light Magenta value in ARGB8888 format */
00109 #define LCD_COLOR_LIGHTMAGENTA  ((uint32_t) 0xFFFF80FF)
00110 /* Light Yellow value in ARGB8888 format */
00111 #define LCD_COLOR_LIGHTYELLOW   ((uint32_t) 0xFFFFFF80)
00112 /* Dark Blue value in ARGB8888 format */
00113 #define LCD_COLOR_DARKBLUE      ((uint32_t) 0xFF000080)
00114 /* Light Dark Green value in ARGB8888 format */
00115 #define LCD_COLOR_DARKGREEN     ((uint32_t) 0xFF008000)
00116 /* Light Dark Red value in ARGB8888 format */
00117 #define LCD_COLOR_DARKRED       ((uint32_t) 0xFF800000)
00118 /* Dark Cyan value in ARGB8888 format */
00119 #define LCD_COLOR_DARKCYAN      ((uint32_t) 0xFF008080)
00120 /* Dark Magenta value in ARGB8888 format */
00121 #define LCD_COLOR_DARKMAGENTA   ((uint32_t) 0xFF800080)
00122 /* Dark Yellow value in ARGB8888 format */
00123 #define LCD_COLOR_DARKYELLOW    ((uint32_t) 0xFF808000)
00124 /* White value in ARGB8888 format */
00125 #define LCD_COLOR_WHITE         ((uint32_t) 0xFFFFFFFF)
00126 /* Light Gray value in ARGB8888 format */
00127 #define LCD_COLOR_LIGHTGRAY     ((uint32_t) 0xFFD3D3D3)
00128 /* Gray value in ARGB8888 format */
00129 #define LCD_COLOR_GRAY          ((uint32_t) 0xFF808080)
00130 /* Dark Gray value in ARGB8888 format */
00131 #define LCD_COLOR_DARKGRAY      ((uint32_t) 0xFF404040)
00132 /* Black value in ARGB8888 format */
00133 #define LCD_COLOR_BLACK         ((uint32_t) 0xFF000000)
00134 /* Brown value in ARGB8888 format */
00135 #define LCD_COLOR_BROWN         ((uint32_t) 0xFFA52A2A)
00136 /* Orange value in ARGB8888 format */
00137 #define LCD_COLOR_ORANGE        ((uint32_t) 0xFFFFA500)
00138 /* Transparent value in ARGB8888 format */
00139 #define LCD_COLOR_TRANSPARENT   ((uint32_t) 0xFF000000)
00140 
00141 /* LCD default font */
00142 #define LCD_DEFAULT_FONT        Font24
00143 
00144 /**
00145   * @}
00146   */
00147 
00148 /** @defgroup STM32L4R9I_DISCOVERY_LCD_Exported_Types LCD Exported Types
00149   * @{
00150   */
00151 
00152 /* LCD Drawing main properties */
00153 typedef struct
00154 {
00155   uint32_t TextColor; /*!< Specifies the color of text */
00156   uint32_t BackColor; /*!< Specifies the background color below the text */
00157   sFONT    *pFont;    /*!< Specifies the font used for the text */
00158 } LCD_DrawPropTypeDef;
00159 
00160 /* LCD Drawing point (pixel) geometric definition */
00161 typedef struct
00162 {
00163   int16_t X; /*!< geometric X position of drawing */
00164   int16_t Y; /*!< geometric Y position of drawing */
00165 } Point;
00166 
00167 /* Pointer on LCD Drawing point (pixel) geometric definition */
00168 typedef Point * pPoint;
00169 
00170 /* LCD drawing Line alignment mode definitions */
00171 typedef enum
00172 {
00173   CENTER_MODE             = 0x01,    /*!< Center mode */
00174   RIGHT_MODE              = 0x02,    /*!< Right mode  */
00175   LEFT_MODE               = 0x03     /*!< Left mode   */
00176 } Text_AlignModeTypdef;
00177 
00178 /* LCD_OrientationTypeDef : Possible values of Display Orientation */
00179 typedef enum
00180 {
00181   LCD_ORIENTATION_PORTRAIT  = 0x00, /*!< Portrait orientation choice of LCD screen  */
00182   LCD_ORIENTATION_LANDSCAPE = 0x01, /*!< Landscape orientation choice of LCD screen */
00183   LCD_ORIENTATION_INVALID   = 0x02  /*!< Invalid orientation choice of LCD screen   */
00184 } LCD_OrientationTypeDef;
00185 
00186 /**
00187   * @}
00188   */
00189 
00190 /** @addtogroup STM32L4R9I_DISCOVERY_LCD_Exported_Functions
00191   * @{
00192   */
00193 
00194 uint8_t  BSP_LCD_Init(void);
00195 uint8_t  BSP_LCD_DeInit(void);
00196 
00197 uint32_t BSP_LCD_GetXSize(void);
00198 uint32_t BSP_LCD_GetYSize(void);
00199 
00200 uint8_t  BSP_LCD_SetTransparency(uint32_t LayerIndex, uint8_t Transparency);
00201 uint8_t  BSP_LCD_SetColorKeying(uint32_t LayerIndex, uint32_t RGBValue);
00202 uint8_t  BSP_LCD_ResetColorKeying(uint32_t LayerIndex);
00203 
00204 uint8_t  BSP_LCD_SelectLayer(uint32_t LayerIndex);
00205 uint8_t  BSP_LCD_SetLayerVisible(uint32_t LayerIndex, FunctionalState State);
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 void     BSP_LCD_Refresh(void);
00240 uint8_t  BSP_LCD_IsFrameBufferAvailable(void);
00241 
00242 void     BSP_LCD_SetBrightness(uint8_t BrightnessValue);
00243 
00244 /* These __weak functions can be surcharged by application code for specific application needs */
00245 void     BSP_LCD_MspInit(void);
00246 void     BSP_LCD_MspDeInit(void);
00247 
00248 void     BSP_LCD_DMA2D_IRQHandler(void);
00249 void     BSP_LCD_DSI_IRQHandler(void);
00250 void     BSP_LCD_LTDC_IRQHandler(void);
00251 void     BSP_LCD_LTDC_ER_IRQHandler(void);
00252 
00253 /**
00254   * @}
00255   */
00256 
00257 /**
00258   * @}
00259   */
00260 
00261 /**
00262   * @}
00263   */
00264 
00265 /**
00266   * @}
00267   */
00268 
00269 #ifdef __cplusplus
00270 }
00271 #endif
00272 
00273 #endif /* __STM32L4R9I_DISCOVERY_LCD_H */
00274 
00275 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Fri Oct 13 2017 02:37:42 for STM32L4R9I-Discovery BSP User Manual by   doxygen 1.7.6.1