Projet

Dependents:   DISCO-F746NG_Scope_copy

Fork of BSP_DISCO_F746NG by ST

Committer:
bcostm
Date:
Wed Nov 09 18:26:13 2016 +0100
Revision:
5:5a395e126678
Parent:
0:c9112f0c67e3
Add more MBED comments

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcostm 0:c9112f0c67e3 1 /**
bcostm 0:c9112f0c67e3 2 ******************************************************************************
bcostm 0:c9112f0c67e3 3 * @file stm32746g_discovery_lcd.h
bcostm 0:c9112f0c67e3 4 * @author MCD Application Team
bcostm 0:c9112f0c67e3 5 * @version V1.0.0
bcostm 0:c9112f0c67e3 6 * @date 25-June-2015
bcostm 0:c9112f0c67e3 7 * @brief This file contains the common defines and functions prototypes for
bcostm 0:c9112f0c67e3 8 * the stm32746g_discovery_lcd.c driver.
bcostm 0:c9112f0c67e3 9 ******************************************************************************
bcostm 0:c9112f0c67e3 10 * @attention
bcostm 0:c9112f0c67e3 11 *
bcostm 0:c9112f0c67e3 12 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
bcostm 0:c9112f0c67e3 13 *
bcostm 0:c9112f0c67e3 14 * Redistribution and use in source and binary forms, with or without modification,
bcostm 0:c9112f0c67e3 15 * are permitted provided that the following conditions are met:
bcostm 0:c9112f0c67e3 16 * 1. Redistributions of source code must retain the above copyright notice,
bcostm 0:c9112f0c67e3 17 * this list of conditions and the following disclaimer.
bcostm 0:c9112f0c67e3 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
bcostm 0:c9112f0c67e3 19 * this list of conditions and the following disclaimer in the documentation
bcostm 0:c9112f0c67e3 20 * and/or other materials provided with the distribution.
bcostm 0:c9112f0c67e3 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bcostm 0:c9112f0c67e3 22 * may be used to endorse or promote products derived from this software
bcostm 0:c9112f0c67e3 23 * without specific prior written permission.
bcostm 0:c9112f0c67e3 24 *
bcostm 0:c9112f0c67e3 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bcostm 0:c9112f0c67e3 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bcostm 0:c9112f0c67e3 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bcostm 0:c9112f0c67e3 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bcostm 0:c9112f0c67e3 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bcostm 0:c9112f0c67e3 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bcostm 0:c9112f0c67e3 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bcostm 0:c9112f0c67e3 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bcostm 0:c9112f0c67e3 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bcostm 0:c9112f0c67e3 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bcostm 0:c9112f0c67e3 35 *
bcostm 0:c9112f0c67e3 36 ******************************************************************************
bcostm 0:c9112f0c67e3 37 */
bcostm 0:c9112f0c67e3 38
bcostm 0:c9112f0c67e3 39 /* Define to prevent recursive inclusion -------------------------------------*/
bcostm 0:c9112f0c67e3 40 #ifndef __STM32746G_DISCOVERY_LCD_H
bcostm 0:c9112f0c67e3 41 #define __STM32746G_DISCOVERY_LCD_H
bcostm 0:c9112f0c67e3 42
bcostm 0:c9112f0c67e3 43 #ifdef __cplusplus
bcostm 0:c9112f0c67e3 44 extern "C" {
bcostm 0:c9112f0c67e3 45 #endif
bcostm 0:c9112f0c67e3 46
bcostm 0:c9112f0c67e3 47 /* Includes ------------------------------------------------------------------*/
bcostm 0:c9112f0c67e3 48 /* Include LCD component Driver */
bcostm 0:c9112f0c67e3 49 /* LCD RK043FN48H-CT672B 4,3" 480x272 pixels */
bcostm 5:5a395e126678 50 #include "rk043fn48h.h" // MBED
bcostm 0:c9112f0c67e3 51
bcostm 0:c9112f0c67e3 52 /* Include SDRAM Driver */
bcostm 0:c9112f0c67e3 53 #include "stm32746g_discovery_sdram.h"
bcostm 0:c9112f0c67e3 54
bcostm 0:c9112f0c67e3 55 #include "stm32746g_discovery.h"
bcostm 5:5a395e126678 56 #include "fonts.h" // MBED
bcostm 0:c9112f0c67e3 57
bcostm 0:c9112f0c67e3 58 /** @addtogroup BSP
bcostm 0:c9112f0c67e3 59 * @{
bcostm 0:c9112f0c67e3 60 */
bcostm 0:c9112f0c67e3 61
bcostm 0:c9112f0c67e3 62 /** @addtogroup STM32746G_DISCOVERY
bcostm 0:c9112f0c67e3 63 * @{
bcostm 0:c9112f0c67e3 64 */
bcostm 0:c9112f0c67e3 65
bcostm 0:c9112f0c67e3 66 /** @addtogroup STM32746G_DISCOVERY_LCD
bcostm 0:c9112f0c67e3 67 * @{
bcostm 0:c9112f0c67e3 68 */
bcostm 0:c9112f0c67e3 69
bcostm 0:c9112f0c67e3 70 /** @defgroup STM32746G_DISCOVERY_LCD_Exported_Types STM32746G_DISCOVERY_LCD Exported Types
bcostm 0:c9112f0c67e3 71 * @{
bcostm 0:c9112f0c67e3 72 */
bcostm 0:c9112f0c67e3 73 typedef struct
bcostm 0:c9112f0c67e3 74 {
bcostm 0:c9112f0c67e3 75 uint32_t TextColor;
bcostm 0:c9112f0c67e3 76 uint32_t BackColor;
bcostm 0:c9112f0c67e3 77 sFONT *pFont;
bcostm 0:c9112f0c67e3 78 }LCD_DrawPropTypeDef;
bcostm 0:c9112f0c67e3 79
bcostm 0:c9112f0c67e3 80 typedef struct
bcostm 0:c9112f0c67e3 81 {
bcostm 0:c9112f0c67e3 82 int16_t X;
bcostm 0:c9112f0c67e3 83 int16_t Y;
bcostm 0:c9112f0c67e3 84 }Point, * pPoint;
bcostm 0:c9112f0c67e3 85
bcostm 0:c9112f0c67e3 86 /**
bcostm 0:c9112f0c67e3 87 * @brief Line mode structures definition
bcostm 0:c9112f0c67e3 88 */
bcostm 0:c9112f0c67e3 89 typedef enum
bcostm 0:c9112f0c67e3 90 {
bcostm 0:c9112f0c67e3 91 CENTER_MODE = 0x01, /* Center mode */
bcostm 0:c9112f0c67e3 92 RIGHT_MODE = 0x02, /* Right mode */
bcostm 0:c9112f0c67e3 93 LEFT_MODE = 0x03 /* Left mode */
bcostm 0:c9112f0c67e3 94 }Text_AlignModeTypdef;
bcostm 0:c9112f0c67e3 95
bcostm 0:c9112f0c67e3 96 /**
bcostm 0:c9112f0c67e3 97 * @}
bcostm 0:c9112f0c67e3 98 */
bcostm 0:c9112f0c67e3 99
bcostm 0:c9112f0c67e3 100 /** @defgroup STM32746G_DISCOVERY_LCD_Exported_Constants STM32746G_DISCOVERY_LCD Exported Constants
bcostm 0:c9112f0c67e3 101 * @{
bcostm 0:c9112f0c67e3 102 */
bcostm 0:c9112f0c67e3 103 #define MAX_LAYER_NUMBER ((uint32_t)2)
bcostm 0:c9112f0c67e3 104
bcostm 0:c9112f0c67e3 105 #define LCD_LayerCfgTypeDef LTDC_LayerCfgTypeDef
bcostm 0:c9112f0c67e3 106
bcostm 0:c9112f0c67e3 107 #define LTDC_ACTIVE_LAYER ((uint32_t)1) /* Layer 1 */
bcostm 0:c9112f0c67e3 108 /**
bcostm 0:c9112f0c67e3 109 * @brief LCD status structure definition
bcostm 0:c9112f0c67e3 110 */
bcostm 0:c9112f0c67e3 111 #define LCD_OK ((uint8_t)0x00)
bcostm 0:c9112f0c67e3 112 #define LCD_ERROR ((uint8_t)0x01)
bcostm 0:c9112f0c67e3 113 #define LCD_TIMEOUT ((uint8_t)0x02)
bcostm 0:c9112f0c67e3 114
bcostm 0:c9112f0c67e3 115 /**
bcostm 0:c9112f0c67e3 116 * @brief LCD FB_StartAddress
bcostm 0:c9112f0c67e3 117 */
bcostm 0:c9112f0c67e3 118 #define LCD_FB_START_ADDRESS ((uint32_t)0xC0000000)
bcostm 0:c9112f0c67e3 119
bcostm 0:c9112f0c67e3 120 /**
bcostm 0:c9112f0c67e3 121 * @brief LCD color
bcostm 0:c9112f0c67e3 122 */
bcostm 0:c9112f0c67e3 123 #define LCD_COLOR_BLUE ((uint32_t)0xFF0000FF)
bcostm 0:c9112f0c67e3 124 #define LCD_COLOR_GREEN ((uint32_t)0xFF00FF00)
bcostm 0:c9112f0c67e3 125 #define LCD_COLOR_RED ((uint32_t)0xFFFF0000)
bcostm 0:c9112f0c67e3 126 #define LCD_COLOR_CYAN ((uint32_t)0xFF00FFFF)
bcostm 0:c9112f0c67e3 127 #define LCD_COLOR_MAGENTA ((uint32_t)0xFFFF00FF)
bcostm 0:c9112f0c67e3 128 #define LCD_COLOR_YELLOW ((uint32_t)0xFFFFFF00)
bcostm 0:c9112f0c67e3 129 #define LCD_COLOR_LIGHTBLUE ((uint32_t)0xFF8080FF)
bcostm 0:c9112f0c67e3 130 #define LCD_COLOR_LIGHTGREEN ((uint32_t)0xFF80FF80)
bcostm 0:c9112f0c67e3 131 #define LCD_COLOR_LIGHTRED ((uint32_t)0xFFFF8080)
bcostm 0:c9112f0c67e3 132 #define LCD_COLOR_LIGHTCYAN ((uint32_t)0xFF80FFFF)
bcostm 0:c9112f0c67e3 133 #define LCD_COLOR_LIGHTMAGENTA ((uint32_t)0xFFFF80FF)
bcostm 0:c9112f0c67e3 134 #define LCD_COLOR_LIGHTYELLOW ((uint32_t)0xFFFFFF80)
bcostm 0:c9112f0c67e3 135 #define LCD_COLOR_DARKBLUE ((uint32_t)0xFF000080)
bcostm 0:c9112f0c67e3 136 #define LCD_COLOR_DARKGREEN ((uint32_t)0xFF008000)
bcostm 0:c9112f0c67e3 137 #define LCD_COLOR_DARKRED ((uint32_t)0xFF800000)
bcostm 0:c9112f0c67e3 138 #define LCD_COLOR_DARKCYAN ((uint32_t)0xFF008080)
bcostm 0:c9112f0c67e3 139 #define LCD_COLOR_DARKMAGENTA ((uint32_t)0xFF800080)
bcostm 0:c9112f0c67e3 140 #define LCD_COLOR_DARKYELLOW ((uint32_t)0xFF808000)
bcostm 0:c9112f0c67e3 141 #define LCD_COLOR_WHITE ((uint32_t)0xFFFFFFFF)
bcostm 0:c9112f0c67e3 142 #define LCD_COLOR_LIGHTGRAY ((uint32_t)0xFFD3D3D3)
bcostm 0:c9112f0c67e3 143 #define LCD_COLOR_GRAY ((uint32_t)0xFF808080)
bcostm 0:c9112f0c67e3 144 #define LCD_COLOR_DARKGRAY ((uint32_t)0xFF404040)
bcostm 0:c9112f0c67e3 145 #define LCD_COLOR_BLACK ((uint32_t)0xFF000000)
bcostm 0:c9112f0c67e3 146 #define LCD_COLOR_BROWN ((uint32_t)0xFFA52A2A)
bcostm 0:c9112f0c67e3 147 #define LCD_COLOR_ORANGE ((uint32_t)0xFFFFA500)
bcostm 0:c9112f0c67e3 148 #define LCD_COLOR_TRANSPARENT ((uint32_t)0xFF000000)
bcostm 0:c9112f0c67e3 149
bcostm 0:c9112f0c67e3 150 /**
bcostm 0:c9112f0c67e3 151 * @brief LCD default font
bcostm 0:c9112f0c67e3 152 */
bcostm 0:c9112f0c67e3 153 #define LCD_DEFAULT_FONT Font24
bcostm 0:c9112f0c67e3 154
bcostm 0:c9112f0c67e3 155 /**
bcostm 0:c9112f0c67e3 156 * @brief LCD special pins
bcostm 0:c9112f0c67e3 157 */
bcostm 0:c9112f0c67e3 158 /* Display enable pin */
bcostm 0:c9112f0c67e3 159 #define LCD_DISP_PIN GPIO_PIN_12
bcostm 0:c9112f0c67e3 160 #define LCD_DISP_GPIO_PORT GPIOI
bcostm 0:c9112f0c67e3 161 #define LCD_DISP_GPIO_CLK_ENABLE() __HAL_RCC_GPIOI_CLK_ENABLE()
bcostm 0:c9112f0c67e3 162 #define LCD_DISP_GPIO_CLK_DISABLE() __HAL_RCC_GPIOI_CLK_DISABLE()
bcostm 0:c9112f0c67e3 163
bcostm 0:c9112f0c67e3 164 /* Backlight control pin */
bcostm 0:c9112f0c67e3 165 #define LCD_BL_CTRL_PIN GPIO_PIN_3
bcostm 0:c9112f0c67e3 166 #define LCD_BL_CTRL_GPIO_PORT GPIOK
bcostm 0:c9112f0c67e3 167 #define LCD_BL_CTRL_GPIO_CLK_ENABLE() __HAL_RCC_GPIOK_CLK_ENABLE()
bcostm 0:c9112f0c67e3 168 #define LCD_BL_CTRL_GPIO_CLK_DISABLE() __HAL_RCC_GPIOK_CLK_DISABLE()
bcostm 0:c9112f0c67e3 169
bcostm 0:c9112f0c67e3 170 /**
bcostm 0:c9112f0c67e3 171 * @}
bcostm 0:c9112f0c67e3 172 */
bcostm 0:c9112f0c67e3 173
bcostm 0:c9112f0c67e3 174 /** @addtogroup STM32746G_DISCOVERY_LCD_Exported_Functions
bcostm 0:c9112f0c67e3 175 * @{
bcostm 0:c9112f0c67e3 176 */
bcostm 0:c9112f0c67e3 177 uint8_t BSP_LCD_Init(void);
bcostm 0:c9112f0c67e3 178 uint8_t BSP_LCD_DeInit(void);
bcostm 0:c9112f0c67e3 179 uint32_t BSP_LCD_GetXSize(void);
bcostm 0:c9112f0c67e3 180 uint32_t BSP_LCD_GetYSize(void);
bcostm 0:c9112f0c67e3 181 void BSP_LCD_SetXSize(uint32_t imageWidthPixels);
bcostm 0:c9112f0c67e3 182 void BSP_LCD_SetYSize(uint32_t imageHeightPixels);
bcostm 0:c9112f0c67e3 183
bcostm 0:c9112f0c67e3 184 /* Functions using the LTDC controller */
bcostm 0:c9112f0c67e3 185 void BSP_LCD_LayerDefaultInit(uint16_t LayerIndex, uint32_t FrameBuffer);
bcostm 0:c9112f0c67e3 186 void BSP_LCD_LayerRgb565Init(uint16_t LayerIndex, uint32_t FB_Address);
bcostm 0:c9112f0c67e3 187 void BSP_LCD_SetTransparency(uint32_t LayerIndex, uint8_t Transparency);
bcostm 0:c9112f0c67e3 188 void BSP_LCD_SetLayerAddress(uint32_t LayerIndex, uint32_t Address);
bcostm 0:c9112f0c67e3 189 void BSP_LCD_SetColorKeying(uint32_t LayerIndex, uint32_t RGBValue);
bcostm 0:c9112f0c67e3 190 void BSP_LCD_ResetColorKeying(uint32_t LayerIndex);
bcostm 0:c9112f0c67e3 191 void BSP_LCD_SetLayerWindow(uint16_t LayerIndex, uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
bcostm 0:c9112f0c67e3 192
bcostm 0:c9112f0c67e3 193 void BSP_LCD_SelectLayer(uint32_t LayerIndex);
bcostm 0:c9112f0c67e3 194 void BSP_LCD_SetLayerVisible(uint32_t LayerIndex, FunctionalState State);
bcostm 0:c9112f0c67e3 195
bcostm 0:c9112f0c67e3 196 void BSP_LCD_SetTextColor(uint32_t Color);
bcostm 0:c9112f0c67e3 197 uint32_t BSP_LCD_GetTextColor(void);
bcostm 0:c9112f0c67e3 198 void BSP_LCD_SetBackColor(uint32_t Color);
bcostm 0:c9112f0c67e3 199 uint32_t BSP_LCD_GetBackColor(void);
bcostm 0:c9112f0c67e3 200 void BSP_LCD_SetFont(sFONT *fonts);
bcostm 0:c9112f0c67e3 201 sFONT *BSP_LCD_GetFont(void);
bcostm 0:c9112f0c67e3 202
bcostm 0:c9112f0c67e3 203 uint32_t BSP_LCD_ReadPixel(uint16_t Xpos, uint16_t Ypos);
bcostm 0:c9112f0c67e3 204 void BSP_LCD_DrawPixel(uint16_t Xpos, uint16_t Ypos, uint32_t pixel);
bcostm 0:c9112f0c67e3 205 void BSP_LCD_Clear(uint32_t Color);
bcostm 0:c9112f0c67e3 206 void BSP_LCD_ClearStringLine(uint32_t Line);
bcostm 0:c9112f0c67e3 207 void BSP_LCD_DisplayStringAtLine(uint16_t Line, uint8_t *ptr);
bcostm 0:c9112f0c67e3 208 void BSP_LCD_DisplayStringAt(uint16_t Xpos, uint16_t Ypos, uint8_t *Text, Text_AlignModeTypdef Mode);
bcostm 0:c9112f0c67e3 209 void BSP_LCD_DisplayChar(uint16_t Xpos, uint16_t Ypos, uint8_t Ascii);
bcostm 0:c9112f0c67e3 210
bcostm 0:c9112f0c67e3 211 void BSP_LCD_DrawHLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length);
bcostm 0:c9112f0c67e3 212 void BSP_LCD_DrawVLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length);
bcostm 0:c9112f0c67e3 213 void BSP_LCD_DrawLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
bcostm 0:c9112f0c67e3 214 void BSP_LCD_DrawRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
bcostm 0:c9112f0c67e3 215 void BSP_LCD_DrawCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius);
bcostm 0:c9112f0c67e3 216 void BSP_LCD_DrawPolygon(pPoint Points, uint16_t PointCount);
bcostm 0:c9112f0c67e3 217 void BSP_LCD_DrawEllipse(int Xpos, int Ypos, int XRadius, int YRadius);
bcostm 0:c9112f0c67e3 218 void BSP_LCD_DrawBitmap(uint32_t Xpos, uint32_t Ypos, uint8_t *pbmp);
bcostm 0:c9112f0c67e3 219
bcostm 0:c9112f0c67e3 220 void BSP_LCD_FillRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
bcostm 0:c9112f0c67e3 221 void BSP_LCD_FillCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius);
bcostm 0:c9112f0c67e3 222 void BSP_LCD_FillPolygon(pPoint Points, uint16_t PointCount);
bcostm 0:c9112f0c67e3 223 void BSP_LCD_FillEllipse(int Xpos, int Ypos, int XRadius, int YRadius);
bcostm 0:c9112f0c67e3 224
bcostm 0:c9112f0c67e3 225 void BSP_LCD_DisplayOff(void);
bcostm 0:c9112f0c67e3 226 void BSP_LCD_DisplayOn(void);
bcostm 0:c9112f0c67e3 227
bcostm 0:c9112f0c67e3 228 /* These functions can be modified in case the current settings
bcostm 0:c9112f0c67e3 229 need to be changed for specific application needs */
bcostm 0:c9112f0c67e3 230 void BSP_LCD_MspInit(LTDC_HandleTypeDef *hltdc, void *Params);
bcostm 0:c9112f0c67e3 231 void BSP_LCD_MspDeInit(LTDC_HandleTypeDef *hltdc, void *Params);
bcostm 0:c9112f0c67e3 232 void BSP_LCD_ClockConfig(LTDC_HandleTypeDef *hltdc, void *Params);
bcostm 0:c9112f0c67e3 233
bcostm 0:c9112f0c67e3 234 /**
bcostm 0:c9112f0c67e3 235 * @}
bcostm 0:c9112f0c67e3 236 */
bcostm 0:c9112f0c67e3 237
bcostm 0:c9112f0c67e3 238 /**
bcostm 0:c9112f0c67e3 239 * @}
bcostm 0:c9112f0c67e3 240 */
bcostm 0:c9112f0c67e3 241
bcostm 0:c9112f0c67e3 242 /**
bcostm 0:c9112f0c67e3 243 * @}
bcostm 0:c9112f0c67e3 244 */
bcostm 0:c9112f0c67e3 245
bcostm 0:c9112f0c67e3 246 /**
bcostm 0:c9112f0c67e3 247 * @}
bcostm 0:c9112f0c67e3 248 */
bcostm 0:c9112f0c67e3 249
bcostm 0:c9112f0c67e3 250 #ifdef __cplusplus
bcostm 0:c9112f0c67e3 251 }
bcostm 0:c9112f0c67e3 252 #endif
bcostm 0:c9112f0c67e3 253
bcostm 0:c9112f0c67e3 254 #endif /* __STM32746G_DISCOVERY_LCD_H */
bcostm 0:c9112f0c67e3 255
bcostm 0:c9112f0c67e3 256 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/