This class drives the LCD display (4-inch 800x472 LCD-TFT) present on STM32F769I-DISCO board

Dependents:   Datarecorder2 DISCO-F769NI_several_example

Committer:
Jerome Coutant
Date:
Fri Feb 10 13:31:58 2017 +0100
Revision:
0:fd7c63b20d54
LCD Display DISCO-F769NI

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jerome Coutant 0:fd7c63b20d54 1 /* Copyright (c) 2010-2011 mbed.org, MIT License
Jerome Coutant 0:fd7c63b20d54 2 *
Jerome Coutant 0:fd7c63b20d54 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
Jerome Coutant 0:fd7c63b20d54 4 * and associated documentation files (the "Software"), to deal in the Software without
Jerome Coutant 0:fd7c63b20d54 5 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
Jerome Coutant 0:fd7c63b20d54 6 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
Jerome Coutant 0:fd7c63b20d54 7 * Software is furnished to do so, subject to the following conditions:
Jerome Coutant 0:fd7c63b20d54 8 *
Jerome Coutant 0:fd7c63b20d54 9 * The above copyright notice and this permission notice shall be included in all copies or
Jerome Coutant 0:fd7c63b20d54 10 * substantial portions of the Software.
Jerome Coutant 0:fd7c63b20d54 11 *
Jerome Coutant 0:fd7c63b20d54 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
Jerome Coutant 0:fd7c63b20d54 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Jerome Coutant 0:fd7c63b20d54 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
Jerome Coutant 0:fd7c63b20d54 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
Jerome Coutant 0:fd7c63b20d54 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Jerome Coutant 0:fd7c63b20d54 17 */
Jerome Coutant 0:fd7c63b20d54 18
Jerome Coutant 0:fd7c63b20d54 19 #ifndef __LCD_DISCO_F769NI_H
Jerome Coutant 0:fd7c63b20d54 20 #define __LCD_DISCO_F769NI_H
Jerome Coutant 0:fd7c63b20d54 21
Jerome Coutant 0:fd7c63b20d54 22 #ifdef TARGET_DISCO_F769NI
Jerome Coutant 0:fd7c63b20d54 23
Jerome Coutant 0:fd7c63b20d54 24 #include "mbed.h"
Jerome Coutant 0:fd7c63b20d54 25 #include "stm32f769i_discovery_lcd.h"
Jerome Coutant 0:fd7c63b20d54 26
Jerome Coutant 0:fd7c63b20d54 27 /*
Jerome Coutant 0:fd7c63b20d54 28 This class drives the LCD display (4-inch 800x472 LCD-TFT) present on STM32F769I-DISCO board.
Jerome Coutant 0:fd7c63b20d54 29
Jerome Coutant 0:fd7c63b20d54 30 Usage:
Jerome Coutant 0:fd7c63b20d54 31
Jerome Coutant 0:fd7c63b20d54 32 #include "mbed.h"
Jerome Coutant 0:fd7c63b20d54 33 #include "LCD_DISCO_F769NI.h"
Jerome Coutant 0:fd7c63b20d54 34
Jerome Coutant 0:fd7c63b20d54 35 LCD_DISCO_F769NI lcd;
Jerome Coutant 0:fd7c63b20d54 36
Jerome Coutant 0:fd7c63b20d54 37 int main()
Jerome Coutant 0:fd7c63b20d54 38 {
Jerome Coutant 0:fd7c63b20d54 39 lcd.DisplayStringAt(0, LINE(1), (uint8_t *)"MBED EXAMPLE", CENTER_MODE);
Jerome Coutant 0:fd7c63b20d54 40 wait(1);
Jerome Coutant 0:fd7c63b20d54 41 lcd.Clear(LCD_COLOR_BLUE);
Jerome Coutant 0:fd7c63b20d54 42 lcd.SetBackColor(LCD_COLOR_BLUE);
Jerome Coutant 0:fd7c63b20d54 43 lcd.SetTextColor(LCD_COLOR_WHITE);
Jerome Coutant 0:fd7c63b20d54 44 lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"DISCOVERY STM32F769NI", CENTER_MODE);
Jerome Coutant 0:fd7c63b20d54 45 while(1)
Jerome Coutant 0:fd7c63b20d54 46 {
Jerome Coutant 0:fd7c63b20d54 47 }
Jerome Coutant 0:fd7c63b20d54 48 }
Jerome Coutant 0:fd7c63b20d54 49 */
Jerome Coutant 0:fd7c63b20d54 50 class LCD_DISCO_F769NI
Jerome Coutant 0:fd7c63b20d54 51 {
Jerome Coutant 0:fd7c63b20d54 52
Jerome Coutant 0:fd7c63b20d54 53 public:
Jerome Coutant 0:fd7c63b20d54 54 //! Constructor
Jerome Coutant 0:fd7c63b20d54 55 LCD_DISCO_F769NI();
Jerome Coutant 0:fd7c63b20d54 56
Jerome Coutant 0:fd7c63b20d54 57 //! Destructor
Jerome Coutant 0:fd7c63b20d54 58 ~LCD_DISCO_F769NI();
Jerome Coutant 0:fd7c63b20d54 59
Jerome Coutant 0:fd7c63b20d54 60 /**
Jerome Coutant 0:fd7c63b20d54 61 * @brief Initializes the DSI LCD.
Jerome Coutant 0:fd7c63b20d54 62 * @param None
Jerome Coutant 0:fd7c63b20d54 63 * @retval LCD state
Jerome Coutant 0:fd7c63b20d54 64 */
Jerome Coutant 0:fd7c63b20d54 65 uint8_t Init(void);
Jerome Coutant 0:fd7c63b20d54 66
Jerome Coutant 0:fd7c63b20d54 67 /**
Jerome Coutant 0:fd7c63b20d54 68 * @brief Initializes the DSI LCD.
Jerome Coutant 0:fd7c63b20d54 69 * The ititialization is done as below:
Jerome Coutant 0:fd7c63b20d54 70 * - DSI PLL ititialization
Jerome Coutant 0:fd7c63b20d54 71 * - DSI ititialization
Jerome Coutant 0:fd7c63b20d54 72 * - LTDC ititialization
Jerome Coutant 0:fd7c63b20d54 73 * - OTM8009A LCD Display IC Driver ititialization
Jerome Coutant 0:fd7c63b20d54 74 * @param None
Jerome Coutant 0:fd7c63b20d54 75 * @retval LCD state
Jerome Coutant 0:fd7c63b20d54 76 */
Jerome Coutant 0:fd7c63b20d54 77 uint8_t InitEx(LCD_OrientationTypeDef orientation);
Jerome Coutant 0:fd7c63b20d54 78
Jerome Coutant 0:fd7c63b20d54 79 /**
Jerome Coutant 0:fd7c63b20d54 80 * @brief Initializes the DSI for HDMI monitor.
Jerome Coutant 0:fd7c63b20d54 81 * The ititialization is done as below:
Jerome Coutant 0:fd7c63b20d54 82 * - DSI PLL ititialization
Jerome Coutant 0:fd7c63b20d54 83 * - DSI ititialization
Jerome Coutant 0:fd7c63b20d54 84 * - LTDC ititialization
Jerome Coutant 0:fd7c63b20d54 85 * - DSI-HDMI ADV7533 adapter device ititialization
Jerome Coutant 0:fd7c63b20d54 86 * @param format : HDMI format could be HDMI_FORMAT_720_480 or HDMI_FORMAT_720_576
Jerome Coutant 0:fd7c63b20d54 87 * @retval LCD state
Jerome Coutant 0:fd7c63b20d54 88 */
Jerome Coutant 0:fd7c63b20d54 89 uint8_t HDMIInitEx(uint8_t format);
Jerome Coutant 0:fd7c63b20d54 90
Jerome Coutant 0:fd7c63b20d54 91 /**
Jerome Coutant 0:fd7c63b20d54 92 * @brief BSP LCD Reset
Jerome Coutant 0:fd7c63b20d54 93 * Hw reset the LCD DSI activating its XRES signal (active low for some time);
Jerome Coutant 0:fd7c63b20d54 94 * and desactivating it later.
Jerome Coutant 0:fd7c63b20d54 95 */
Jerome Coutant 0:fd7c63b20d54 96 void Reset(void);
Jerome Coutant 0:fd7c63b20d54 97
Jerome Coutant 0:fd7c63b20d54 98 /**
Jerome Coutant 0:fd7c63b20d54 99 * @brief Gets the LCD X size.
Jerome Coutant 0:fd7c63b20d54 100 * @retval Used LCD X size
Jerome Coutant 0:fd7c63b20d54 101 */
Jerome Coutant 0:fd7c63b20d54 102 uint32_t GetXSize(void);
Jerome Coutant 0:fd7c63b20d54 103
Jerome Coutant 0:fd7c63b20d54 104 /**
Jerome Coutant 0:fd7c63b20d54 105 * @brief Gets the LCD Y size.
Jerome Coutant 0:fd7c63b20d54 106 * @retval Used LCD Y size
Jerome Coutant 0:fd7c63b20d54 107 */
Jerome Coutant 0:fd7c63b20d54 108 uint32_t GetYSize(void);
Jerome Coutant 0:fd7c63b20d54 109
Jerome Coutant 0:fd7c63b20d54 110 /**
Jerome Coutant 0:fd7c63b20d54 111 * @brief Set the LCD X size.
Jerome Coutant 0:fd7c63b20d54 112 * @param imageWidthPixels : uint32_t image width in pixels unit
Jerome Coutant 0:fd7c63b20d54 113 * @retval None
Jerome Coutant 0:fd7c63b20d54 114 */
Jerome Coutant 0:fd7c63b20d54 115 void SetXSize(uint32_t imageWidthPixels);
Jerome Coutant 0:fd7c63b20d54 116
Jerome Coutant 0:fd7c63b20d54 117 /**
Jerome Coutant 0:fd7c63b20d54 118 * @brief Set the LCD Y size.
Jerome Coutant 0:fd7c63b20d54 119 * @param imageHeightPixels : uint32_t image height in lines unit
Jerome Coutant 0:fd7c63b20d54 120 */
Jerome Coutant 0:fd7c63b20d54 121 void SetYSize(uint32_t imageHeightPixels);
Jerome Coutant 0:fd7c63b20d54 122
Jerome Coutant 0:fd7c63b20d54 123 /**
Jerome Coutant 0:fd7c63b20d54 124 * @brief Initializes the LCD layers.
Jerome Coutant 0:fd7c63b20d54 125 * @param LayerIndex: Layer foreground or background
Jerome Coutant 0:fd7c63b20d54 126 * @param FB_Address: Layer frame buffer
Jerome Coutant 0:fd7c63b20d54 127 * @retval None
Jerome Coutant 0:fd7c63b20d54 128 */
Jerome Coutant 0:fd7c63b20d54 129 void LayerDefaultInit(uint16_t LayerIndex, uint32_t FB_Address);
Jerome Coutant 0:fd7c63b20d54 130
Jerome Coutant 0:fd7c63b20d54 131 /**
Jerome Coutant 0:fd7c63b20d54 132 * @brief Selects the LCD Layer.
Jerome Coutant 0:fd7c63b20d54 133 * @param LayerIndex: Layer foreground or background
Jerome Coutant 0:fd7c63b20d54 134 */
Jerome Coutant 0:fd7c63b20d54 135 void SelectLayer(uint32_t LayerIndex);
Jerome Coutant 0:fd7c63b20d54 136
Jerome Coutant 0:fd7c63b20d54 137 /**
Jerome Coutant 0:fd7c63b20d54 138 * @brief Sets an LCD Layer visible
Jerome Coutant 0:fd7c63b20d54 139 * @param LayerIndex: Visible Layer
Jerome Coutant 0:fd7c63b20d54 140 * @param State: New state of the specified layer
Jerome Coutant 0:fd7c63b20d54 141 * This parameter can be one of the following values:
Jerome Coutant 0:fd7c63b20d54 142 * @arg ENABLE
Jerome Coutant 0:fd7c63b20d54 143 * @arg DISABLE
Jerome Coutant 0:fd7c63b20d54 144 */
Jerome Coutant 0:fd7c63b20d54 145 void SetLayerVisible(uint32_t LayerIndex, FunctionalState State);
Jerome Coutant 0:fd7c63b20d54 146
Jerome Coutant 0:fd7c63b20d54 147 /**
Jerome Coutant 0:fd7c63b20d54 148 * @brief Configures the transparency.
Jerome Coutant 0:fd7c63b20d54 149 * @param LayerIndex: Layer foreground or background.
Jerome Coutant 0:fd7c63b20d54 150 * @param Transparency: Transparency
Jerome Coutant 0:fd7c63b20d54 151 * This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF
Jerome Coutant 0:fd7c63b20d54 152 */
Jerome Coutant 0:fd7c63b20d54 153 void SetTransparency(uint32_t LayerIndex, uint8_t Transparency);
Jerome Coutant 0:fd7c63b20d54 154
Jerome Coutant 0:fd7c63b20d54 155 /**
Jerome Coutant 0:fd7c63b20d54 156 * @brief Sets an LCD layer frame buffer address.
Jerome Coutant 0:fd7c63b20d54 157 * @param LayerIndex: Layer foreground or background
Jerome Coutant 0:fd7c63b20d54 158 * @param Address: New LCD frame buffer value
Jerome Coutant 0:fd7c63b20d54 159 */
Jerome Coutant 0:fd7c63b20d54 160 void SetLayerAddress(uint32_t LayerIndex, uint32_t Address);
Jerome Coutant 0:fd7c63b20d54 161
Jerome Coutant 0:fd7c63b20d54 162 /**
Jerome Coutant 0:fd7c63b20d54 163 * @brief Sets display window.
Jerome Coutant 0:fd7c63b20d54 164 * @param LayerIndex: Layer index
Jerome Coutant 0:fd7c63b20d54 165 * @param Xpos: LCD X position
Jerome Coutant 0:fd7c63b20d54 166 * @param Ypos: LCD Y position
Jerome Coutant 0:fd7c63b20d54 167 * @param Width: LCD window width
Jerome Coutant 0:fd7c63b20d54 168 * @param Height: LCD window height
Jerome Coutant 0:fd7c63b20d54 169 */
Jerome Coutant 0:fd7c63b20d54 170 void SetLayerWindow(uint16_t LayerIndex, uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
Jerome Coutant 0:fd7c63b20d54 171
Jerome Coutant 0:fd7c63b20d54 172 /**
Jerome Coutant 0:fd7c63b20d54 173 * @brief Configures and sets the color keying.
Jerome Coutant 0:fd7c63b20d54 174 * @param LayerIndex: Layer foreground or background
Jerome Coutant 0:fd7c63b20d54 175 * @param RGBValue: Color reference
Jerome Coutant 0:fd7c63b20d54 176 */
Jerome Coutant 0:fd7c63b20d54 177 void SetColorKeying(uint32_t LayerIndex, uint32_t RGBValue);
Jerome Coutant 0:fd7c63b20d54 178
Jerome Coutant 0:fd7c63b20d54 179 /**
Jerome Coutant 0:fd7c63b20d54 180 * @brief Disables the color keying.
Jerome Coutant 0:fd7c63b20d54 181 * @param LayerIndex: Layer foreground or background
Jerome Coutant 0:fd7c63b20d54 182 */
Jerome Coutant 0:fd7c63b20d54 183 void ResetColorKeying(uint32_t LayerIndex);
Jerome Coutant 0:fd7c63b20d54 184
Jerome Coutant 0:fd7c63b20d54 185 /**
Jerome Coutant 0:fd7c63b20d54 186 * @brief Sets the LCD text color.
Jerome Coutant 0:fd7c63b20d54 187 * @param Color: Text color code ARGB(8-8-8-8);
Jerome Coutant 0:fd7c63b20d54 188 */
Jerome Coutant 0:fd7c63b20d54 189 void SetTextColor(uint32_t Color);
Jerome Coutant 0:fd7c63b20d54 190
Jerome Coutant 0:fd7c63b20d54 191 /**
Jerome Coutant 0:fd7c63b20d54 192 * @brief Gets the LCD text color.
Jerome Coutant 0:fd7c63b20d54 193 * @retval Used text color.
Jerome Coutant 0:fd7c63b20d54 194 */
Jerome Coutant 0:fd7c63b20d54 195 uint32_t GetTextColor(void);
Jerome Coutant 0:fd7c63b20d54 196
Jerome Coutant 0:fd7c63b20d54 197 /**
Jerome Coutant 0:fd7c63b20d54 198 * @brief Sets the LCD background color.
Jerome Coutant 0:fd7c63b20d54 199 * @param Color: Layer background color code ARGB(8-8-8-8);
Jerome Coutant 0:fd7c63b20d54 200 */
Jerome Coutant 0:fd7c63b20d54 201 void SetBackColor(uint32_t Color);
Jerome Coutant 0:fd7c63b20d54 202
Jerome Coutant 0:fd7c63b20d54 203 /**
Jerome Coutant 0:fd7c63b20d54 204 * @brief Gets the LCD background color.
Jerome Coutant 0:fd7c63b20d54 205 * @retval Used background color
Jerome Coutant 0:fd7c63b20d54 206 */
Jerome Coutant 0:fd7c63b20d54 207 uint32_t GetBackColor(void);
Jerome Coutant 0:fd7c63b20d54 208
Jerome Coutant 0:fd7c63b20d54 209 /**
Jerome Coutant 0:fd7c63b20d54 210 * @brief Sets the LCD text font.
Jerome Coutant 0:fd7c63b20d54 211 * @param fonts: Layer font to be used
Jerome Coutant 0:fd7c63b20d54 212 */
Jerome Coutant 0:fd7c63b20d54 213 void SetFont(sFONT *fonts);
Jerome Coutant 0:fd7c63b20d54 214
Jerome Coutant 0:fd7c63b20d54 215 /**
Jerome Coutant 0:fd7c63b20d54 216 * @brief Gets the LCD text font.
Jerome Coutant 0:fd7c63b20d54 217 * @retval Used layer font
Jerome Coutant 0:fd7c63b20d54 218 */
Jerome Coutant 0:fd7c63b20d54 219 sFONT *GetFont(void);
Jerome Coutant 0:fd7c63b20d54 220
Jerome Coutant 0:fd7c63b20d54 221 /**
Jerome Coutant 0:fd7c63b20d54 222 * @brief Reads an LCD pixel.
Jerome Coutant 0:fd7c63b20d54 223 * @param Xpos: X position
Jerome Coutant 0:fd7c63b20d54 224 * @param Ypos: Y position
Jerome Coutant 0:fd7c63b20d54 225 * @retval RGB pixel color
Jerome Coutant 0:fd7c63b20d54 226 */
Jerome Coutant 0:fd7c63b20d54 227 uint32_t ReadPixel(uint16_t Xpos, uint16_t Ypos);
Jerome Coutant 0:fd7c63b20d54 228
Jerome Coutant 0:fd7c63b20d54 229 /**
Jerome Coutant 0:fd7c63b20d54 230 * @brief Clears the whole currently active layer of LTDC.
Jerome Coutant 0:fd7c63b20d54 231 * @param Color: Color of the background
Jerome Coutant 0:fd7c63b20d54 232 */
Jerome Coutant 0:fd7c63b20d54 233 void Clear(uint32_t Color);
Jerome Coutant 0:fd7c63b20d54 234
Jerome Coutant 0:fd7c63b20d54 235 /**
Jerome Coutant 0:fd7c63b20d54 236 * @brief Clears the selected line in currently active layer.
Jerome Coutant 0:fd7c63b20d54 237 * @param Line: Line to be cleared
Jerome Coutant 0:fd7c63b20d54 238 */
Jerome Coutant 0:fd7c63b20d54 239 void ClearStringLine(uint32_t Line);
Jerome Coutant 0:fd7c63b20d54 240
Jerome Coutant 0:fd7c63b20d54 241 /**
Jerome Coutant 0:fd7c63b20d54 242 * @brief Displays one character in currently active layer.
Jerome Coutant 0:fd7c63b20d54 243 * @param Xpos: Start column address
Jerome Coutant 0:fd7c63b20d54 244 * @param Ypos: Line where to display the character shape.
Jerome Coutant 0:fd7c63b20d54 245 * @param Ascii: Character ascii code
Jerome Coutant 0:fd7c63b20d54 246 * This parameter must be a number between Min_Data = 0x20 and Max_Data = 0x7E
Jerome Coutant 0:fd7c63b20d54 247 */
Jerome Coutant 0:fd7c63b20d54 248 void DisplayChar(uint16_t Xpos, uint16_t Ypos, uint8_t Ascii);
Jerome Coutant 0:fd7c63b20d54 249
Jerome Coutant 0:fd7c63b20d54 250 /**
Jerome Coutant 0:fd7c63b20d54 251 * @brief Displays characters in currently active layer.
Jerome Coutant 0:fd7c63b20d54 252 * @param Xpos: X position (in pixel);
Jerome Coutant 0:fd7c63b20d54 253 * @param Ypos: Y position (in pixel);
Jerome Coutant 0:fd7c63b20d54 254 * @param Text: Pointer to string to display on LCD
Jerome Coutant 0:fd7c63b20d54 255 * @param Mode: Display mode
Jerome Coutant 0:fd7c63b20d54 256 * This parameter can be one of the following values:
Jerome Coutant 0:fd7c63b20d54 257 * @arg CENTER_MODE
Jerome Coutant 0:fd7c63b20d54 258 * @arg RIGHT_MODE
Jerome Coutant 0:fd7c63b20d54 259 * @arg LEFT_MODE
Jerome Coutant 0:fd7c63b20d54 260 */
Jerome Coutant 0:fd7c63b20d54 261 void DisplayStringAt(uint16_t Xpos, uint16_t Ypos, uint8_t *Text, Text_AlignModeTypdef Mode);
Jerome Coutant 0:fd7c63b20d54 262
Jerome Coutant 0:fd7c63b20d54 263 /**
Jerome Coutant 0:fd7c63b20d54 264 * @brief Displays a maximum of 60 characters on the LCD.
Jerome Coutant 0:fd7c63b20d54 265 * @param Line: Line where to display the character shape
Jerome Coutant 0:fd7c63b20d54 266 * @param ptr: Pointer to string to display on LCD
Jerome Coutant 0:fd7c63b20d54 267 */
Jerome Coutant 0:fd7c63b20d54 268 void DisplayStringAtLine(uint16_t Line, uint8_t *ptr);
Jerome Coutant 0:fd7c63b20d54 269
Jerome Coutant 0:fd7c63b20d54 270 /**
Jerome Coutant 0:fd7c63b20d54 271 * @brief Draws an horizontal line in currently active layer.
Jerome Coutant 0:fd7c63b20d54 272 * @param Xpos: X position
Jerome Coutant 0:fd7c63b20d54 273 * @param Ypos: Y position
Jerome Coutant 0:fd7c63b20d54 274 * @param Length: Line length
Jerome Coutant 0:fd7c63b20d54 275 */
Jerome Coutant 0:fd7c63b20d54 276 void DrawHLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length);
Jerome Coutant 0:fd7c63b20d54 277
Jerome Coutant 0:fd7c63b20d54 278 /**
Jerome Coutant 0:fd7c63b20d54 279 * @brief Draws a vertical line in currently active layer.
Jerome Coutant 0:fd7c63b20d54 280 * @param Xpos: X position
Jerome Coutant 0:fd7c63b20d54 281 * @param Ypos: Y position
Jerome Coutant 0:fd7c63b20d54 282 * @param Length: Line length
Jerome Coutant 0:fd7c63b20d54 283 */
Jerome Coutant 0:fd7c63b20d54 284 void DrawVLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length);
Jerome Coutant 0:fd7c63b20d54 285
Jerome Coutant 0:fd7c63b20d54 286 /**
Jerome Coutant 0:fd7c63b20d54 287 * @brief Draws an uni-line (between two points); in currently active layer.
Jerome Coutant 0:fd7c63b20d54 288 * @param x1: Point 1 X position
Jerome Coutant 0:fd7c63b20d54 289 * @param y1: Point 1 Y position
Jerome Coutant 0:fd7c63b20d54 290 * @param x2: Point 2 X position
Jerome Coutant 0:fd7c63b20d54 291 * @param y2: Point 2 Y position
Jerome Coutant 0:fd7c63b20d54 292 */
Jerome Coutant 0:fd7c63b20d54 293 void DrawLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
Jerome Coutant 0:fd7c63b20d54 294
Jerome Coutant 0:fd7c63b20d54 295 /**
Jerome Coutant 0:fd7c63b20d54 296 * @brief Draws a rectangle in currently active layer.
Jerome Coutant 0:fd7c63b20d54 297 * @param Xpos: X position
Jerome Coutant 0:fd7c63b20d54 298 * @param Ypos: Y position
Jerome Coutant 0:fd7c63b20d54 299 * @param Width: Rectangle width
Jerome Coutant 0:fd7c63b20d54 300 * @param Height: Rectangle height
Jerome Coutant 0:fd7c63b20d54 301 */
Jerome Coutant 0:fd7c63b20d54 302 void DrawRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
Jerome Coutant 0:fd7c63b20d54 303
Jerome Coutant 0:fd7c63b20d54 304 /**
Jerome Coutant 0:fd7c63b20d54 305 * @brief Draws a circle in currently active layer.
Jerome Coutant 0:fd7c63b20d54 306 * @param Xpos: X position
Jerome Coutant 0:fd7c63b20d54 307 * @param Ypos: Y position
Jerome Coutant 0:fd7c63b20d54 308 * @param Radius: Circle radius
Jerome Coutant 0:fd7c63b20d54 309 */
Jerome Coutant 0:fd7c63b20d54 310 void DrawCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius);
Jerome Coutant 0:fd7c63b20d54 311
Jerome Coutant 0:fd7c63b20d54 312 /**
Jerome Coutant 0:fd7c63b20d54 313 * @brief Draws an poly-line (between many points); in currently active layer.
Jerome Coutant 0:fd7c63b20d54 314 * @param Points: Pointer to the points array
Jerome Coutant 0:fd7c63b20d54 315 * @param PointCount: Number of points
Jerome Coutant 0:fd7c63b20d54 316 */
Jerome Coutant 0:fd7c63b20d54 317 void DrawPolygon(pPoint Points, uint16_t PointCount);
Jerome Coutant 0:fd7c63b20d54 318
Jerome Coutant 0:fd7c63b20d54 319 /**
Jerome Coutant 0:fd7c63b20d54 320 * @brief Draws an ellipse on LCD in currently active layer.
Jerome Coutant 0:fd7c63b20d54 321 * @param Xpos: X position
Jerome Coutant 0:fd7c63b20d54 322 * @param Ypos: Y position
Jerome Coutant 0:fd7c63b20d54 323 * @param XRadius: Ellipse X radius
Jerome Coutant 0:fd7c63b20d54 324 * @param YRadius: Ellipse Y radius
Jerome Coutant 0:fd7c63b20d54 325 */
Jerome Coutant 0:fd7c63b20d54 326 void DrawEllipse(int Xpos, int Ypos, int XRadius, int YRadius);
Jerome Coutant 0:fd7c63b20d54 327
Jerome Coutant 0:fd7c63b20d54 328 /**
Jerome Coutant 0:fd7c63b20d54 329 * @brief Draws a bitmap picture loaded in the internal Flash (32 bpp); in currently active layer.
Jerome Coutant 0:fd7c63b20d54 330 * @param Xpos: Bmp X position in the LCD
Jerome Coutant 0:fd7c63b20d54 331 * @param Ypos: Bmp Y position in the LCD
Jerome Coutant 0:fd7c63b20d54 332 * @param pbmp: Pointer to Bmp picture address in the internal Flash
Jerome Coutant 0:fd7c63b20d54 333 */
Jerome Coutant 0:fd7c63b20d54 334 void DrawBitmap(uint32_t Xpos, uint32_t Ypos, uint8_t *pbmp);
Jerome Coutant 0:fd7c63b20d54 335
Jerome Coutant 0:fd7c63b20d54 336 /**
Jerome Coutant 0:fd7c63b20d54 337 * @brief Draws a full rectangle in currently active layer.
Jerome Coutant 0:fd7c63b20d54 338 * @param Xpos: X position
Jerome Coutant 0:fd7c63b20d54 339 * @param Ypos: Y position
Jerome Coutant 0:fd7c63b20d54 340 * @param Width: Rectangle width
Jerome Coutant 0:fd7c63b20d54 341 * @param Height: Rectangle height
Jerome Coutant 0:fd7c63b20d54 342 */
Jerome Coutant 0:fd7c63b20d54 343 void FillRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
Jerome Coutant 0:fd7c63b20d54 344
Jerome Coutant 0:fd7c63b20d54 345 /**
Jerome Coutant 0:fd7c63b20d54 346 * @brief Draws a full circle in currently active layer.
Jerome Coutant 0:fd7c63b20d54 347 * @param Xpos: X position
Jerome Coutant 0:fd7c63b20d54 348 * @param Ypos: Y position
Jerome Coutant 0:fd7c63b20d54 349 * @param Radius: Circle radius
Jerome Coutant 0:fd7c63b20d54 350 */
Jerome Coutant 0:fd7c63b20d54 351 void FillCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius);
Jerome Coutant 0:fd7c63b20d54 352
Jerome Coutant 0:fd7c63b20d54 353 /**
Jerome Coutant 0:fd7c63b20d54 354 * @brief Draws a full poly-line (between many points); in currently active layer.
Jerome Coutant 0:fd7c63b20d54 355 * @param Points: Pointer to the points array
Jerome Coutant 0:fd7c63b20d54 356 * @param PointCount: Number of points
Jerome Coutant 0:fd7c63b20d54 357 */
Jerome Coutant 0:fd7c63b20d54 358 void FillPolygon(pPoint Points, uint16_t PointCount);
Jerome Coutant 0:fd7c63b20d54 359
Jerome Coutant 0:fd7c63b20d54 360 /**
Jerome Coutant 0:fd7c63b20d54 361 * @brief Draws a full ellipse in currently active layer.
Jerome Coutant 0:fd7c63b20d54 362 * @param Xpos: X position
Jerome Coutant 0:fd7c63b20d54 363 * @param Ypos: Y position
Jerome Coutant 0:fd7c63b20d54 364 * @param XRadius: Ellipse X radius
Jerome Coutant 0:fd7c63b20d54 365 * @param YRadius: Ellipse Y radius
Jerome Coutant 0:fd7c63b20d54 366 */
Jerome Coutant 0:fd7c63b20d54 367 void FillEllipse(int Xpos, int Ypos, int XRadius, int YRadius);
Jerome Coutant 0:fd7c63b20d54 368
Jerome Coutant 0:fd7c63b20d54 369 /**
Jerome Coutant 0:fd7c63b20d54 370 * @brief Switch back on the display if was switched off by previous call of DisplayOff();.
Jerome Coutant 0:fd7c63b20d54 371 * Exit DSI ULPM mode if was allowed and configured in Dsi Configuration.
Jerome Coutant 0:fd7c63b20d54 372 */
Jerome Coutant 0:fd7c63b20d54 373 void DisplayOn(void);
Jerome Coutant 0:fd7c63b20d54 374
Jerome Coutant 0:fd7c63b20d54 375 /**
Jerome Coutant 0:fd7c63b20d54 376 * @brief Switch Off the display.
Jerome Coutant 0:fd7c63b20d54 377 * Enter DSI ULPM mode if was allowed and configured in Dsi Configuration.
Jerome Coutant 0:fd7c63b20d54 378 */
Jerome Coutant 0:fd7c63b20d54 379 void DisplayOff(void);
Jerome Coutant 0:fd7c63b20d54 380
Jerome Coutant 0:fd7c63b20d54 381 /**
Jerome Coutant 0:fd7c63b20d54 382 * @brief Set the brightness value
Jerome Coutant 0:fd7c63b20d54 383 * @param BrightnessValue: [00: Min (black);, 100 Max]
Jerome Coutant 0:fd7c63b20d54 384 */
Jerome Coutant 0:fd7c63b20d54 385 void SetBrightness(uint8_t BrightnessValue);
Jerome Coutant 0:fd7c63b20d54 386
Jerome Coutant 0:fd7c63b20d54 387 /**
Jerome Coutant 0:fd7c63b20d54 388 * @brief Returns the ID of connected screen by checking the HDMI
Jerome Coutant 0:fd7c63b20d54 389 * (adv7533 component); ID or LCD DSI (via TS ID) ID.
Jerome Coutant 0:fd7c63b20d54 390 * @param None
Jerome Coutant 0:fd7c63b20d54 391 * @retval LCD ID
Jerome Coutant 0:fd7c63b20d54 392 */
Jerome Coutant 0:fd7c63b20d54 393 static uint16_t LCD_IO_GetID(void);
Jerome Coutant 0:fd7c63b20d54 394
Jerome Coutant 0:fd7c63b20d54 395 /**
Jerome Coutant 0:fd7c63b20d54 396 * @brief De-Initializes the BSP LCD Msp
Jerome Coutant 0:fd7c63b20d54 397 * Application can surcharge if needed this function implementation.
Jerome Coutant 0:fd7c63b20d54 398 */
Jerome Coutant 0:fd7c63b20d54 399 __weak void MspDeInit(void);
Jerome Coutant 0:fd7c63b20d54 400
Jerome Coutant 0:fd7c63b20d54 401 /**
Jerome Coutant 0:fd7c63b20d54 402 * @brief Initialize the BSP LCD Msp.
Jerome Coutant 0:fd7c63b20d54 403 * Application can surcharge if needed this function implementation
Jerome Coutant 0:fd7c63b20d54 404 */
Jerome Coutant 0:fd7c63b20d54 405 __weak void MspInit(void);
Jerome Coutant 0:fd7c63b20d54 406
Jerome Coutant 0:fd7c63b20d54 407 /**
Jerome Coutant 0:fd7c63b20d54 408 * @brief Draws a pixel on LCD.
Jerome Coutant 0:fd7c63b20d54 409 * @param Xpos: X position
Jerome Coutant 0:fd7c63b20d54 410 * @param Ypos: Y position
Jerome Coutant 0:fd7c63b20d54 411 * @param RGB_Code: Pixel color in ARGB mode (8-8-8-8);
Jerome Coutant 0:fd7c63b20d54 412 */
Jerome Coutant 0:fd7c63b20d54 413 void DrawPixel(uint16_t Xpos, uint16_t Ypos, uint32_t RGB_Code);
Jerome Coutant 0:fd7c63b20d54 414
Jerome Coutant 0:fd7c63b20d54 415 /**
Jerome Coutant 0:fd7c63b20d54 416 * @brief Draws a character on LCD.
Jerome Coutant 0:fd7c63b20d54 417 * @param Xpos: Line where to display the character shape
Jerome Coutant 0:fd7c63b20d54 418 * @param Ypos: Start column address
Jerome Coutant 0:fd7c63b20d54 419 * @param c: Pointer to the character data
Jerome Coutant 0:fd7c63b20d54 420 */
Jerome Coutant 0:fd7c63b20d54 421 static void DrawChar(uint16_t Xpos, uint16_t Ypos, const uint8_t *c);
Jerome Coutant 0:fd7c63b20d54 422
Jerome Coutant 0:fd7c63b20d54 423 /**
Jerome Coutant 0:fd7c63b20d54 424 * @brief Fills a triangle (between 3 points);.
Jerome Coutant 0:fd7c63b20d54 425 * @param x1: Point 1 X position
Jerome Coutant 0:fd7c63b20d54 426 * @param y1: Point 1 Y position
Jerome Coutant 0:fd7c63b20d54 427 * @param x2: Point 2 X position
Jerome Coutant 0:fd7c63b20d54 428 * @param y2: Point 2 Y position
Jerome Coutant 0:fd7c63b20d54 429 * @param x3: Point 3 X position
Jerome Coutant 0:fd7c63b20d54 430 * @param y3: Point 3 Y position
Jerome Coutant 0:fd7c63b20d54 431 */
Jerome Coutant 0:fd7c63b20d54 432 static void FillTriangle(uint16_t x1, uint16_t x2, uint16_t x3, uint16_t y1, uint16_t y2, uint16_t y3);
Jerome Coutant 0:fd7c63b20d54 433
Jerome Coutant 0:fd7c63b20d54 434 /**
Jerome Coutant 0:fd7c63b20d54 435 * @brief Fills a buffer.
Jerome Coutant 0:fd7c63b20d54 436 * @param LayerIndex: Layer index
Jerome Coutant 0:fd7c63b20d54 437 * @param pDst: Pointer to destination buffer
Jerome Coutant 0:fd7c63b20d54 438 * @param xSize: Buffer width
Jerome Coutant 0:fd7c63b20d54 439 * @param ySize: Buffer height
Jerome Coutant 0:fd7c63b20d54 440 * @param OffLine: Offset
Jerome Coutant 0:fd7c63b20d54 441 * @param ColorIndex: Color index
Jerome Coutant 0:fd7c63b20d54 442 */
Jerome Coutant 0:fd7c63b20d54 443 static void LL_FillBuffer(uint32_t LayerIndex, void *pDst, uint32_t xSize, uint32_t ySize, uint32_t OffLine, uint32_t ColorIndex);
Jerome Coutant 0:fd7c63b20d54 444
Jerome Coutant 0:fd7c63b20d54 445 /**
Jerome Coutant 0:fd7c63b20d54 446 * @brief Converts a line to an ARGB8888 pixel format.
Jerome Coutant 0:fd7c63b20d54 447 * @param pSrc: Pointer to source buffer
Jerome Coutant 0:fd7c63b20d54 448 * @param pDst: Output color
Jerome Coutant 0:fd7c63b20d54 449 * @param xSize: Buffer width
Jerome Coutant 0:fd7c63b20d54 450 * @param ColorMode: Input color mode
Jerome Coutant 0:fd7c63b20d54 451 */
Jerome Coutant 0:fd7c63b20d54 452 static void LL_ConvertLineToARGB8888(void *pSrc, void *pDst, uint32_t xSize, uint32_t ColorMode);
Jerome Coutant 0:fd7c63b20d54 453
Jerome Coutant 0:fd7c63b20d54 454 private:
Jerome Coutant 0:fd7c63b20d54 455
Jerome Coutant 0:fd7c63b20d54 456 };
Jerome Coutant 0:fd7c63b20d54 457
Jerome Coutant 0:fd7c63b20d54 458 #else
Jerome Coutant 0:fd7c63b20d54 459 #error "This class must be used with DISCO_F746NG board only."
Jerome Coutant 0:fd7c63b20d54 460 #endif // TARGET_DISCO_F746NG
Jerome Coutant 0:fd7c63b20d54 461
Jerome Coutant 0:fd7c63b20d54 462 #endif