Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: DISCO-F429ZI_LCDTS_demo_richard
Fork of BSP_DISCO_F429ZI by
stm32f429i_discovery_lcd.h
00001 /** 00002 ****************************************************************************** 00003 * @file stm32f429i_discovery_lcd.h 00004 * @author MCD Application Team 00005 * @brief This file contains all the functions prototypes for the 00006 * stm32f429i_discovery_lcd.c driver. 00007 ****************************************************************************** 00008 * @attention 00009 * 00010 * <h2><center>© 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 __STM32F429I_DISCOVERY_LCD_H 00039 #define __STM32F429I_DISCOVERY_LCD_H 00040 00041 #define LANDSCAPE_MODE 00042 00043 #ifdef __cplusplus 00044 extern "C" { 00045 #endif 00046 00047 /* Includes ------------------------------------------------------------------*/ 00048 #include "stm32f429i_discovery.h" 00049 /* Include SDRAM Driver */ 00050 #include "stm32f429i_discovery_sdram.h" 00051 #include "../Fonts/fonts.h" 00052 /* Include LCD component driver */ 00053 #include "../Components/ili9341/ili9341.h" 00054 00055 /** @addtogroup BSP 00056 * @{ 00057 */ 00058 00059 /** @addtogroup STM32F429I_DISCOVERY 00060 * @{ 00061 */ 00062 00063 /** @addtogroup STM32F429I_DISCOVERY_LCD 00064 * @{ 00065 */ 00066 00067 /** @defgroup STM32F429I_DISCOVERY_LCD_Exported_Types STM32F429I DISCOVERY LCD Exported Types 00068 * @{ 00069 */ 00070 typedef enum 00071 { 00072 LCD_OK = 0, 00073 LCD_ERROR = 1, 00074 LCD_TIMEOUT = 2 00075 }LCD_StatusTypeDef; 00076 00077 typedef struct 00078 { 00079 uint32_t TextColor; 00080 uint32_t BackColor; 00081 sFONT *pFont; 00082 }LCD_DrawPropTypeDef; 00083 00084 typedef struct 00085 { 00086 int16_t X; 00087 int16_t Y; 00088 } Point, * pPoint; 00089 00090 /** 00091 * @brief Line mode structures definition 00092 */ 00093 typedef enum 00094 { 00095 CENTER_MODE = 0x01, /* center mode */ 00096 RIGHT_MODE = 0x02, /* right mode */ 00097 LEFT_MODE = 0x03, /* left mode */ 00098 }Text_AlignModeTypdef; 00099 /** 00100 * @} 00101 */ 00102 00103 /** @defgroup STM32F429I_DISCOVERY_LCD_Exported_Constants STM32F429I DISCOVERY LCD Exported Constants 00104 * @{ 00105 */ 00106 #define LCD_LayerCfgTypeDef LTDC_LayerCfgTypeDef 00107 00108 /** 00109 * @brief LCD status structure definition 00110 */ 00111 00112 /* LCD buffer is on SDRAM */ 00113 /* so for 320x240*4 bits per pixels 400ko per frame */ 00114 /* with 8 MB you can do a lot more frame than 2 */ 00115 00116 #define MAX_LAYER_NUMBER 5 00117 #define LCD_FRAME_BUFFER ((uint32_t)0xD0000000) /*this is SDRAM address */ 00118 #define BUFFER_OFFSET ((uint32_t)0x50000) 00119 00120 /** 00121 * @brief LCD color 00122 */ 00123 #define LCD_COLOR_BLUE 0xFF0000FF 00124 #define LCD_COLOR_GREEN 0xFF00FF00 00125 #define LCD_COLOR_RED 0xFFFF0000 00126 #define LCD_COLOR_CYAN 0xFF00FFFF 00127 #define LCD_COLOR_MAGENTA 0xFFFF00FF 00128 #define LCD_COLOR_YELLOW 0xFFFFFF00 00129 #define LCD_COLOR_LIGHTBLUE 0xFF8080FF 00130 #define LCD_COLOR_LIGHTGREEN 0xFF80FF80 00131 #define LCD_COLOR_LIGHTRED 0xFFFF8080 00132 #define LCD_COLOR_LIGHTCYAN 0xFF80FFFF 00133 #define LCD_COLOR_LIGHTMAGENTA 0xFFFF80FF 00134 #define LCD_COLOR_LIGHTYELLOW 0xFFFFFF80 00135 #define LCD_COLOR_DARKBLUE 0xFF000080 00136 #define LCD_COLOR_DARKGREEN 0xFF008000 00137 #define LCD_COLOR_DARKRED 0xFF800000 00138 #define LCD_COLOR_DARKCYAN 0xFF008080 00139 #define LCD_COLOR_DARKMAGENTA 0xFF800080 00140 #define LCD_COLOR_DARKYELLOW 0xFF808000 00141 #define LCD_COLOR_WHITE 0xFFFFFFFF 00142 #define LCD_COLOR_LIGHTGRAY 0xFFD3D3D3 00143 #define LCD_COLOR_GRAY 0xFF808080 00144 #define LCD_COLOR_DARKGRAY 0xFF404040 00145 #define LCD_COLOR_BLACK 0xFF000000 00146 #define LCD_COLOR_BROWN 0xFFA52A2A 00147 #define LCD_COLOR_ORANGE 0xFFFFA500 00148 #define LCD_COLOR_TRANSPARENT 0xFF000000 00149 /** 00150 * @brief LCD default font 00151 */ 00152 #define LCD_DEFAULT_FONT Font24 00153 00154 /** 00155 * @brief LCD Reload Types 00156 */ 00157 #define LCD_RELOAD_IMMEDIATE ((uint32_t)LTDC_SRCR_IMR) 00158 #define LCD_RELOAD_VERTICAL_BLANKING ((uint32_t)LTDC_SRCR_VBR) 00159 00160 /** 00161 * @brief LCD Layer 00162 */ 00163 #define LCD_BACKGROUND_LAYER 0x0000 00164 #define LCD_FOREGROUND_LAYER 0x0001 00165 00166 /** 00167 * @} 00168 */ 00169 00170 /** @defgroup STM32F429I_DISCOVERY_LCD_Exported_Macros STM32F429I DISCOVERY LCD Exported Macros 00171 * @{ 00172 */ 00173 /** 00174 * @brief LCD Pixel format 00175 */ 00176 #define LCD_PIXEL_FORMAT_ARGB8888 LTDC_PIXEL_FORMAT_ARGB8888 00177 #define LCD_PIXEL_FORMAT_RGB888 LTDC_PIXEL_FORMAT_RGB888 00178 #define LCD_PIXEL_FORMAT_RGB565 LTDC_PIXEL_FORMAT_RGB565 00179 #define LCD_PIXEL_FORMAT_ARGB1555 LTDC_PIXEL_FORMAT_ARGB1555 00180 #define LCD_PIXEL_FORMAT_ARGB4444 LTDC_PIXEL_FORMAT_ARGB4444 00181 #define LCD_PIXEL_FORMAT_L8 LTDC_PIXEL_FORMAT_L8 00182 #define LCD_PIXEL_FORMAT_AL44 LTDC_PIXEL_FORMAT_AL44 00183 #define LCD_PIXEL_FORMAT_AL88 LTDC_PIXEL_FORMAT_AL88 00184 /** 00185 * @} 00186 */ 00187 00188 /** @defgroup STM32F429I_DISCOVERY_LCD_Exported_Functions STM32F429I DISCOVERY LCD Exported Functions 00189 * @{ 00190 */ 00191 uint8_t BSP_LCD_Init(void); 00192 uint32_t BSP_LCD_GetXSize(void); 00193 uint32_t BSP_LCD_GetYSize(void); 00194 00195 /* functions using the LTDC controller */ 00196 void BSP_LCD_LayerDefaultInit(uint16_t LayerIndex, uint32_t FrameBuffer); 00197 void BSP_LCD_SetTransparency(uint32_t LayerIndex, uint8_t Transparency); 00198 void BSP_LCD_SetTransparency_NoReload(uint32_t LayerIndex, uint8_t Transparency); 00199 void BSP_LCD_SetLayerAddress(uint32_t LayerIndex, uint32_t Address); 00200 void BSP_LCD_SetLayerAddress_NoReload(uint32_t LayerIndex, uint32_t Address); 00201 void BSP_LCD_SetColorKeying(uint32_t LayerIndex, uint32_t RGBValue); 00202 void BSP_LCD_SetColorKeying_NoReload(uint32_t LayerIndex, uint32_t RGBValue); 00203 void BSP_LCD_ResetColorKeying(uint32_t LayerIndex); 00204 void BSP_LCD_ResetColorKeying_NoReload(uint32_t LayerIndex); 00205 void BSP_LCD_SetLayerWindow(uint16_t LayerIndex, uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height); 00206 void BSP_LCD_SetLayerWindow_NoReload(uint16_t LayerIndex, uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height); 00207 void BSP_LCD_SelectLayer(uint32_t LayerIndex); 00208 void BSP_LCD_SetLayerVisible(uint32_t LayerIndex, FunctionalState state); 00209 void BSP_LCD_SetLayerVisible_NoReload(uint32_t LayerIndex, FunctionalState State); 00210 void BSP_LCD_Reload(uint32_t ReloadType); 00211 00212 void BSP_LCD_SetTextColor(uint32_t Color); 00213 void BSP_LCD_SetBackColor(uint32_t Color); 00214 uint32_t BSP_LCD_GetTextColor(void); 00215 uint32_t BSP_LCD_GetBackColor(void); 00216 void BSP_LCD_SetFont(sFONT *pFonts); 00217 sFONT *BSP_LCD_GetFont(void); 00218 00219 uint32_t BSP_LCD_ReadPixel(uint16_t Xpos, uint16_t Ypos); 00220 void BSP_LCD_DrawPixel(uint16_t Xpos, uint16_t Ypos, uint32_t pixel); 00221 void BSP_LCD_Clear(uint32_t Color); 00222 void BSP_LCD_ClearStringLine(uint32_t Line); 00223 void BSP_LCD_DisplayStringAtLine(uint16_t Line, uint8_t *ptr); 00224 void BSP_LCD_DisplayStringAt(uint16_t X, uint16_t Y, uint8_t *pText, Text_AlignModeTypdef mode); 00225 void BSP_LCD_DisplayChar(uint16_t Xpos, uint16_t Ypos, uint8_t Ascii); 00226 00227 void BSP_LCD_DrawHLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length); 00228 void BSP_LCD_DrawVLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length); 00229 void BSP_LCD_DrawLine(uint16_t X1, uint16_t Y1, uint16_t X2, uint16_t Y2); 00230 void BSP_LCD_DrawRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height); 00231 void BSP_LCD_DrawCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius); 00232 void BSP_LCD_DrawPolygon(pPoint Points, uint16_t PointCount); 00233 void BSP_LCD_DrawEllipse(int Xpos, int Ypos, int XRadius, int YRadius); 00234 void BSP_LCD_DrawBitmap(uint32_t X, uint32_t Y, uint8_t *pBmp); 00235 00236 void BSP_LCD_FillRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height); 00237 void BSP_LCD_FillCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius); 00238 void BSP_LCD_FillTriangle(uint16_t X1, uint16_t X2, uint16_t X3, uint16_t Y1, uint16_t Y2, uint16_t Y3); 00239 void BSP_LCD_FillPolygon(pPoint Points, uint16_t PointCount); 00240 void BSP_LCD_FillEllipse(int Xpos, int Ypos, int XRadius, int YRadius); 00241 00242 void BSP_LCD_CopyLayer(uint16_t SourceLayer, uint16_t DestLayer, int16_t PixelShift); 00243 void BSP_LCD_DisplayOff(void); 00244 void BSP_LCD_DisplayOn(void); 00245 00246 /* This function can be modified in case the current settings need to be changed 00247 for specific application needs */ 00248 void BSP_LCD_MspInit(void); 00249 00250 void BSP_LCD_CopyLayerSdram(uint16_t SourceLayer, uint32_t SdramLayerAddress, uint16_t offset); 00251 void BSP_LCD_CopySdramLayer(uint32_t SdramAddress, uint16_t DestLayer, uint16_t offset); 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 /* __STM32F429I_DISCOVERY_LCD_H */ 00274 00275 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Wed Jul 13 2022 02:15:15 by
